Automations using Wyze Sensors

I’m trying to do a simple automation using Wyze contact sensors. I’ll be mounting them on my doors. I set up the automation on the UI to have Alexa announce that a door has been opened or closed. I’m using state as a trigger. I’ve tried setting up the trigger as going from closed to opened but it won’t trigger. I’ve tried every variation I could think of (on, off, close, open, with or without quotation marks,etc.) but it still won’t trigger. The only way it will trigger is if I don’t enter anything in the ‘from’ and ‘to’ fields. The log registers that device as being ‘opened’ or ‘closed’ but using those words don’t work in the from to fields. Having trigger on any state change only is not very useful to me. Any suggestions?

Binary sensor states are always 'on' and 'off' no matter how they are displayed in the dashboard. Note the quotes. These are required.

Thanks, I already tried that but it still fails to trigger. This is the yaml code I’m using for my test…

alias: State trigger test
description: Test
trigger:

  • platform: state
    entity_id:
    • binary_sensor.wyzesense_77cadcf2
      from: “on”
      to: “off”
      condition: []
      action:
  • service: notify.alexa_media_kitchen_echo_show
    data:
    message: Triggered
    data:
    type: tts
    mode: single

I’ve tried reading everything I could find and watched every YouTube video I could related to this topic and I still can’t figure out why it won’t trigger.

Can you please format your post correctly?

Otherwise it is difficult to see what is going on.

You can troubleshoot your automations using the trace facility:

Sorry about the formatting problem.

I was finally able to get it to work correctly by removing the quote marks around on and off. I was using the automation “wizard” and it apparently doesn’t like having quote marks in the from and to fields.

Many thanks,

Robert