Hello, I have been looking for a long time to switch on the light via a switch or a motion detector and switch off the light again when no movement is detected
for this I created a timer in the configuration.yaml
then I created 2 automations to start the timer 1 time
Unfortunately because you have pasted images of text rather than correctly formatted text it is difficult for others to use your code. Text can be copied and pasted. Images can’t.
Also your conditions can be considerably simplified. I’m not going to type all that out to show you how. If it was text I could.
In fact the conditions are not doing anything as your triggers are already OR logic. Your conditions, A or (B (or C)) is equivalent to A or B or C. Which is what your triggers are already doing.
Also, also, this can be done a lot simpler without a timer and only one automation. See the example in the v0.113 release notes.
Please have a read of point 11 in the link BurningStone posted above, then edit your post to format the pasted code correctly. Indentation is very important in YAML.
Sure, it can be easier if someone likes to write an idea, but I haven’t found anyone else for me …
That works first … And I wanted to post that because maybe someone is facing the same problem …
Hey Tom, thank you very much, it works wonderfully … Thank you very much … Even if I don’t know why yet … I have problems with many examples here in the forum … Simply copying and adapting unfortunately does not work … That is certainly due to the Formatting…
I use in Home Assistant … Visual Studio code …
Simply copy and paste doesn’t work … of course you have to adapt the entity etc. … but the formatting doesn’t work … you might have a tip
I think you should go with Tom’s second automation
Don’t feel too bad about your efforts but this is a subject we see a LOT of.
If you had searched the forum you’d have come up with many examples and we could probably do 10 or 15 variations on each one.
You may even place all the logic in a binary sensor and then just flip-flop the lights from that - which gives you a VERY short automation.
You joined Dec 29 2020 so I’m impressed with what you have accomplished in one month.
Keep trying and if there’s anything you don’t understand about Tom’s automation come back and we’ll explain
I have the same problem, VSC tries to guess your indentation, where most code snippets are already correctly indented.
After pasting hit ctrl-z and it undoes the guess - this works about 95% of the time
You may use template sensor with delay_off option on top of your actual motion sensor. This is how i made it, simple automation turns off the light due this sensor’s off event, while it turns off only after 5 mins of motion sensor silence: