Skip to content

Commit c461711

Browse files
committed
Change poll to push
1 parent 20d467a commit c461711

File tree

14 files changed

+8
-19
lines changed

14 files changed

+8
-19
lines changed

custom_components/hon/binary_sensor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ async def async_setup_entry(
324324
if device.get(description.key) is None:
325325
continue
326326
entity = HonBinarySensorEntity(hass, entry, device, description)
327-
await entity.coordinator.async_config_entry_first_refresh()
328327
entities.append(entity)
329328
async_add_entities(entities)
330329

custom_components/hon/button.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,9 @@ async def async_setup_entry(
6464
if not device.commands.get(description.key):
6565
continue
6666
entity = HonButtonEntity(hass, entry, device, description)
67-
await entity.coordinator.async_config_entry_first_refresh()
6867
entities.append(entity)
6968
entities.append(HonDeviceInfo(hass, entry, device))
7069
entities.append(HonDataArchive(hass, entry, device))
71-
await entities[-1].coordinator.async_config_entry_first_refresh()
7270
async_add_entities(entities)
7371

7472

custom_components/hon/climate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ async def async_setup_entry(
120120
entity = HonClimateEntity(hass, entry, device, description)
121121
else:
122122
continue # type: ignore[unreachable]
123-
await entity.coordinator.async_config_entry_first_refresh()
124123
entities.append(entity)
125124
async_add_entities(entities)
126125

custom_components/hon/const.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
)
88

99
DOMAIN: str = "hon"
10-
UPDATE_INTERVAL: int = 60
1110
MOBILE_ID: str = "homassistant"
1211
CONF_REFRESH_TOKEN = "refresh_token"
1312

custom_components/hon/fan.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ async def async_setup_entry(
4747
):
4848
continue
4949
entity = HonFanEntity(hass, entry, device, description)
50-
await entity.coordinator.async_config_entry_first_refresh()
5150
entities.append(entity)
5251
async_add_entities(entities)
5352

custom_components/hon/hon.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
1515
from pyhon.appliance import HonAppliance
1616

17-
from .const import DOMAIN, UPDATE_INTERVAL
17+
from .const import DOMAIN
1818
from .typedefs import HonEntityDescription, HonOptionEntityDescription, T
1919

2020
_LOGGER = logging.getLogger(__name__)
@@ -53,13 +53,13 @@ def __init__(self, hass: HomeAssistantType, device: HonAppliance):
5353
hass,
5454
_LOGGER,
5555
name=device.unique_id,
56-
update_interval=timedelta(seconds=UPDATE_INTERVAL),
5756
)
5857
self._device = device
5958
self._info = HonInfo()
59+
self._device.subscribe(self.async_set_updated_data)
6060

6161
async def _async_update_data(self) -> None:
62-
return await self._device.update()
62+
return
6363

6464
@property
6565
def info(self) -> HonInfo:
@@ -68,6 +68,7 @@ def info(self) -> HonInfo:
6868

6969
class HonEntity(CoordinatorEntity[HonCoordinator]):
7070
_attr_has_entity_name = True
71+
_attr_should_poll = False
7172

7273
def __init__(
7374
self,

custom_components/hon/light.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ async def async_setup_entry(
6464
):
6565
continue
6666
entity = HonLightEntity(hass, entry, device, description)
67-
await entity.coordinator.async_config_entry_first_refresh()
6867
entities.append(entity)
6968
async_add_entities(entities)
7069

custom_components/hon/lock.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ async def async_setup_entry(
3737
):
3838
continue
3939
entity = HonLockEntity(hass, entry, device, description)
40-
await entity.coordinator.async_config_entry_first_refresh()
4140
entities.append(entity)
4241

4342
async_add_entities(entities)

custom_components/hon/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
],
77
"config_flow": true,
88
"documentation": "https://github.com/Andre0512/hon/",
9-
"iot_class": "cloud_polling",
9+
"iot_class": "cloud_push",
1010
"issue_tracker": "https://github.com/Andre0512/hon/issues",
1111
"requirements": [
12-
"pyhOn==0.16.1"
12+
"pyhOn==0.17.0"
1313
],
14-
"version": "0.14.0-beta.1"
14+
"version": "0.14.0-beta.2"
1515
}

custom_components/hon/number.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ async def async_setup_entry(
220220
entity = HonConfigNumberEntity(hass, entry, device, description)
221221
else:
222222
continue
223-
await entity.coordinator.async_config_entry_first_refresh()
224223
entities.append(entity)
225224
async_add_entities(entities)
226225

0 commit comments

Comments
 (0)