Skip to content

Commit

Permalink
Abort localkey update if's the same. #101
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Jan 8, 2024
1 parent c5f8bae commit 42b6569
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/localtuya/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,10 @@ async def update_local_key(self):
await cloud_api.async_get_devices_list()
cloud_devs = cloud_api.device_list
if dev_id in cloud_devs:
self._local_key = cloud_devs[dev_id].get(CONF_LOCAL_KEY)
cloud_localkey = cloud_devs[dev_id].get(CONF_LOCAL_KEY)
if not cloud_localkey or self._local_key == cloud_localkey:
return
self._local_key = cloud_localkey
new_data = self._config_entry.data.copy()
new_data[CONF_DEVICES][dev_id][CONF_LOCAL_KEY] = self._local_key
new_data[ATTR_UPDATED_AT] = str(int(time.time() * 1000))
Expand Down

0 comments on commit 42b6569

Please sign in to comment.