Change poll to push

This commit is contained in:
Andre Basche 2024-03-25 02:26:20 +01:00
parent 20d467a2d5
commit c46171114f
14 changed files with 8 additions and 19 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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,

View File

@ -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)

View File

@ -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)

View File

@ -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"
}

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -1 +1 @@
pyhOn==0.16.0
pyhOn==0.17.0