diff --git a/homeassistant/components/nest/device_trigger.py b/homeassistant/components/nest/device_trigger.py index 67b361e76d8..1f7f2b642dc 100644 --- a/homeassistant/components/nest/device_trigger.py +++ b/homeassistant/components/nest/device_trigger.py @@ -15,7 +15,7 @@ from homeassistant.components.device_automation.exceptions import ( ) from homeassistant.components.homeassistant.triggers import event as event_trigger from homeassistant.const import CONF_DEVICE_ID, CONF_DOMAIN, CONF_PLATFORM, CONF_TYPE -from homeassistant.core import CALLBACK_TYPE, HomeAssistant +from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback from homeassistant.helpers import device_registry as dr from homeassistant.helpers.typing import ConfigType @@ -33,7 +33,8 @@ TRIGGER_SCHEMA = DEVICE_TRIGGER_BASE_SCHEMA.extend( ) -async def async_get_nest_device_id(hass: HomeAssistant, device_id: str) -> str | None: +@callback +def async_get_nest_device_id(hass: HomeAssistant, device_id: str) -> str | None: """Get the nest API device_id from the HomeAssistant device_id.""" device_registry = dr.async_get(hass) if device := device_registry.async_get(device_id): @@ -67,7 +68,7 @@ async def async_get_triggers( hass: HomeAssistant, device_id: str ) -> list[dict[str, Any]]: """List device triggers for a Nest device.""" - nest_device_id = await async_get_nest_device_id(hass, device_id) + nest_device_id = async_get_nest_device_id(hass, device_id) if not nest_device_id: raise InvalidDeviceAutomationConfig(f"Device not found {device_id}") trigger_types = await async_get_device_trigger_types(hass, nest_device_id)