Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: remove tev dependency for lan control & fixs #333

Merged
merged 17 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions custom_components/xiaomi_home/miot/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ def randomize_int(value: int, ratio: float) -> int:
"""Randomize an integer value."""
return int(value * (1 - ratio + random.random()*2*ratio))

def randomize_float(value: float, ratio: float) -> float:
"""Randomize a float value."""
return value * (1 - ratio + random.random()*2*ratio)

class MIoTMatcher(MQTTMatcher):
"""MIoT Pub/Sub topic matcher."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_home/miot/miot_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ async def __on_miot_lan_state_change(self, state: bool) -> None:
handler=self.__on_lan_device_state_changed)
for did, info in (
await self._miot_lan.get_dev_list_async()).items():
self.__on_lan_device_state_changed(
await self.__on_lan_device_state_changed(
did=did, state=info, ctx=None)
_LOGGER.info('lan device list, %s', self._device_list_lan)
self._miot_lan.update_devices(devices={
Expand Down
Loading
Loading