Door sensor automation not working but no errors

I am attempting to setup an Aqara door sensor automation that sends a tts alert to a Sonos speaker when the door opens. The hub is a Sonoff zigbee bridge and I am running HassOS on Rpi4 ssd.

The maddening thing is that the automation fails but there are no errors in the log. Nothing to go by. The ZbBridge works. The sensor works. The Sonos speaker is recognized. I can run the service successfully in Developer Tools. It will even work when I click the Run Actions button in automations. But opening the sensor does not trigger the automation. Here is my tts config:

tts:
  - platform: google_translate
    cache: true
    cache_dir: /tts
    time_memory: 300
    base_url: http://192.168.2.10:8123
    service_name: google_translate_say

This is my automation:

- id: '1616192952760'
  alias: Back Door Alert
  description: send alert if back door is open
  trigger:
  - platform: state
    entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off
    for: '10'
    attribute: icon
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: tts.google_translate_say
    data:
      entity_id: media_player.sonos_speaker
      message: the back door is open. Better check it out.  thanks
  mode: single

I have been working on this for 2 days and have tried every combination of tts config and am out of ideas.

Iā€™m not sure why you put it in but you need to remove the ā€œattribute: iconā€ line.

And I think you need to specify ā€œminutes:ā€

And you donā€™t need the ā€œfrom:ā€ for a binary sensor:

- id: '1616192952760'
  alias: Back Door Alert
  description: send alert if back door is open
  trigger:
  - platform: state
    entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off
    for: 
      minutes: 10
    to: 'on'
  condition: []
  action:
  - service: tts.google_translate_say
    data:
      entity_id: media_player.sonos_speaker
      message: the back door is open. Better check it out.  thanks
  mode: single
1 Like

Thanks finity. Good points. I fixed these but no change. Still no errors in the log.

The code structure and logic seems fine.

Are you sure that the entity_ids are correct?

this looks suspect:

binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off

does it really have ā€œlumi_ā€ twice?

I noticed that also as well as the ā€˜on_offā€™ part at the end but it does work. However, after making the changes you suggested I did a reboot and tried it with no luck. Then I went away and just came back and now it is working! So donā€™t know what change fixed it but thank you very much. Iā€™ve been pulling my hair out with this one.

1 Like