Skip to content

Commit

Permalink
v1
Browse files Browse the repository at this point in the history
  • Loading branch information
al-one committed Sep 25, 2024
1 parent f4829d6 commit 8e71487
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/xiaomi_miot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ async def async_update(self):
async def async_update_for_main_entity(self):
if self._miot_service:
for d in [
'fan', 'cover', 'scanner', 'number_select',
'fan', 'cover', 'scanner',
]:
pls = self.custom_config_list(f'{d}_properties') or []
if pls:
Expand Down
11 changes: 8 additions & 3 deletions custom_components/xiaomi_miot/core/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,17 @@ def init_converters(self):
self.dispatch_info()

for d in [
'sensor', 'binary_sensor', 'switch', 'number', 'select', 'button',
# 'fan', 'cover', 'scanner', 'number_select',
'sensor', 'binary_sensor', 'switch', 'number', 'select', 'button', 'number_select',
# 'fan', 'cover', 'scanner',
]:
pls = self.custom_config_list(f'{d}_properties') or []
if not pls:
continue
for prop in self.spec.get_properties(*pls):
if d == 'number_select' and (prop.value_range or prop.value_list):
d = 'number' if prop.value_range else 'select'
else:
continue
if d == 'button':
if prop.value_list:
for pv in prop.value_list:
Expand Down Expand Up @@ -292,8 +296,9 @@ async def init_coordinators(self, _):
if self.miot_entity:
return

interval = self.custom_config_integer('interval_seconds') or 30
lst = [
DataCoordinator(self, name='update_miot_status', update_interval=timedelta(seconds=30)),
DataCoordinator(self, name='update_miot_status', update_interval=timedelta(seconds=interval)),
]
for coo in lst:
await coo.async_config_entry_first_refresh()
Expand Down

0 comments on commit 8e71487

Please sign in to comment.