mirror of
https://github.com/Andre0512/hon.git
synced 2024-11-12 02:00:47 +01:00
Change poll to push
This commit is contained in:
parent
20d467a2d5
commit
c46171114f
@ -324,7 +324,6 @@ async def async_setup_entry(
|
||||
if device.get(description.key) is None:
|
||||
continue
|
||||
entity = HonBinarySensorEntity(hass, entry, device, description)
|
||||
await entity.coordinator.async_config_entry_first_refresh()
|
||||
entities.append(entity)
|
||||
async_add_entities(entities)
|
||||
|
||||
|
@ -64,11 +64,9 @@ async def async_setup_entry(
|
||||
if not device.commands.get(description.key):
|
||||
continue
|
||||
entity = HonButtonEntity(hass, entry, device, description)
|
||||
await entity.coordinator.async_config_entry_first_refresh()
|
||||
entities.append(entity)
|
||||
entities.append(HonDeviceInfo(hass, entry, device))
|
||||
entities.append(HonDataArchive(hass, entry, device))
|
||||
await entities[-1].coordinator.async_config_entry_first_refresh()
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
|
@ -120,7 +120,6 @@ async def async_setup_entry(
|
||||
entity = HonClimateEntity(hass, entry, device, description)
|
||||
else:
|
||||
continue # type: ignore[unreachable]
|
||||
await entity.coordinator.async_config_entry_first_refresh()
|
||||
entities.append(entity)
|
||||
async_add_entities(entities)
|
||||
|
||||
|
@ -7,7 +7,6 @@ from homeassistant.components.climate import (
|
||||
)
|
||||
|
||||
DOMAIN: str = "hon"
|
||||
UPDATE_INTERVAL: int = 60
|
||||
MOBILE_ID: str = "homassistant"
|
||||
CONF_REFRESH_TOKEN = "refresh_token"
|
||||
|
||||
|
@ -47,7 +47,6 @@ async def async_setup_entry(
|
||||
):
|
||||
continue
|
||||
entity = HonFanEntity(hass, entry, device, description)
|
||||
await entity.coordinator.async_config_entry_first_refresh()
|
||||
entities.append(entity)
|
||||
async_add_entities(entities)
|
||||
|
||||
|
@ -14,7 +14,7 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
from pyhon.appliance import HonAppliance
|
||||
|
||||
from .const import DOMAIN, UPDATE_INTERVAL
|
||||
from .const import DOMAIN
|
||||
from .typedefs import HonEntityDescription, HonOptionEntityDescription, T
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -53,13 +53,13 @@ class HonCoordinator(DataUpdateCoordinator[None]):
|
||||
hass,
|
||||
_LOGGER,
|
||||
name=device.unique_id,
|
||||
update_interval=timedelta(seconds=UPDATE_INTERVAL),
|
||||
)
|
||||
self._device = device
|
||||
self._info = HonInfo()
|
||||
self._device.subscribe(self.async_set_updated_data)
|
||||
|
||||
async def _async_update_data(self) -> None:
|
||||
return await self._device.update()
|
||||
return
|
||||
|
||||
@property
|
||||
def info(self) -> HonInfo:
|
||||
@ -68,6 +68,7 @@ class HonCoordinator(DataUpdateCoordinator[None]):
|
||||
|
||||
class HonEntity(CoordinatorEntity[HonCoordinator]):
|
||||
_attr_has_entity_name = True
|
||||
_attr_should_poll = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -64,7 +64,6 @@ async def async_setup_entry(
|
||||
):
|
||||
continue
|
||||
entity = HonLightEntity(hass, entry, device, description)
|
||||
await entity.coordinator.async_config_entry_first_refresh()
|
||||
entities.append(entity)
|
||||
async_add_entities(entities)
|
||||
|
||||
|
@ -37,7 +37,6 @@ async def async_setup_entry(
|
||||
):
|
||||
continue
|
||||
entity = HonLockEntity(hass, entry, device, description)
|
||||
await entity.coordinator.async_config_entry_first_refresh()
|
||||
entities.append(entity)
|
||||
|
||||
async_add_entities(entities)
|
||||
|
@ -6,10 +6,10 @@
|
||||
],
|
||||
"config_flow": true,
|
||||
"documentation": "https://github.com/Andre0512/hon/",
|
||||
"iot_class": "cloud_polling",
|
||||
"iot_class": "cloud_push",
|
||||
"issue_tracker": "https://github.com/Andre0512/hon/issues",
|
||||
"requirements": [
|
||||
"pyhOn==0.16.1"
|
||||
"pyhOn==0.17.0"
|
||||
],
|
||||
"version": "0.14.0-beta.1"
|
||||
"version": "0.14.0-beta.2"
|
||||
}
|
||||
|
@ -220,7 +220,6 @@ async def async_setup_entry(
|
||||
entity = HonConfigNumberEntity(hass, entry, device, description)
|
||||
else:
|
||||
continue
|
||||
await entity.coordinator.async_config_entry_first_refresh()
|
||||
entities.append(entity)
|
||||
async_add_entities(entities)
|
||||
|
||||
|
@ -224,7 +224,6 @@ async def async_setup_entry(
|
||||
entity = HonConfigSelectEntity(hass, entry, device, description)
|
||||
else:
|
||||
continue
|
||||
await entity.coordinator.async_config_entry_first_refresh()
|
||||
entities.append(entity)
|
||||
async_add_entities(entities)
|
||||
|
||||
|
@ -824,7 +824,6 @@ async def async_setup_entry(
|
||||
entity = HonConfigSensorEntity(hass, entry, device, description)
|
||||
else:
|
||||
continue
|
||||
await entity.coordinator.async_config_entry_first_refresh()
|
||||
entities.append(entity)
|
||||
|
||||
async_add_entities(entities)
|
||||
|
@ -426,7 +426,6 @@ async def async_setup_entry(
|
||||
entity = HonSwitchEntity(hass, entry, device, description)
|
||||
else:
|
||||
continue
|
||||
await entity.coordinator.async_config_entry_first_refresh()
|
||||
entities.append(entity)
|
||||
|
||||
async_add_entities(entities)
|
||||
|
@ -1 +1 @@
|
||||
pyhOn==0.16.0
|
||||
pyhOn==0.17.0
|
||||
|
Loading…
Reference in New Issue
Block a user