1 """Switches for Yale Alarm."""
3 from __future__
import annotations
7 from yalesmartalarmclient
import YaleLock
13 from .
import YaleConfigEntry
14 from .coordinator
import YaleDataUpdateCoordinator
15 from .entity
import YaleLockEntity
19 hass: HomeAssistant, entry: YaleConfigEntry, async_add_entities: AddEntitiesCallback
21 """Set up the Yale switch entry."""
23 coordinator = entry.runtime_data
27 for lock
in coordinator.locks
28 if lock.supports_lock_config()
33 """Representation of a Yale autolock switch."""
35 _attr_translation_key =
"autolock"
37 def __init__(self, coordinator: YaleDataUpdateCoordinator, lock: YaleLock) ->
None:
38 """Initialize the Yale Autolock Switch."""
44 """Turn the entity on."""
45 if await self.
hasshasshass.async_add_executor_job(self.
lock_datalock_data.set_autolock,
True):
50 """Turn the entity off."""
51 if await self.
hasshasshass.async_add_executor_job(self.
lock_datalock_data.set_autolock,
False):
57 """Handle updated data from the coordinator."""
None async_turn_off(self, **Any kwargs)
None _handle_coordinator_update(self)
None async_turn_on(self, **Any kwargs)
None __init__(self, YaleDataUpdateCoordinator coordinator, YaleLock lock)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, YaleConfigEntry entry, AddEntitiesCallback async_add_entities)