Reed Switch automation issues [Solved]

Hi,

I have a reed switch (NC) connected to a NodeMCU panel and it correctly shows state (Closed or Open) as I put the magnet closer or move it apart. Also tried creating automation around this but it does not seem to be working:

- id: '1623982254831'
  alias: Alarm_test
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.reed_test
    from: Closed
    to: Open
  condition: []
  action:
  - service: notify.persistent_notification
    data:
      message: Window Opened
  mode: single

Any clue what I am doing wrong in the code above?
Thanks,

Binary sensor states are allways on or off though what is displayed in Lovelace can change depending on the device class (e.g. open/closed, problem/ok), so change your trigger to this:

  trigger:
  - platform: state
    entity_id: binary_sensor.reed_test
    from: 'off'
    to: 'on'
1 Like

Spot on! Worked like a charm :sunglasses:

Thanks @tom_l

1 Like