Dynamically set supported features

This commit is contained in:
Michael Hansen 2024-08-29 16:06:52 -05:00
parent f0c49b3995
commit 93cc266b06

View file

@ -101,7 +101,6 @@ class EsphomeAssistSatellite(
translation_key="assist_satellite",
entity_category=EntityCategory.CONFIG,
)
_attr_supported_features = assist_satellite.AssistSatelliteEntityFeature.ANNOUNCE
def __init__(
self,
@ -162,6 +161,12 @@ class EsphomeAssistSatellite(
)
)
if feature_flags & VoiceAssistantFeature.ANNOUNCE:
# Device supports announcements
self._attr_supported_features |= (
assist_satellite.AssistSatelliteEntityFeature.ANNOUNCE
)
async def async_will_remove_from_hass(self) -> None:
"""Run when entity will be removed from hass."""
self._is_running = False
@ -444,6 +449,8 @@ class EsphomeAssistSatellite(
finally:
self._udp_server = None
_LOGGER.debug("Stopped UDP server")
# -----------------------------------------------------------------------------