entities correction
This commit is contained in:
@@ -75,37 +75,3 @@ class DiagnosticsSensor(SensorEntity):
|
|||||||
def should_poll(self) -> bool:
|
def should_poll(self) -> bool:
|
||||||
""" Do not poll for those entities """
|
""" Do not poll for those entities """
|
||||||
return False
|
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
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class SystemStateSwitch(SwitchEntity):
|
|||||||
) -> None:
|
) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._device = device
|
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_device_info = device.device_info
|
||||||
self._attr_unique_id = f"{DOMAIN}-SystemState-switch"
|
self._attr_unique_id = f"{DOMAIN}-SystemState-switch"
|
||||||
_LOGGER.debug("[SYS STATE] State: {}".format(bool(int(self._device.sys_state))))
|
_LOGGER.debug("[SYS STATE] State: {}".format(bool(int(self._device.sys_state))))
|
||||||
@@ -62,13 +62,11 @@ class SystemStateSwitch(SwitchEntity):
|
|||||||
|
|
||||||
def _update_state(self) -> None:
|
def _update_state(self) -> None:
|
||||||
""" update system state """
|
""" update system state """
|
||||||
_LOGGER.debug("[SYS STATE] _update_state")
|
|
||||||
self._is_on = bool(int(self._device.sys_state))
|
self._is_on = bool(int(self._device.sys_state))
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Retrieve latest state."""
|
"""Retrieve latest state."""
|
||||||
_LOGGER.debug("[SYS STATE] async_update")
|
|
||||||
self._update_state()
|
self._update_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
Reference in New Issue
Block a user