1 """Select for Yale Alarm."""
3 from __future__
import annotations
5 from yalesmartalarmclient
import YaleLock, YaleLockVolume
11 from .
import YaleConfigEntry
12 from .coordinator
import YaleDataUpdateCoordinator
13 from .entity
import YaleLockEntity
15 VOLUME_OPTIONS = {value.name.lower():
str(value.value)
for value
in YaleLockVolume}
19 hass: HomeAssistant, entry: YaleConfigEntry, async_add_entities: AddEntitiesCallback
21 """Set up the Yale select entry."""
23 coordinator = entry.runtime_data
27 for lock
in coordinator.locks
28 if lock.supports_lock_config()
33 """Representation of a Yale lock volume select."""
35 _attr_translation_key =
"volume"
37 def __init__(self, coordinator: YaleDataUpdateCoordinator, lock: YaleLock) ->
None:
38 """Initialize the Yale volume select."""
42 self.
_attr_options_attr_options = [volume.name.lower()
for volume
in YaleLockVolume]
45 """Change the selected option."""
46 convert_to_value = VOLUME_OPTIONS[option]
47 option_enum = YaleLockVolume(convert_to_value)
48 if await self.
hasshasshass.async_add_executor_job(
49 self.
lock_datalock_data.set_volume, option_enum
56 """Handle updated data from the coordinator."""
None __init__(self, YaleDataUpdateCoordinator coordinator, YaleLock lock)
None async_select_option(self, str option)
None _handle_coordinator_update(self)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, YaleConfigEntry entry, AddEntitiesCallback async_add_entities)