From: Marcel van der Veldt Date: Tue, 8 Sep 2020 06:20:02 +0000 (+0200) Subject: fix for hass states X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=77168ec5d984ddcdb97fe58355b731562c5de322;p=music-assistant-server.git fix for hass states --- diff --git a/music_assistant/providers/home_assistant/__init__.py b/music_assistant/providers/home_assistant/__init__.py index c7e32dc4..8ed1d262 100644 --- a/music_assistant/providers/home_assistant/__init__.py +++ b/music_assistant/providers/home_assistant/__init__.py @@ -323,7 +323,7 @@ class HomeAssistantPlugin(Provider): for control_entity in self.__get_power_control_entities(): if control_entity["entity_id"] != entity_obj["entity_id"]: continue - cur_state = entity_obj["state"] != "off" + cur_state = entity_obj["state"] not in ["off", "unavailable"] if control_entity.get("source"): cur_state = entity_obj["attributes"].get("source") == control_entity["source"] await self.mass.player_manager.async_update_player_control( @@ -355,7 +355,7 @@ class HomeAssistantPlugin(Provider): LOGGER.warning("entity not found: %s", entity_id) continue state_obj = self._hass.states[entity_id] - cur_state = state_obj["state"] != "off" + cur_state = state_obj["state"] not in ["off", "unavailable"] source = control_entity.get("source") if source: cur_state = state_obj["attributes"].get("source") == control_entity["source"]