Tuyal event as trigger in automation help

Hi,

i have tuya sensor in my mailbox which is linked to a tuya WiFi doorbell Gateway. Once the mailbox is opened an event is fired. I will use this trigger now to send a notification but struggling with the code.

I’ve captured the event via the event recorder but i am not able to add the information correctly as trigger in an automation

Here is the event:

event_type: state_changed
data:
  entity_id: event.briefkasten_turklingel
  old_state:
    entity_id: event.briefkasten_turklingel
    state: "2025-10-08T15:13:28.006+00:00"
    attributes:
      event_types:
        - null
        - ring
      event_type: ring
      message: Posteinwurf
      device_class: doorbell
      friendly_name: Briefkasten Türklingel
    last_changed: "2025-10-08T15:13:28.008017+00:00"
    last_reported: "2025-10-08T15:13:28.008017+00:00"
    last_updated: "2025-10-08T15:13:28.008017+00:00"
    context:
      id: 01K7264TE8R90VXPYNGZAM8643
      parent_id: null
      user_id: null

And that’s my try try to add it as trigger

trigger: event
event_type: state_changed
event_data:
  entity_id: event.briefkasten_turklingel
  attributes:
    event_type: ring

What’s wrong in my code?

That’s probably not the original event… and that’s not really the right trigger to use.

What you have shared is a state_changed event of an event entity. The point of event entities is to reduce the need to use Event triggers. The state_changed event is what State triggers are listening for, so just use one of those with a Template Condition to check the attribute data.

triggers:
  - trigger: state
    entity_id: event.briefkasten_turklingel
    to: 
conditions:
  - condition: template
    value_template: "{{ trigger.to_state.attributes.event_type == 'ring'}}"

Thanks for your help. I changed the trigger and is working now.