I am trying to add an automation where the shutter should open once the rain is stopping. I managed a simple automation which works once rain rate is below a certain value. However, as rain is usually coming in waves, I wanted to add a delay of 30min before opening the shutters so they do not go up and down multiple times.
The following automation however is not working at all.
Anyone in here able to spot the error in the automation or has an idea how to add such a delay?
You tagged your post with “Share your Projects!” which is reserved for sharing working projects you have created. In this situation the automation you posted doesn’t work and you’re asking for help to fix it. Change the post’s category to “Configuration”.
The value for before_offset is usually expressed in the following format HH:MM:SS like 01:15:00 but you have supplied it with a single integer value 3000. What is the amount of offset that you want?
In addition, I don’t believe you can combine before: sunset and after: sunrise in the same Sun Condition.
Thank you all for your inputs!
Not sure how to change from “share your projects” to “configurations”, but I will figure it out and change it - thank you for the hint.
Regarding the several comments about the “before_offset” I doubt that this is the problem, as I am using the same condition in my automation to close the shutters when precipitation rate is >1mm. In the following you can see this automation, which is working fine. Note that the sunrise / sunset condition is set because an other automation is closing the shutters during night (after sunset with an offset of 50min (=3000s)) and opens the shutters after sunrise (with no offset). The rain automations shall work during daylight only, as during night the shutters are closed anyway and should not open if rain stops:
→ shutters react to rain only during daylight and close the shutters if rain is above 1mm. This automation works fine.
→ Only difference to the previously posted automation to open the shutters when rain is below 1mm is the delay of 30min.
→ main reason having this delay of 30min is to avoid opening / closing the shutters multiple times if rain is toggling between higher / less than 1mm of precipitation rate. However, not sure if the delay will even solve this. Ideally the open shutter when <1mm automation shall be reset if during the delay of 30min the rain rate raises again over 1mm.
Meanwhile I could solve the issue! The only thing I change to make it work was to edit the code in YAML so that the code “for: minutes: 30” is at the end of the trigger code!!
This is the corrected code:
Looks like a bug in the visual editor… @123Tara: you were indicating the correct solution in your example already but I did not see it! So thank you for that!
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.
It’s not a bug. The order of a trigger’s options doesn’t matter. The for option can even be placed before the platform option and it will still work correctly. The YAML code representing the trigger is converted into JSON and as long as it contains all of the desired data, regardless of sort order, it will function properly.
if the position of the “for” option does not matter, then it is still unclear why the automation did not work before…that was the only thing I have changed (plus removed attribute: ’ ').
Something you did during your testing procedure led to a false-negative result. Because, as explained, option order doesn’t influence how the trigger is handled. I have seen examples where options were sorted alphabetically and the trigger worked properly.
I verified your statement and set the “for” option back to the previous position. It got triggered this morning - whatever was wrong before, the automation works and therefore I am happy