testing a silly script like below. Searched the community how this can be written intelligently… Somehow all the answers are either in Nodered (which I don’t use) or not simple enough to replace with. How should I rewrite this, so it iterates 0.5 each delay?
I know have a separate automation to set the volume according to an input_number. I could probably use that also, next to a for loop setting that input number. If it can’t be done in 1 move of course…
thanks!
considering I only need to worry about the volume setting (have another automation applying the volume) I would have hoped to do something like:
Is this what you are looking for?
Even if it is I am not sure if it is any better than anything else suggested here. It’s just something I was playing with.
but I can’t get the automations to turn on. Could that be because the time trigger (still using the time, not time_pattern on 84.3) can’t use a template?
o that’s much more complex, will have to see if that would of use here too! very nice though, i havent used a loop like that in my setup yet. looks very nifty.
my first attempt didn’t fare well, some silly errors (not yaml but conceptual) and the unfortunate impossibility not to be able to template the time trigger, which is a real let down…
as you can see I’ve built-in a few conditional safeguards, and an intermediary volume sensor to make the automation more readable.
Increase works now, have to test my sleep scripts, but won’t do so till tonight…
Create an automation that sets the timer’s duration whenever input_number.radio_timer_delay changes.
Modify your volume increase/decrease scripts to trigger on an event. The event is when the timer finishes (timer.finished). The automations will need to restart the timer.
Modify your other automations that control when the volume should start increasing/decreasing (i.e. something needs to start the timer’s countdown using service timer.start).
I thought you might say that, so that’s why I didn’t bother posting full code.
The ‘complication’ is the addition of a timer and simple automation. You can revise the solution so that the timer is instructed to increment (or decrement) the volume after completing its cycle and then restart itself to run another cycle until it reaches a given number of repetitions or duration (or when it is halted). It’s basically the time_pattern design but with the ability to dynamically adjust the number of repetitions (using an input_number).
O please feel welcomed to do so, I have some rather nifty templates and constructs in my rather extended setup…
Its just I like to do things as simple as possible. If possible. Apparently what I want isn’t possible in a simple way at the moment, so I now skip it, using a hardcoded time_pattern.
If your setup would provide a templated one based on the input_number, I’d switch it in a split second.
that doesn’t sound to frightening Ill see what I can come up with, after re-reading what you’ve said .