Hello,
I am rather new with home automation.
I would like to trigger events based on door sensors, and since I installed them in another house I wanted to use random sensors to test automation actions.
Unfortunately, the following does not work : configuration.yaml
binary_sensor:
- platform: random
name: random_sensor
...
automation: !include automations.yaml
I added the sensor in a group and I can see it toggle on web interface every 30s as expected
automations.yaml
- alias: 'Intrusion'
trigger:
- platform: state
entity_id: binary_sensor.random_senor
from: 'off'
to: 'on'
action:
service: notify.sms_me
data:
message: Intrusion
The above configuration does not trigger SMS to me, however, when I manually trigger “automation.trigger”, I do receive it.
So my trigger does not work and I don’t understand why.
I did not find examples that show me what I am doing wrong.
My understanding is that random binary sensor only decides its state when called by something. Your automaton only reacts if the state changes, which it never will because it’s never called. You would need to trigger the automation say once every ten minutes and use the binary sensor as a condition.
This way when the automation is triggered it will test the condition by calling the random sensor, which will return true or false at random, which will decide whether to fire the action.
Hello all,
thanks for the answers, it helps although the problem was as simple as it can be, I had a typo hidden in my configuration.
I let you find it …
Indeed the trigger works with the binary sensor, and I get SMS every minute for this test.