From a310b5c1c3b2bb745b417d8fce808f26eaed4696 Mon Sep 17 00:00:00 2001 From: Ludy Date: Wed, 24 May 2023 09:42:44 +0200 Subject: [PATCH] remove template deprecated function `device_trigger.py` (#93419) remove template deprecated fun `device_trigger.py` --- .../device_trigger/integration/device_trigger.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/script/scaffold/templates/device_trigger/integration/device_trigger.py b/script/scaffold/templates/device_trigger/integration/device_trigger.py index 1fd8810bd88..4179bf5248a 100644 --- a/script/scaffold/templates/device_trigger/integration/device_trigger.py +++ b/script/scaffold/templates/device_trigger/integration/device_trigger.py @@ -5,10 +5,6 @@ from typing import Any import voluptuous as vol -from homeassistant.components.automation import ( - AutomationActionType, - AutomationTriggerInfo, -) from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA from homeassistant.components.homeassistant.triggers import state as state_trigger from homeassistant.const import ( @@ -22,6 +18,7 @@ from homeassistant.const import ( ) from homeassistant.core import CALLBACK_TYPE, HomeAssistant from homeassistant.helpers import config_validation as cv, entity_registry as er +from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo from homeassistant.helpers.typing import ConfigType from . import DOMAIN @@ -73,8 +70,8 @@ async def async_get_triggers( async def async_attach_trigger( hass: HomeAssistant, config: ConfigType, - action: AutomationActionType, - automation_info: AutomationTriggerInfo, + action: TriggerActionType, + trigger_info: TriggerInfo, ) -> CALLBACK_TYPE: """Attach a trigger.""" # TODO Implement your own logic to attach triggers. @@ -92,5 +89,5 @@ async def async_attach_trigger( } state_config = await state_trigger.async_validate_trigger_config(hass, state_config) return await state_trigger.async_attach_trigger( - hass, state_config, action, automation_info, platform_type="device" + hass, state_config, action, trigger_info, platform_type="device" )