Skip to content

Commit

Permalink
Fix device trigger event
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou authored Dec 18, 2023
1 parent 76f8881 commit 77fc4a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/localtuya/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def __init__(
self._config_entry = config_entry
self._device_config: dict = config_entry.data[CONF_DEVICES][dev_id].copy()
self._interface = None
self._connect_max_tries = 2
self._connect_max_tries = 3
# For SubDevices
self._node_id: str = self._device_config.get(CONF_NODE_ID)
self._fake_gateway = fake_gateway
Expand Down Expand Up @@ -460,7 +460,7 @@ def fire_event(event, data: dict):
# Device triggered event.
if old_status and new_status is not None:
event = device_triggered
data = {"states": new_status}
data = {"states": old_status.update(new_status)}
fire_event(event, data)

if self._interface is not None:
Expand Down Expand Up @@ -494,7 +494,7 @@ def disconnected(self):
self.debug(f"Disconnected - waiting for discovery broadcast", force=True)
# Try to quickly reconnect.
self._is_closing = False
async_call_later(self._hass, 1, self.async_connect)
self._config_entry.async_create_task(self._hass, self.async_connect())


class LocalTuyaEntity(RestoreEntity, pytuya.ContextualLogger):
Expand Down

0 comments on commit 77fc4a9

Please # to comment.