mirror of
https://github.com/Andre0512/hon.git
synced 2026-07-04 04:22:43 +02:00
Remove deprecated typing and fix thread safety issue
This commit is contained in:
@@ -8,9 +8,8 @@ from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import callback, HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from pyhon.appliance import HonAppliance
|
||||
from pyhon.parameter.range import HonParameterRange
|
||||
|
||||
@@ -53,7 +52,7 @@ LIGHTS: dict[str, tuple[LightEntityDescription, ...]] = {
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
entities = []
|
||||
for device in hass.data[DOMAIN][entry.unique_id]["hon"].appliances:
|
||||
@@ -73,7 +72,7 @@ class HonLightEntity(HonEntity, LightEntity):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
entry: ConfigEntry,
|
||||
device: HonAppliance,
|
||||
description: LightEntityDescription,
|
||||
@@ -136,7 +135,7 @@ class HonLightEntity(HonEntity, LightEntity):
|
||||
self._attr_is_on = self.is_on
|
||||
self._attr_brightness = self.brightness
|
||||
if update:
|
||||
self.async_write_ha_state()
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user