aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--custom_components/hon/binary_sensor.py1
-rw-r--r--custom_components/hon/button.py2
-rw-r--r--custom_components/hon/climate.py1
-rw-r--r--custom_components/hon/const.py1
-rw-r--r--custom_components/hon/fan.py1
-rw-r--r--custom_components/hon/hon.py7
-rw-r--r--custom_components/hon/light.py1
-rw-r--r--custom_components/hon/lock.py1
-rw-r--r--custom_components/hon/manifest.json6
-rw-r--r--custom_components/hon/number.py1
-rw-r--r--custom_components/hon/select.py1
-rw-r--r--custom_components/hon/sensor.py1
-rw-r--r--custom_components/hon/switch.py1
-rw-r--r--requirements.txt2
14 files changed, 8 insertions, 19 deletions
diff --git a/custom_components/hon/binary_sensor.py b/custom_components/hon/binary_sensor.py
index 45774c1..7e861eb 100644
--- a/custom_components/hon/binary_sensor.py
+++ b/custom_components/hon/binary_sensor.py
@@ -324,7 +324,6 @@ async def async_setup_entry(
324 if device.get(description.key) is None: 324 if device.get(description.key) is None:
325 continue 325 continue
326 entity = HonBinarySensorEntity(hass, entry, device, description) 326 entity = HonBinarySensorEntity(hass, entry, device, description)
327 await entity.coordinator.async_config_entry_first_refresh()
328 entities.append(entity) 327 entities.append(entity)
329 async_add_entities(entities) 328 async_add_entities(entities)
330 329
diff --git a/custom_components/hon/button.py b/custom_components/hon/button.py
index 7a5cf24..0d4b4b8 100644
--- a/custom_components/hon/button.py
+++ b/custom_components/hon/button.py
@@ -64,11 +64,9 @@ async def async_setup_entry(
64 if not device.commands.get(description.key): 64 if not device.commands.get(description.key):
65 continue 65 continue
66 entity = HonButtonEntity(hass, entry, device, description) 66 entity = HonButtonEntity(hass, entry, device, description)
67 await entity.coordinator.async_config_entry_first_refresh()
68 entities.append(entity) 67 entities.append(entity)
69 entities.append(HonDeviceInfo(hass, entry, device)) 68 entities.append(HonDeviceInfo(hass, entry, device))
70 entities.append(HonDataArchive(hass, entry, device)) 69 entities.append(HonDataArchive(hass, entry, device))
71 await entities[-1].coordinator.async_config_entry_first_refresh()
72 async_add_entities(entities) 70 async_add_entities(entities)
73 71
74 72
diff --git a/custom_components/hon/climate.py b/custom_components/hon/climate.py
index 0d1a2ac..9f26171 100644
--- a/custom_components/hon/climate.py
+++ b/custom_components/hon/climate.py
@@ -120,7 +120,6 @@ async def async_setup_entry(
120 entity = HonClimateEntity(hass, entry, device, description) 120 entity = HonClimateEntity(hass, entry, device, description)
121 else: 121 else:
122 continue # type: ignore[unreachable] 122 continue # type: ignore[unreachable]
123 await entity.coordinator.async_config_entry_first_refresh()
124 entities.append(entity) 123 entities.append(entity)
125 async_add_entities(entities) 124 async_add_entities(entities)
126 125
diff --git a/custom_components/hon/const.py b/custom_components/hon/const.py
index 8ca9b07..69ba158 100644
--- a/custom_components/hon/const.py
+++ b/custom_components/hon/const.py
@@ -7,7 +7,6 @@ from homeassistant.components.climate import (
7) 7)
8 8
9DOMAIN: str = "hon" 9DOMAIN: str = "hon"
10UPDATE_INTERVAL: int = 60
11MOBILE_ID: str = "homassistant" 10MOBILE_ID: str = "homassistant"
12CONF_REFRESH_TOKEN = "refresh_token" 11CONF_REFRESH_TOKEN = "refresh_token"
13 12
diff --git a/custom_components/hon/fan.py b/custom_components/hon/fan.py
index f51edc8..02e6673 100644
--- a/custom_components/hon/fan.py
+++ b/custom_components/hon/fan.py
@@ -47,7 +47,6 @@ async def async_setup_entry(
47 ): 47 ):
48 continue 48 continue
49 entity = HonFanEntity(hass, entry, device, description) 49 entity = HonFanEntity(hass, entry, device, description)
50 await entity.coordinator.async_config_entry_first_refresh()
51 entities.append(entity) 50 entities.append(entity)
52 async_add_entities(entities) 51 async_add_entities(entities)
53 52
diff --git a/custom_components/hon/hon.py b/custom_components/hon/hon.py
index 4b88aa6..e873f32 100644
--- a/custom_components/hon/hon.py
+++ b/custom_components/hon/hon.py
@@ -14,7 +14,7 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
14from homeassistant.helpers.update_coordinator import DataUpdateCoordinator 14from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
15from pyhon.appliance import HonAppliance 15from pyhon.appliance import HonAppliance
16 16
17from .const import DOMAIN, UPDATE_INTERVAL 17from .const import DOMAIN
18from .typedefs import HonEntityDescription, HonOptionEntityDescription, T 18from .typedefs import HonEntityDescription, HonOptionEntityDescription, T
19 19
20_LOGGER = logging.getLogger(__name__) 20_LOGGER = logging.getLogger(__name__)
@@ -53,13 +53,13 @@ class HonCoordinator(DataUpdateCoordinator[None]):
53 hass, 53 hass,
54 _LOGGER, 54 _LOGGER,
55 name=device.unique_id, 55 name=device.unique_id,
56 update_interval=timedelta(seconds=UPDATE_INTERVAL),
57 ) 56 )
58 self._device = device 57 self._device = device
59 self._info = HonInfo() 58 self._info = HonInfo()
59 self._device.subscribe(self.async_set_updated_data)
60 60
61 async def _async_update_data(self) -> None: 61 async def _async_update_data(self) -> None:
62 return await self._device.update() 62 return
63 63
64 @property 64 @property
65 def info(self) -> HonInfo: 65 def info(self) -> HonInfo:
@@ -68,6 +68,7 @@ class HonCoordinator(DataUpdateCoordinator[None]):
68 68
69class HonEntity(CoordinatorEntity[HonCoordinator]): 69class HonEntity(CoordinatorEntity[HonCoordinator]):
70 _attr_has_entity_name = True 70 _attr_has_entity_name = True
71 _attr_should_poll = False
71 72
72 def __init__( 73 def __init__(
73 self, 74 self,
diff --git a/custom_components/hon/light.py b/custom_components/hon/light.py
index ef64a98..e54956d 100644
--- a/custom_components/hon/light.py
+++ b/custom_components/hon/light.py
@@ -64,7 +64,6 @@ async def async_setup_entry(
64 ): 64 ):
65 continue 65 continue
66 entity = HonLightEntity(hass, entry, device, description) 66 entity = HonLightEntity(hass, entry, device, description)
67 await entity.coordinator.async_config_entry_first_refresh()
68 entities.append(entity) 67 entities.append(entity)
69 async_add_entities(entities) 68 async_add_entities(entities)
70 69
diff --git a/custom_components/hon/lock.py b/custom_components/hon/lock.py
index 4e7d526..97c3b58 100644
--- a/custom_components/hon/lock.py
+++ b/custom_components/hon/lock.py
@@ -37,7 +37,6 @@ async def async_setup_entry(
37 ): 37 ):
38 continue 38 continue
39 entity = HonLockEntity(hass, entry, device, description) 39 entity = HonLockEntity(hass, entry, device, description)
40 await entity.coordinator.async_config_entry_first_refresh()
41 entities.append(entity) 40 entities.append(entity)
42 41
43 async_add_entities(entities) 42 async_add_entities(entities)
diff --git a/custom_components/hon/manifest.json b/custom_components/hon/manifest.json
index ffe7d27..562cc0a 100644
--- a/custom_components/hon/manifest.json
+++ b/custom_components/hon/manifest.json
@@ -6,10 +6,10 @@
6 ], 6 ],
7 "config_flow": true, 7 "config_flow": true,
8 "documentation": "https://github.com/Andre0512/hon/", 8 "documentation": "https://github.com/Andre0512/hon/",
9 "iot_class": "cloud_polling", 9 "iot_class": "cloud_push",
10 "issue_tracker": "https://github.com/Andre0512/hon/issues", 10 "issue_tracker": "https://github.com/Andre0512/hon/issues",
11 "requirements": [ 11 "requirements": [
12 "pyhOn==0.16.1" 12 "pyhOn==0.17.0"
13 ], 13 ],
14 "version": "0.14.0-beta.1" 14 "version": "0.14.0-beta.2"
15} 15}
diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py
index 9d92184..e5e84dd 100644
--- a/custom_components/hon/number.py
+++ b/custom_components/hon/number.py
@@ -220,7 +220,6 @@ async def async_setup_entry(
220 entity = HonConfigNumberEntity(hass, entry, device, description) 220 entity = HonConfigNumberEntity(hass, entry, device, description)
221 else: 221 else:
222 continue 222 continue
223 await entity.coordinator.async_config_entry_first_refresh()
224 entities.append(entity) 223 entities.append(entity)
225 async_add_entities(entities) 224 async_add_entities(entities)
226 225
diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py
index 901ee15..650698f 100644
--- a/custom_components/hon/select.py
+++ b/custom_components/hon/select.py
@@ -224,7 +224,6 @@ async def async_setup_entry(
224 entity = HonConfigSelectEntity(hass, entry, device, description) 224 entity = HonConfigSelectEntity(hass, entry, device, description)
225 else: 225 else:
226 continue 226 continue
227 await entity.coordinator.async_config_entry_first_refresh()
228 entities.append(entity) 227 entities.append(entity)
229 async_add_entities(entities) 228 async_add_entities(entities)
230 229
diff --git a/custom_components/hon/sensor.py b/custom_components/hon/sensor.py
index 6d3ed76..6b5355c 100644
--- a/custom_components/hon/sensor.py
+++ b/custom_components/hon/sensor.py
@@ -824,7 +824,6 @@ async def async_setup_entry(
824 entity = HonConfigSensorEntity(hass, entry, device, description) 824 entity = HonConfigSensorEntity(hass, entry, device, description)
825 else: 825 else:
826 continue 826 continue
827 await entity.coordinator.async_config_entry_first_refresh()
828 entities.append(entity) 827 entities.append(entity)
829 828
830 async_add_entities(entities) 829 async_add_entities(entities)
diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py
index 44480c5..8b68d21 100644
--- a/custom_components/hon/switch.py
+++ b/custom_components/hon/switch.py
@@ -426,7 +426,6 @@ async def async_setup_entry(
426 entity = HonSwitchEntity(hass, entry, device, description) 426 entity = HonSwitchEntity(hass, entry, device, description)
427 else: 427 else:
428 continue 428 continue
429 await entity.coordinator.async_config_entry_first_refresh()
430 entities.append(entity) 429 entities.append(entity)
431 430
432 async_add_entities(entities) 431 async_add_entities(entities)
diff --git a/requirements.txt b/requirements.txt
index 74037b1..22a82d9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1 @@
pyhOn==0.16.0 pyhOn==0.17.0