I want to execute a rule just once a day, if triggered. Therfore i need the last execution time of the rule and check if it was on this day. I now that i can create a new datetime item which holds the last execution time, but i do not want so much “help”-items for those “simple” tasks.
The best would be to have a separate entry in the ui “But only if…” that checks the time of the rule and then outputs true or false.
The background is that I want to close my shutters automatically only once a day as sun protection.
Therefore my questions:
How do i get the last execution time from a specific rule?
How do i execute a rule just once a day?
You might consider a simpler approach. Make a dummy Switch type Item, Have a cron rule turn it OFF at midnight. Have your shutters rule check for this switch OFF before doing whatever. If it does run, then turn dummy switch ON as well.
Who cares what time it is.
You do know the Astro binding offers a selection of daily events linked to local sunrise/sunset times?
thanks for your answer.
i would like to avoid additional items and rules to have everything simpler and only in one rule.
Do rules have any persistence data so I can see when which rule was executed?
The astro binding doesn´t help me much at this point. But i use it in other rules.
You don’t unless you save that information somewhere. The best place is a DateTime Item.
However, you can know the last change to an Item. Maybe you can test when the last change to one of the shutter Items occurred in the condition of the rule for your timestamp.
Lots of ways but in general you trigger it based on even that occurs once a day, or you have a condition that uses something to determine if it’s already run today. That something is going to be an Item, variable, or the like.
No. You’re going to have to use an Item or, if using Blockly or JavaScript a persistent variable (i.e. a variable that remains between runs of the rule). You might be able to use the persisted values of an Item you already have.
A Switch Item is as simple as it gets.
In an event-driven system, several small rules are often more effective and efficient than one do-everything rule. Don’t avoid this just because it appears “complex”.