dhaupt
(Daniel Haupt)
1
Could someone of you please help my aging brain out?? I’m just trying to use a simple AND expression, but it does not outputs the expected result.
I put the following to the templates section within the developer tools:
{{ states('light.livingroom_bulb1') }}
{{ states('switch.light_livingroom') }}
{{ states('light.livingroom_bulb1') and states('switch.light_livingroom') }}
{{ states('switch.light_livingroom') and states('light.livingroom_bulb1') }}
and it results to:
off
on
on
off
How could that be?? I’ve just exchanged the two arguments… What am I doing wrong? (Maybe it’s just to early in the morning to work on these things…)
francisp
(Francis)
2
What do you want to do ?
Try
{{is_state('light.livingroom_bulb1', 'on') }}
{{is_state('switch.light_livingroom', 'on') }}
{{is_state('light.livingroom_bulb1', 'on') and is_state('switch.light_livingroom', 'on') }}
{{is_state('switch.light_livingroom', 'on') and is_state('light.livingroom_bulb1', 'on') }}
myle
(StePhan McKillen (Other kiwi Here))
3
my understanding is
they are string values so it only showing the first value
so ‘on’ and ‘off’ dont make a false
need to convert to a true false then do the and thing
think is_state() is what looking for
bugger @francisp beat me
dhaupt
(Daniel Haupt)
4
Argl… of cause it’s string. Thanks, the is_state() function brought the solution!!!