Hello there,
I am pretty new to this forum and also relatively new to HomeAssistant.
Right now I am running a test system to try things out. I only have a few Shellys connected to HA.
As a practical application I want to make a home-presense simulation.
So shut on an of the light and open and close some window covers (raffstore).
Right now I have a, propably trivial, issue to get it all running.
I have created a script that that checks for the sunrise and sunset and does a random switching on the light shelly for example.
The problem is, that the script only runs once. So each day I have to restart the script.
then I have tried to make an automation to trigger the “script”. Somehow, this also doesn’t work.
I have tried several combinations of where to put the condition (after sunset & before sunrise) and also how to trigger the complete presense-simuation (vacation mode = on/off).
My questions:
What is the correct way to do this?
Do I only need one script, or several? (for several entities)
Do I need automations at all?
I know that there are several solutions out there, but I want to build my own solution as I want to learn the (correct!) process.
thank you for your comments.
Objects I have created:
- A helper switch (vacation mode)
- A script (random_raffstore_1) → see below
- A automation (
Script:
alias: random_raffstore_1
sequence:
- repeat:
count: "999999"
sequence:
- device_id: 8fd2857bee9352e8ce8bbe02c774d217
domain: cover
entity_id: c65dcbe8dce926f03e42377621a99e1c
type: open
- delay:
hours: 0
minutes: "{{ range(20, 150)|random|int }}"
seconds: 0
milliseconds: 0
- device_id: 8fd2857bee9352e8ce8bbe02c774d217
domain: cover
entity_id: c65dcbe8dce926f03e42377621a99e1c
type: close
- delay:
hours: 0
minutes: "{{ range(20, 150)|random|int }}"
seconds: 0
milliseconds: 0
mode: restart
Automation:
alias: Call_Raffstore_Script
description: ""
trigger: []
condition:
- condition: sun
before: sunset
after: sunrise
action:
- service: script.random_raffstore_1
data: {}
mode: single