#Automation to turn lights off when I stop receiving webhooks

1 messages · Page 1 of 1 (latest)

distant swan
#

So I have my cameras sending home assistant webhooks on motion events. I want these to turn on ambient lights when you enter a room under certain conditions. I can't find anywhere how to keep these lights on while someone I am still receiving these webhooks, essentially while someone is in the room. Right now I've tried making a repeat until whith a wait for in it and a webhook inside of that, but it is not blocked by the webhook in any way so it runs indefinitely. Any help is appreciated, thanks.

indigo sonnet
#

you could restart a timer each time a webhook triggers and turn off the light with a separate automation that triggers on the timer reaching 0

#

you can create the timer as a helper iirc

distant swan
#

so that essentially puts it in the global scope, right?

#

in programming terms

#

because yeah i was wondering if i'd have to go out of the scope of the automation

indigo sonnet
#

yes, i don't really know the programming side of ha well enough to know if it can somehow be localized to a set of automations. but i have done something similar, just with a pir sensor

#

one benefit is that the webhook-triggered automation just terminates quickly. it doesn't have to hang around waiting.

distant swan
#

what does restore do on a timer?

indigo sonnet
#

i don't know. i just start the timer with 10 minutes each time the pir sensor fires

#

rather than trust the pir sensors "unoccupied" message

distant swan
#

i see it restores the timer to its previous state on boot

#

thanks

indigo sonnet
#

with my solution you don't need to move more than once every 10 minutes

#

instead of the lights going out if you sit still for a minute

distant swan
#

How do you actually get the timer finish to trigger an automation?

#

its very confusing

indigo sonnet
distant swan
#

i guess i dont have that event?

#

is that possible?

#

or do i just write it in

indigo sonnet
#

the event data i just wrote in

#

the event type was there somewhere

#

add trigger -> Other triggers -> manual event
type in timer.finished

#

i think something has changed since i set this up? or did i copypaste from the web?

distant swan
#

that does work though thanks

#

yeah i just had to type in the event type but the data existed