Automation Deconz event help

I have installed an Xiaomi Mijia switch with deconz.
I am trying to make it work with the below automation but it doesn’t work. Can anyone help a little please?

- id: Button Bath Heat 
  alias: Button Bath Heat
  trigger:
    platform: event
    event_type: deconz.event
    event_data:
      id: smart_switch
      event: '1002'
  action:
    - service: switch.toggle
      entity_id: switch.sonoff_10001bb126

Try using deconz_event instead of deconz.event as the event_type.
Also the quotes around the event are not necessary.

1 Like

I have tried both but didn’t work. I am not at home right now to test it again. I was hoping that something was wrong with my code. I think I did find some spacing errors so I will try it later

You can go to the EVENTS tab on the Developer Tools page and use the “Listen to events” feature to watch for and print out the event of interest. This will let you know 1) if you’re even receiving that type of event (e.g., if you’ve spelled it correctly), and if so, 2) all the event data. Should help you determine if you’ve specified the correct info in your event trigger.

This is what I get. I did this in the morning.
I tried 1000 also but again nothing happens
Is it normal to provide 2 different event type numbers?
any ideas?

Event 1 fired 8:30 PM:
{
    "event_type": "deconz_event",
    "data": {
        "id": "smart_switch",
        "unique_id": "00:15:8d:00:03:63:80:ce",
        "event": 1002
    },
    "origin": "LOCAL",
    "time_fired": "2019-11-21T18:30:33.249901+00:00",
    "context": {
        "id": "1006a98b22ee433fa073fd8ce662ae8f",
        "parent_id": null,
        "user_id": null
    }
}
Event 0 fired 8:30 PM:
{
    "event_type": "deconz_event",
    "data": {
        "id": "smart_switch",
        "unique_id": "00:15:8d:00:03:63:80:ce",
        "event": 1000
    },
    "origin": "LOCAL",
    "time_fired": "2019-11-21T18:30:33.042133+00:00",
    "context": {
        "id": "08199a8567824ca6ae093cfca313d6f5",
        "parent_id": null,
        "user_id": null
    }

So I know nothing about deconz. But that shows two separate events. Did you do two things, or did both of those events come in response to doing one thing?

Anyway, the real issue might be that the event data named event is a number, not a string. You specified a string in your automation. That’s probably why it’s not triggering. Remove the quotes and try again. And, of course, as I believe has already been discussed, the event_type should be deconz_event instead of deconz.event.

I really don’t know what is wrong
I did one thing - just pushed the button

my code is the following
I tried with 1000 & 1002

- id: Button Bath Heat 
  alias: Button Bath Heat
  trigger:
  platform: event
  event_type: deconz_event    
  event_data:
      id: smart_switch
      event: 1000
  action:
    - service: switch.toggle
      entity_id: switch.sonoff_10001bb126

Well the indentation is incorrect. It should be:

- id: Button Bath Heat 
  alias: Button Bath Heat
  trigger:
    platform: event
    event_type: deconz_event    
    event_data:
      id: smart_switch
      event: 1000
  action:
    - service: switch.toggle
      entity_id: switch.sonoff_10001bb126

yes that’s it. it worked. Thanks a lot!

The 2 events are probable the push and the release of the button. I don’t use your switch, but with the Ikea switch I get an event when I push it, and when I release it I get another event.