I have a simple automation for opening/closing my covers at sunset/sunrise. But it should not look like an automation, the covers should open/close time-displaced +/- 30 minutes and also the order should be random.
How can I do that? Is there a module principle for coding automations?
Hi, sorry about that, I edited my post, hope thats correct now.
Here is an example:
I want my covers to open and close automatically(that is working) fixed to sunset/sunrise but I don’t want it to look like being opened/closed automatically. Let’s call it burglary protection. I want to simulate that a human is opening/closing the covers.
Therefore the covers should open/close at sunset/sunrise +/- 15 minutes and not all at once.
On Monday bedroom cover goes down at 6:00 pm, bathroom at 6:02 pm, living room at 6:04, …
Next day at 6:15,…
Maybe there is a better solution but I hope my plan is now clear.
use the random sensor component, it will create an integer that changes every time you access the integer:
sensor:
- platform: random
minimum: 0
# This number is exactly 1 hour in seconds.
maximum: 3600
Change your offsets to be 30 minutes before what you currently have.
Make sure you treat your action section as a list of services instead of a single service (by adding - before each service). And add the following delay:
- delay:
seconds: "{{ sensor.random }}"
In the end, it will add a random delay, ± 30 minutes from your current time. We just changed it to be -30 minutes + up to 60 minutes.
so in the end, your automation will look like this: