Skip to content

Events

Your device must be added to localtuya to use Events

Localtuya fires an events on homeassisstant that can be used on automation or monitoring your device behaviour from Developer tools -> events (1)

  1. to monitor your device subscribe to any event below and trigger action on the device

With this you can automate devices such as scene remote (1) to trigger an action on homeassistant

  1. e.g. single click, double click or hold.
Event Data
localtuya_device_triggered {"data": {"device_id", "states"} }
localtuya_device_dp_triggered {"data": {"device_id", "dp", "value"} }
localtuya_states_update {"data": {"device_id", "old_states", "new_states"} }

Exaples

trigger:
  - platform: event
    event_type: localtuya_device_triggered
condition: []
action:
  - service: persistent_notification.create
    data:
      message: "{{ trigger.event.data }}"
trigger:
  - platform: event
    event_type: localtuya_device_dp_triggered
condition: []
action:
  - service: persistent_notification.create
    data:
      message: "{{ trigger.event.data }}"
Automation for scene remote trigger if 1st button single clicked
trigger:
  - platform: event
    event_type: localtuya_device_dp_triggered
    event_data:
      device_id: bfa2f86e3068440a449dhd
      dp: "1" # quotes are important for dp
      value: single_click 
condition: []
action:
  - service: persistent_notification.create
    data:
      message: "{{ trigger.event.data }}"
trigger:
  - platform: event
    event_type: localtuya_states_update
condition: []
action:
  - service: persistent_notification.create
    data:
      message: "{{ trigger.event.data }}"