Remove deprecated typing and fix thread safety issue

This commit is contained in:
Niek Schoemaker
2024-12-29 21:03:40 +01:00
parent 70eb6c0111
commit 6ffb7a4901
12 changed files with 53 additions and 56 deletions
+10 -5
View File
@@ -21,10 +21,9 @@ from homeassistant.const import (
UnitOfTime,
UnitOfTemperature,
)
from homeassistant.core import callback
from homeassistant.core import callback, HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import HomeAssistantType
from . import const
from .const import DOMAIN
@@ -513,6 +512,12 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
translation_key="mach_modes_ac",
option_list=const.AC_MACH_MODE,
),
HonSensorEntityDescription(
key="compressorFrequency",
name="Compressor Frequency",
icon="mdi:information",
device_class=SensorDeviceClass.FREQUENCY,
),
),
"REF": (
HonSensorEntityDescription(
@@ -808,7 +813,7 @@ SENSORS["WD"] = unique_entities(SENSORS["WM"], SENSORS["TD"])
async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
entities = []
entity: HonSensorEntity | HonConfigSensorEntity
@@ -846,7 +851,7 @@ class HonSensorEntity(HonEntity, SensorEntity):
self._attr_native_value = 0
self._attr_native_value = value
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()
class HonConfigSensorEntity(HonEntity, SensorEntity):
@@ -874,4 +879,4 @@ class HonConfigSensorEntity(HonEntity, SensorEntity):
value = get_readable(self.entity_description, value)
self._attr_native_value = value
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()