Blog post for AutomationActionType deprecation (#1435)

This commit is contained in:
Marc Mueller 2022-08-15 14:37:26 +02:00 committed by GitHub
parent e7c3e712e3
commit b43acc4c30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View 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`.

View File

@ -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"
)
```