Toggling Silvercrest door sensor

Hi All,

I’m new at home automation, and certainly new at Home Assistant.
I decided give it a try because I ran into limitations with my Tradfri setup. So bought a Rasppi 4 and a cc2531 stick and hit the ground running.
Everything is so much easier then I anticipated that I might have a bit trouble finding the patience to the discover the next steps…the actual automations.

I did a simple test with a Lidl Silvercrest door sensor that my usb stick picked up fine.
I want to use it to lower the thermostat (Tado) if I open the door for fresh air.
To test I did not use the Tado but a simple light so I can see the sensor and automation works.

It does not…I’m sure thats me being impatient but I hope you can give me a legup for my first automation…:slight_smile:

This is the sensor:

And this is my very simple code that does not work. It does work when I trigger it manually so the lights part must be fine.
Trigger:

platform: state
entity_id: binary_sensor.0xbc33acfffe0eaaa7_contact
attribute: contact
from: 'true'
to: 'false'

And Action:

type: turn_off
device_id: bb71a369cd4302ac25b9a49fe6000999
entity_id: light.corien
domain: light

I hope someone can point me in the right direction (apart from rtfm that I certainly will do)

from: 'true'
to: 'false'

Binary sensors only have the state on or off. Though the way that can be displayed in the Lovelace frontend can change, the backend always sees on or off. So change your trigger to:

from: 'on'
to: 'off'

If you want to look at the actual sate of a sensor, look in the menu: developer tools / states.

Hi Tom,

Thank you for your help.
The development states shows indeed on/off, but closed it is off and open it is on.

So I changed the code:

platform: state
entity_id: binary_sensor.0xbc33acfffe0eaaa7_contact
attribute: contact
from: 'off'
to: 'on'

And reloaded automations.
Still no luck.
I hope you can see what I’m doing wrong?

Remove this line:
attribute: contact

You want to trigger on the state of the binary sensor, not the state of its contact attribute.

Thats it, thanks :slight_smile: