Before the else condition and action I’d like for the ac power to stay enabled until either device1’s ac in power reaches 350 and above or battery level for device1 reaches 79 then disable device2 ac. Somehow it would have to wait until this criteria is met.
i have 2 ecoflow batteries. i want device 2 to activate its ac power out when device 1 drops either below 50% or 350w input ac power.
once device 2’s ac power out is on, it must begin charging until either device 1 is 79% charged or input ac power exceeds 350w in which case, turn off ac power out on device 2.
Could you please format your code using the </> button in the editor?
The code is currently difficult to read and understand, and most people may not make the effort to decipher it in its current format.
Properly formatting the code will greatly improve its readability.
Yes this is exactly what I’m intending. Will the code I have achieve this? I’ve gone over it many times I cant quite tell what might be wrong.
Trigger - if DEVICE1 is <50% charge
Condition for trigger - DEVICE1 is also below 350w AC input power draw (i.e NOT charging from the grid) in addition to the <50% charge trigger. If both conditions are met.
Action - Activate DEVICE2’s AC power output, and wait until the condition of either >79% battery charge is reached OR >350w AC input power draw (i.e NOW charging from the grid) occurs on DEVICE1.
Once conditions for repeat is met in the third step, turn off AC power output on DEVICE2
So this is not the solution, just something to start with and play.
Note the conversion to int, with a default value as it might be unknown or undefined
This is not close to what I proposed and not what you wrote, but as @Olivier1974 proposed, you can play around
EDIT, the other option is to write one automation for turning it on and another for turning it off, this prevents the need to ‘waiting’ a long(er) time, i.e. if your server has a hickup the automation will not continue where it was stopped
I agree, waiting is usually not a good practice.
I’m using it with TTS because I’ve to wait for the speaker to go back to idle to detect the end of the TTS sequence.
But this is obviously a small waiting time, maximum 5-10 seconds.