address code comments / tidy ups (#97716)
parent
83af2f5b8b
commit
bfa394d399
|
@ -29,9 +29,8 @@ async def async_setup_entry(
|
||||||
"""Electric Kiwi select setup."""
|
"""Electric Kiwi select setup."""
|
||||||
hop_coordinator: ElectricKiwiHOPDataCoordinator = hass.data[DOMAIN][entry.entry_id]
|
hop_coordinator: ElectricKiwiHOPDataCoordinator = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
|
||||||
_LOGGER.debug("Setting up HOP entity")
|
_LOGGER.debug("Setting up select entity")
|
||||||
entities = [ElectricKiwiSelectHOPEntity(hop_coordinator, HOP_SELECT)]
|
async_add_entities([ElectricKiwiSelectHOPEntity(hop_coordinator, HOP_SELECT)])
|
||||||
async_add_entities(entities)
|
|
||||||
|
|
||||||
|
|
||||||
class ElectricKiwiSelectHOPEntity(
|
class ElectricKiwiSelectHOPEntity(
|
||||||
|
@ -46,16 +45,15 @@ class ElectricKiwiSelectHOPEntity(
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hop_coordinator: ElectricKiwiHOPDataCoordinator,
|
coordinator: ElectricKiwiHOPDataCoordinator,
|
||||||
description: SelectEntityDescription,
|
description: SelectEntityDescription,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialise the HOP selection entity."""
|
"""Initialise the HOP selection entity."""
|
||||||
super().__init__(hop_coordinator)
|
super().__init__(coordinator)
|
||||||
self._attr_unique_id = f"{self.coordinator._ek_api.customer_number}_{self.coordinator._ek_api.connection_id}_{description.key}"
|
self._attr_unique_id = f"{coordinator._ek_api.customer_number}_{coordinator._ek_api.connection_id}_{description.key}"
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
self._state = None
|
self.values_dict = coordinator.get_hop_options()
|
||||||
self.values_dict = self.coordinator.get_hop_options()
|
self._attr_options = list(self.values_dict)
|
||||||
self._attr_options = list(self.values_dict.keys())
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_option(self) -> str | None:
|
def current_option(self) -> str | None:
|
||||||
|
|
|
@ -99,13 +99,13 @@ class ElectricKiwiHOPEntity(
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hop_coordinator: ElectricKiwiHOPDataCoordinator,
|
coordinator: ElectricKiwiHOPDataCoordinator,
|
||||||
description: ElectricKiwiHOPSensorEntityDescription,
|
description: ElectricKiwiHOPSensorEntityDescription,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Entity object for Electric Kiwi sensor."""
|
"""Entity object for Electric Kiwi sensor."""
|
||||||
super().__init__(hop_coordinator)
|
super().__init__(coordinator)
|
||||||
|
|
||||||
self._attr_unique_id = f"{self.coordinator._ek_api.customer_number}_{self.coordinator._ek_api.connection_id}_{description.key}"
|
self._attr_unique_id = f"{coordinator._ek_api.customer_number}_{coordinator._ek_api.connection_id}_{description.key}"
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in New Issue