mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 03:03:17 +01:00
fix Lutron Caseta smart away subscription (#158082)
Co-authored-by: J. Nick Koston <nick+github@koston.org>
This commit is contained in:
@@ -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."""
|
||||
|
||||
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user