i have an automation that turns off my outdoor switch if the irrigation starts.
I would like to set another automation (or do it in the same automation, you’ll tell me) to turn the switch back on ONLY if the switch was on before, is it possible?
Then: this automation starts if line1, line2, line3 or line4 starts, but in this way i get 4 notifications when a cycle starts… is it possible to receive only one notification if they start in sequence?
The easiest way is to create a boolean input helper, and set that to the state of the switch when irrigation starts. Then later on you can look at that to see what to do when irrigation stops. As for the second question, I don’t quite get what you mean.
That’s what i was thinking about, but i don’t really know how to implement it, as the irrigation is controlled via My Garden Irrigation and not via an integration of mine.
For the second question, the problem is: i have 4 lines, and in my automation i set 4 triggers, so that if any of the lines starts, the switch is shut off and i get a notifications… this works perfectly, until the cycle starts, in this case i have: line 1 starts, notification, line 2 starts, notification etc… I would like to get a notification when the switch is shut off by this automation, but only one time if it is a cycle.
I was thinking of simply getting a notification when the switch is shutted off, no matter why, and i’ll probably go for this solution, but i’d still like to know if it is possible to do what i had i mind
Most integrations either have triggers for the device to tell you what happens with it, change state or emit an event. Each have triggers to react on what happens. So there should be a way to see when irrigation starts, but I do not use this integration, so I cannot tell you how to do it for that exactly. But you say you’re already turning the switch off?
How do you turn of the switch exactly? You should copy the original state right before that. It would require an if/else and a contition on the state of the switch. if state is on, set input helper on, else set input helper off. For setting the input helper, there are services. input_boolean.turn_on and input_boolean.turn_off. It would look something like this:
Concerning the multiple messages: I’d probably look to set a timer for a minute or so when a lane ends, and not emit new messages when that timer is still running. That way it prevents messages when it switches lanes. You could also set a timer on start, but then you need to take into account the length of that run.
If your problem is that the integration controls the switch directly, and that you do not know when the integration does so or when the switch is operated another way, I’d create another input helper for the integration to control alone. Then you can react on that to operate the actual switch, and you know it must be the integration because no one else is allowed to control the dummy switch.