Automation (Door Sensor trigger and notifiy) doesnt work

Hi ,

I’ve the following automation,

- id: '1587079209120'
  alias: Notify me if the window is opened
  trigger:
  - entity_id: binary_sensor.0x00158d0004607b11_contact
    from: closed
    platform: state
    to: open
  action:
  - data:
      message: "SK1 raam open"
    service: notify.clicksend

and my clicksend in configuration.yaml:

notify:
  - platform: clicksend
    name: ClickSend
    username: yyyyyyyyy
    api_key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    recipient: +123456789
    

When i trigger the sensor to go from “closed” to “open” nothing happens in regards of a notification being send.
I see the sensor state change in the overview panel, as well on the logbook.
When i go to the entity “automation.notify_me_if_the_window is opened
and execute it from the panel i received the ecpected SMS message, also callingteh service notify.clicksend from the developers tools works fine.

All help is appriciated.
Kind regards,

Erwin

Binary sensor states are always off and on. They can be displayed differently in the Lovelace frontend by using device classes (e.g. ‘door’), but behind the scenes it’s always off and on. To check this have a look at your sensor state in the developer tools states menu.

So your trigger should be:

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

Thank you very mauch for your quick response.
I completly missed that.
now it works
:+1:

(only forgot the ’ ’ at first , so it failed, but that was an easy fix )
kr,
Erwin