I thought I would give HA automations/scripts a go but really have no idea where I should do this and how to start.
I thought I would start with script but then saw in the GUI there is no conditions but in the documentation there are, this got me wondering if scripts is the right place.
I have provided a picture of a 2 simple flows I would like to migrate over to HA, a pointer on what should be a script and what should be an automation process would help a lot and if I should be looking at YAML to achieve it instead of the GUI.
From a very high level I was looking at the start of each process to be a Automation and the rest scripts (can I do split conditions in the same script?)
Both should be automations. Trigger on the event then use a choose action (based on the light state) to determine which sequence of actions to run. No scripts required.
So Iāll add them to the Automation, do you recommend YAML or try to stay in the GUI?
Not an easy question I know but I would like to align where HA might be heading.
If you feel you might do some more advanced automation using jinja templates sometime in the future it would be good to start getting a grasp of YAML. If you can do Node Red you can do this just as easily. However for the automations above the UI editor would be sufficient.
If you are going to have a go at the YAML version, post here if you need help or have questions. The above automations will be a good introduction.
Thanks Tom,
I had seen the Choose command in the GUI but always thought āDefaultā would run after the other actions so I couldnāt see how this was a if/else until I read the docs a bit harder
Thanks Tom, those ones are completed, it can be weird what you think should be a breeze to set up then turns out to be a little harder than you thought.
Is this possible it a single automation
I have a push button switch that has triggers of ālong pressā and ālong press releaseā. Iām looking at if the switch is longed press keep decreasing the brightness of the lights until released. I thought I would be able to do it in a Until loop but it appears I canāt repeat until a new different trigger and instead only trigger on the existing automation Trigger IDs which doesnāt appear to be any good as if I also add the ālong press releaseā as a trigger, when the automation triggers on the release it runs as a different instance of the automation.
Thinking for this one I might need to set up (1 or 2) automations that turn on and off a script that decreases the lights, does that make sense?
Instead of creating automations to process the deviceās button events, looks through the Blueprints Exchange section and see if thereās an existing blueprint for the device. Some of the better ones support things like long press, hold, etc.
Assuming thereās a blueprint for your device, itāll be pre-configured to handle the deviceās events. All you need to do is indicate what you want each button event to do.
Even if you donāt want to use a blueprint, and prefer to create your own automation from scratch, you can examine how the blueprint is constructed and get ideas for your automation.
Hi 123, to answer your question there are all ready pre-configured commands for this switch ālong pressā and āreleaseā which I am using. The issue is that the release command isnāt cancelling the until loop I am in and hence the light turns off. The automation is in single mode so unsure why this isnāt happening.
I see my YAML was badly formatted yesterday so Iāve reformatted it.
It wonāt because mode: single means while the automationās action is executing (i.e. itās busy doing the repeat) anything attempting to trigger it again (like when itās second trigger detects remote_button_long_release) will be rejected. Your repeat is waiting to hear from something that is actively blocked from being heard. Check the Log and youāll probably see a message about āalready runningā each time you released the button.
Try changing mode to restart. When you long_press, the repeat will begin iterating and the moment you release the button (triggering the second trigger: id = ā2ā), the entire action session is terminated and a new session begins. This new session wonāt iterate repeat even once because untilās condition will be satisfied. In other words, it will cease decreasing the lightās brightness.
Restart has worked, I miss understood the term single in this case. I thought single meant that it would not run any more instances of this automation and only execute against the current one (eg you only have one instance running).
Is did confuse me, with the description as I expected the triggers to be able to pass a message at any time to a running automation in a loop but see this issue the case.
I see how you interpreted it and you were half right, thereās only one instance running. However, while itās running, the automationās trigger section is, effectively, disabled and ignores attempts to trigger again. āIām busy servicing working on the previous request, try again later!ā