mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-12 20:06:28 +00:00
Blog post for AutomationActionType deprecation (#1435)
This commit is contained in:
parent
e7c3e712e3
commit
b43acc4c30
19
blog/2022-08-15-automation-action-type-deprecation.md
Normal file
19
blog/2022-08-15-automation-action-type-deprecation.md
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
author: Marc Mueller
|
||||
authorURL: https://github.com/cdce8p
|
||||
title: "AutomationActionType deprecation for 2022.9"
|
||||
---
|
||||
|
||||
For Home Assistant Core 2022.9, we have deprecated `AutomationActionType`, `AutomationTriggerInfo`,
|
||||
and `AutomationTriggerData` from `homeassistant/components/automation/__init__.py`.
|
||||
They are being replaced by `TriggerActionType`, `TriggerInfo`, and `TriggerData`
|
||||
from `homeassistant/helpers/trigger.py`.
|
||||
|
||||
| Old | New |
|
||||
| --- | --- |
|
||||
| `AutomationActionType` | `TriggerActionType` |
|
||||
| `AutomationTriggerInfo` | `TriggerInfo` |
|
||||
| `AutomationTriggerData` | `TriggerData` |
|
||||
|
||||
Furthermore, we recommend updating the `automation_info` parameter name for the
|
||||
`async_attach_trigger` function to `trigger_info`.
|
@ -92,7 +92,7 @@ To wire it up: Given a `TRIGGER_SCHEMA` config, make sure the `action` is called
|
||||
For example, you might attach the trigger and action to [Events fired](integration_events.md) on the event bus by your integration.
|
||||
|
||||
```python
|
||||
async def async_attach_trigger(hass, config, action, automation_info):
|
||||
async def async_attach_trigger(hass, config, action, trigger_info):
|
||||
"""Attach a trigger."""
|
||||
event_config = event_trigger.TRIGGER_SCHEMA({
|
||||
event_trigger.CONF_PLATFORM: "event",
|
||||
@ -103,7 +103,7 @@ async def async_attach_trigger(hass, config, action, automation_info):
|
||||
},
|
||||
}
|
||||
return await event_trigger.async_attach_trigger(
|
||||
hass, event_config, action, automation_info, platform_type="device"
|
||||
hass, event_config, action, trigger_info, platform_type="device"
|
||||
)
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user