fix Lutron Caseta smart away subscription (#158082)

Co-authored-by: J. Nick Koston <nick+github@koston.org>
This commit is contained in:
omrishiv
2025-12-08 08:45:36 -08:00
committed by GitHub
parent 2617c4a453
commit 12bc9e9f68
2 changed files with 7 additions and 3 deletions

View File

@@ -98,7 +98,11 @@ class LutronCasetaSmartAwaySwitch(LutronCasetaEntity, SwitchEntity):
async def async_added_to_hass(self) -> None:
"""Register callbacks."""
await super().async_added_to_hass()
self._smartbridge.add_smart_away_subscriber(self._handle_bridge_update)
self._smartbridge.add_smart_away_subscriber(self._handle_smart_away_update)
def _handle_smart_away_update(self, smart_away_state: str | None = None) -> None:
"""Handle updated smart away state from the bridge."""
self.async_write_ha_state()
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn Smart Away on."""

View File

@@ -113,13 +113,13 @@ class MockBridge:
"""Activate smart away."""
self.smart_away_state = "Enabled"
for callback in self._smart_away_subscribers:
callback()
callback(self.smart_away_state)
async def _deactivate(self):
"""Deactivate smart away."""
self.smart_away_state = "Disabled"
for callback in self._smart_away_subscribers:
callback()
callback(self.smart_away_state)
async def connect(self):
"""Connect the mock bridge."""