Hi, if someone could help me: how to set how many times a task should run? The goal is to activate the morning greeting and turn on the radio, change the home temperature, etc. only once a day during the morning hours on weekdays. The trigger for this event is the motion sensor in the kitchen. Currently, the task runs normally, but whenever motion is detected within the specified time interval, the task is reactivated. What I would like: the command to run only once a day
you can use the last_triggered attribute and see it’s already been run today.
this will return true if it’s been run on the same calendar day.
{{ state_attr('automation.test', 'last_triggered').date() == now().date() }}
Thank you, the “last_triggered attribute” may come in handy, since it is specified in the time interval between 5-6 am when there is movement. I don’t understand the programming language, I use user interface to create routines. how do I set the “last_triggered attribute”? thanks for your help!
I see you wrote down the code snippet in the meantime! Thank you!
when you use the ui to create an automation, choose ‘template’ then put it in the template form:
of course replace the automation name with your automation… not test.
Thank you, have a nice day!