Hello, I wanted to know how I can configure a binary sensor (let’s call it 1) based on two binary sensors (let’s call it 2 and 3): I want the binary sensor 1 to go “On” when the binary sensor 2 goes from “On” to " Off “, and at the same time that binary sensor 3 has not been put” On "within a 5 minute interval.
I have come to get this code, but I can not set the delay so that it works.
Hi Tom, thanks for replying. The code you have given me is not valid. From what I see the syntax must be something like what you passed me. When validating it gives me the following error:
Invalid config for [binary_sensor.template]: invalid template (TemplateSyntaxError: expected token ',', got 'x00158d00052bce8b_occupancy') for dictionary value @ data['sensors']['sensordef']['value_template']. Got "{{ is_state('binary_sensor.0x00158d00057b3ebf_occupancy', 'on') and is_state('binary_sensor.0x00158d00052bce8b_occupancy', 'off')\n and ( now()|as_timestamp - as_timestamp(states.binary_sensor.0x00158d00052bce8b_occupancy.last_changed) ) > 300 }}". (See ?, line ?).```
Hello, I want to know how to make a condition be checked when an automation is triggered. So if my binary sensor 1 goes “off”, I notify telegram on the condition that sensor 2 does not change in the next 30 seconds. I have tried with the for and the telegram notification notifies me when the sensor goes from “on” to “off” state. What I want is that sensor 1 goes “off” wait 30 seconds to verify that sensor two has not changed in 30 seconds.