Automation Trigger not firing

Hello,
I’m having hard time getting trigger to work. It used to work until power outage and I’m troubleshooting this right now.

Automation is based on trigger from Xiaomi push button, which looks like its registered properly. Automation when ran manually works as well. So basically HA sees event (logs), but somehow it’s not triggering automation.

Here is automation file:

alias: Short press
trigger:
  - platform: event
    event_type: xiaomi_aqara.click
    event_data:
      entity_id: binary_sensor.switch_158d000252e05c
      click_type: single
action:
    - service: switch.toggle
      data:
        entity_id: switch.aeotec_dsc18103_micro_smart_switch_2nd_edition_switch

And here is log file (shows that both single, double and long press are ok

2019-01-16 00:52:24 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity  
Switch_158d000252e05c: on>: {'status': 'click'}
2019-01-16 00:52:31 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'short_id': 64512, 'sid': 
'158d000252e05c', 'data': '{"status":"double_click"}', 'cmd': 'report', 'model': 'switch'} . 
2019-01-16 00:52:31 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity 
Switch_158d000252e05c: on>: {'status': 'double_click'}

Does anyone have idea what might be going on ?
Thanks :slight_smile:

sure you didn’t change code? text below ‘action’ is indented too far. The ‘-’ should be inline with the ‘t’ in ‘action’

Thanks @sparkydave,
I can trigger action thru automation service and that works ok, but just to be safe I’ve removed additional indentation. I’m out of ideas since HA missing debug tools. I’ll try to create dummy trigger and go with that.

Also even if I trigger even manually xiaomi_aqara.click thru web with event data

{"entity_id":"binary_sensor.switch_158d000252e05c","click_type":"single"}

Nothing happens l

I believe you can change the error log setting to debug mode and get more info… but I’ve never tried

debug mode is in here

Perhaps you can try to change the action to this:

  action:
    service: switch.toggle
    entity_id: switch.aeotec_dsc18103_micro_smart_switch_2nd_edition_switch

Not sure but that’s what’s worth a try.

Does it work when you trigger the automation manually?

that should work

@phoxy84,
Thanks for suggestion. Yes automation works ok when triggered manually so looks like the action piece is working ok. It almost looks like HA sees the event coming from Xiaomi gateway but is not processing it and sending to actions.

But thank you for suggestion I’ll try to pass ID directly not as data element as per your suggestion

Tonight I’ll try to create trigger with simple button and see if that is going to change and then also try with another switch. I’m starting to think that power loss has caused some data corruption .

Ok quick update: Unfortunately changing automation doesn’t work. I’ve started suspecting that maybe whole trigger bus is not working so I’ve created quick binnary switch and tied same action there. Everything works.

I think this might be related specifically to the Xiaomi component, but I’m out of ideas how to troubleshoot it


Further update:
I think 0.84 has bug with triggers somehow. I’m separating automations in separate file. I got it to work, however this was pure luck. I’ve re-saved automation into different file name and it started working.
This looks like some strange caching issue

Have you tried searching home-assistant.log for the event so you can see exactly what the data looks like? E.g.:

grep '<Event xiaomi_aqara.click' home-assistant.log