From 93d8b339ec68bded0682ef01931e19d0e7a46672 Mon Sep 17 00:00:00 2001 From: sinseman44 Date: Fri, 8 Dec 2023 10:10:27 +0100 Subject: [PATCH] entities correction --- custom_components/sensor.py | 34 ---------------------------------- custom_components/switch.py | 6 ++---- 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/custom_components/sensor.py b/custom_components/sensor.py index 364175b..debfa5d 100644 --- a/custom_components/sensor.py +++ b/custom_components/sensor.py @@ -75,37 +75,3 @@ class DiagnosticsSensor(SensorEntity): def should_poll(self) -> bool: """ Do not poll for those entities """ return False - -class TestVBEElapsedSecondEntity(SensorEntity): - """ La classe de l'entité TestVBE_4 """ - - def __init__(self, - hass: HomeAssistant, #pylint: disable=unused-argument - entry_infos, #pylint: disable=unused-argument - ) -> None: - """ Class constructor """ - self._attr_name = entry_infos.get("name") - self._attr_unique_id = entry_infos.get("entity_id") - self._attr_has_entity_name = True - self._attr_native_value = 36 - - @property - def icon(self) -> str | None: - return "mdi:timer-play" - - @property - def device_class(self) -> SensorDeviceClass | None: - return SensorDeviceClass.DURATION - - @property - def state_class(self) -> SensorStateClass | None: - return SensorStateClass.MEASUREMENT - - @property - def native_unit_of_measurement(self) -> str | None: - return UnitOfTime.SECONDS - - @property - def should_poll(self) -> bool: - """ Do not poll for those entities """ - return False diff --git a/custom_components/switch.py b/custom_components/switch.py index b1d66ab..8a9c2dd 100644 --- a/custom_components/switch.py +++ b/custom_components/switch.py @@ -37,12 +37,12 @@ class SystemStateSwitch(SwitchEntity): """Select component to set system state """ _attr_has_entity_name = True - def __init__(self, + def __init__(self, device: Koolnova, ) -> None: super().__init__() self._device = device - self._attr_name = f"{device.name} system state" + self._attr_name = f"{device.name} System State" self._attr_device_info = device.device_info self._attr_unique_id = f"{DOMAIN}-SystemState-switch" _LOGGER.debug("[SYS STATE] State: {}".format(bool(int(self._device.sys_state)))) @@ -62,13 +62,11 @@ class SystemStateSwitch(SwitchEntity): def _update_state(self) -> None: """ update system state """ - _LOGGER.debug("[SYS STATE] _update_state") self._is_on = bool(int(self._device.sys_state)) @Throttle(MIN_TIME_BETWEEN_UPDATES) async def async_update(self): """Retrieve latest state.""" - _LOGGER.debug("[SYS STATE] async_update") self._update_state() @property