Hello!
I have an input boolean sensor that I want to change status to “on” for 10seconds (after 10sec, back to “off”) when my template sensor time last update changes. State on this sensor is time and can’t use “to” and “from” for this.
How the heck do I do that? Can someone please help me?
Turning the input_boolean on when a sensor changes is easy. The turning off part is not as obvious because it depends on exactly how you want that to work. Do you just want the input_boolean to turn be turned off 10 seconds after it is turned on, no matter how it is turned on? Or do you just want it to be turned off 10 seconds after it is turned on due to the sensor changing? And what if the sensor changes again during the 10 second period? Do you want the 10 second period to continue, or do you want it to restart?
Depending on how you answer those questions I can provide you an example. Also, what is the entity_id of the sensor and the input_boolean?
Oh thank you.
I would like it to turn off after 10seconds after it turns on. Whenever it turns on. This is for a doorbell. When I press the doorbell button, timestamp of my sensor change. And when that happens i want the input boolean to switch to on. Then after 10sec it should turn of and be ready for the next press of the doorbell button.
I’m i understandably?
Ok, that’s pretty easy. But you didn’t specify the enity_id’s of the input boolean and sensor, so I’ll just make up something that you can replace with the actual entity_id’s.
This will use two automations. One that turns on the input boolean when the sensor changes state. The other turns the input boolean off 10 seconds after it turns on.
- trigger:
platform: state
entity_id: sensor.doorbell
action:
service: input_boolean.turn_on
entity_id: input_boolean.doorbell
- trigger:
platform: state
entity_id: input_boolean.doorbell
to: 'on'
for:
seconds: 10
action:
service: input_boolean.turn_off
entity_id: input_boolean.doorbell
Thank you
This worked like a charm. Wasnt so hard as I thought. I made it harder than it was in my head. Did not know there was an input_boolean.turn_on/off for that. Now I now