Hia
If this has already been answered, then I apologise in advance
I need help creating an automation.
In my bathroom I got
5 LED spots (Ikea)
a switch (tasmota)
Ikea 5 button remote
I’d like to model the following behaviour on button-push
if(some lights are on){
turn off
}
else
{
if(its night){
turn-some-lights on
}
else{
CRANK IT UP
}
}
But how to do it?? I’d really like your input.
Right now, I simply toggle everything on btn-push. But, as I use ZHA-groups sometimesnot all the lights receives the order, which brings the room into an annoying (disco)state.
That’s something that cannot be resolved by HA, if the underlying integration fails to address and report devices properly.
With up to 5 lamps you could drop that ZHA group in favour of a ZA Light Group. The group will be on if one element is on and off, if all elements are off.
Drawback is, that lamps will not switch on/off at the same time, but with noteable delay.
I never said the entities doesn’t report back They do! (at least most of the time). It seems to be a “timing issue”; sometimes not all the lights in the ZHA Group won’t turn off(/on)
Thanks for the suggestion with HA light Groups (I assume that’s what you mean)
I’m sure HA would be capable of solving my issue.
I’ve fiddled with templates, like this one:
{% if (
is_state('light.bad_1_spot_1', 'on') or
is_state('light.bad_1_spot_2', 'on') or
is_state('light.bad_1_spot_3', 'on') or
is_state('light.bad_1_spot_4', 'on') or
is_state('light.bad_1_spot_5', 'on') or
is_state('light.bad_1_spejllys', 'on')
)
%}
Some lights on
{% else %}
all lights off
{% endif %}
But I’m comming up short as to how to best integrate this into an automation. My thinking is that maybe that template could be expanded upon??
With 2 separate automations this wouldn’t be much of an issue. One automation with condition “at least one of the lights is on”. And another with condition “if all lights are off”.
@123, I would be very interested Thank you.
That’s even more consice, I love it. Thank you for sharing
I believe a spotted a tiny mistake in this:
We need an evaluation (==/>=), not an assignment (=) of the 23rd hour.
I don’t think I was explicit in this, but I want the night-scene to be activated between 23 and 6. So for me that would be: {{ qty == 0 and (now().hour >= 23 or now().hour < 5) }}
Again; thank you for showing me how this can be achieved. The templates-syntax and usage has been black magic, so having a Master of the Dark Art show me is a privilige
Thanks