Open moa114 opened 1 year ago
Perhaps adding these to recommendation_handler is helpful in someway to this task?
from homeassistant.helpers import entity_registry
# Dynamically get weather entities weather_entities = self._get_weather_entities(hass) if not weather_entities: raise HomeAssistantError("No weather entities available") # Example: Use the first available weather entity weather_entity_id = weather_entities[0] #weather_entity_id = "weather.home" weather_state = hass.states.get(weather_entity_id) @staticmethod def _get_weather_entities(hass: HomeAssistant) -> list[str]: """Retrieve all weather entities.""" entity_reg = entity_registry.async_get(hass) return [ entity.entity_id for entity in entity_reg.entities.values() if entity.domain == "weather" ]
Perhaps adding these to recommendation_handler is helpful in someway to this task?
from homeassistant.helpers import entity_registry