Skip to content

Commit

Permalink
Remove type from events
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Nov 9, 2023
1 parent 02c5a0e commit a3d828b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions custom_components/localtuya/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,7 @@ def _handle_event(self, old_status, new_status, deviceID=None):

def fire_event(event, data: dict):
event_data = {
CONF_DEVICE_ID: deviceID or self._device_config[CONF_DEVICE_ID],
CONF_TYPE: event,
CONF_DEVICE_ID: deviceID or self._device_config[CONF_DEVICE_ID]
}
event_data.update(data)
# Send an event with status, The default length of event without data is 2.
Expand All @@ -462,15 +461,15 @@ def fire_event(event, data: dict):
# Device triggered event.
if old_status and new_status is not None:
event = device_triggered
data = {CONF_TYPE: event, "states": new_status}
data = {"states": new_status}
fire_event(event, data)

if self._interface is not None:
if len(self._interface.dispatched_dps) == 1:
event = device_dp_triggered
dp_trigger = list(self._interface.dispatched_dps)[0]
dp_value = self._interface.dispatched_dps.get(dp_trigger)
data = {CONF_TYPE: event, "dp": dp_trigger, "value": dp_value}
data = {"dp": dp_trigger, "value": dp_value}
fire_event(event, data)

@callback
Expand Down

0 comments on commit a3d828b

Please sign in to comment.