mirror of
https://github.com/Andre0512/hon.git
synced 2026-07-04 08:22:44 +02:00
Remove deprecated typing and fix thread safety issue
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user