1 """Support for Electric Kiwi hour of free power."""
3 from __future__
import annotations
14 from .const
import ATTRIBUTION, DOMAIN, HOP_COORDINATOR
15 from .coordinator
import ElectricKiwiHOPDataCoordinator
17 _LOGGER = logging.getLogger(__name__)
18 ATTR_EK_HOP_SELECT =
"hop_select"
21 entity_category=EntityCategory.CONFIG,
22 key=ATTR_EK_HOP_SELECT,
23 translation_key=
"hop_selector",
28 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
30 """Electric Kiwi select setup."""
31 hop_coordinator: ElectricKiwiHOPDataCoordinator = hass.data[DOMAIN][entry.entry_id][
35 _LOGGER.debug(
"Setting up select entity")
40 CoordinatorEntity[ElectricKiwiHOPDataCoordinator], SelectEntity
42 """Entity object for seeing and setting the hour of free power."""
44 entity_description: SelectEntityDescription
45 _attr_has_entity_name =
True
46 _attr_attribution = ATTRIBUTION
47 values_dict: dict[str, int]
51 coordinator: ElectricKiwiHOPDataCoordinator,
52 description: SelectEntityDescription,
54 """Initialise the HOP selection entity."""
57 f
"{coordinator._ek_api.customer_number}"
58 f
"_{coordinator._ek_api.connection_id}_{description.key}"
66 """Return the currently selected option."""
68 f
"{self.coordinator.data.start.start_time}"
69 f
" - {self.coordinator.data.end.end_time}"
73 """Change the selected option."""
Hop async_update_hop(self, int hop_interval)
None __init__(self, ElectricKiwiHOPDataCoordinator coordinator, SelectEntityDescription description)
None async_select_option(self, str option)
str|None current_option(self)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)