Hi,
I need help with the automation. I have a sonoff rf bridge running Tasmota, and a Sonoff PIRII.
Automation 1: Motion detected, turn on lights is working. Automation to turn the light off is not triggering. Since the PIRII does not send a off command, using a template sensor will be the way to go in Home Assistant?
Config: Sensor
- platform: mqtt
name: “sonoff_433bridge”
state_topic: “rfbridge/tele/RESULT”
value_template: ‘{{ value_json.RfReceived.Data }}’
so you sensor only sends the motion detected message, and never motion detected end?
Your template will not work as it’ll wait for the condition to no longer be true, add a delay, then turn off.
You might be better off creating a binary sensor with an automation that turns it on upon motion message received, and turns it off 1 min later provided it’s been more than [say] 59sec since you received the on message.
this works fine. trying to recreate another with the exact same format would work, and would switch off at the exact moment motion was detected. Which is quite the opposite of what I was trying to do…
This relies on the condition going to false for a period of time (so if your sensor returns on and off states, it waits for the state to be off for the time defined in delay_on
if your sensor never goes to off, then as above I would create an input_boolean to track motion.
Your automation cannot update the input_boolean based on the sensor’s state since the state will never go to off before going to on, you need to instead watch the events. So a trigger like the below could be used to turn the input_boolean on
thanks! I knew I had read it , but couldn’t find it anymore…
so in my case, if the motion sensor is not ‘on’ for 1 minute, it triggers the automation. Which is what I need. As long as there is motion, the lights must stay on.
If everyone’s gone or a sleep, no motion is detected, the delay starts to count and after 1 minute, the lights can turn_off. When motion is detected within that delay_off timeframe, it restarts.
Been busy for a while and only came back to this issue recently.
I ended up using NodeRed for my automation. I subscribed to the MQTT topic that the Rf bridge transmits the codes to, once the PIR signal is received it checks if the light is on/off, turns on the light if needed, and starts a stop timer to turn it back off (re-triggering the motion sensor, resets the stop timer)
I know hassio automations can do the same, but I like the visual flow layout of NodeRed more… (And you can see the automation running from node to node)