Good morning to everyone.
Im stucked at the end of my project with an apparent banality, but after my search im unable to solve it.
I have a floorplan image of my house and in 1 zone i have 2 light:
1 big spotlight and 1 small spotlight.
If one of the two is in ‘on’ state, I would like to change the image and light on the zone over my floorplan image.
The problem is with my code: i wanna check the status of the 2 light and apply the light gradient if at least one of the two is “on”.
I wanna remove the gradient when both lights are off
At the moment my code is like that and it clearly doesn’t work
- type: image
entity: switch.bigLight
tap_action: none
hold_action: none
state_image:
'on': /local/floorplan/3DTOPTransparent.png
'off': /local/floorplan/3DTOPLightOff.png
unavailable: /local/floorplan/3DTOPLightOff.png
style:
top: 50%
left: 50%
width: 100%
- type: image
entity: switch.smallLight
tap_action: none
hold_action: none
state_image:
'on': /local/floorplan/3DTOPTransparent.png
'off': /local/floorplan/3DTOPLightOff.png
unavailable: /local/floorplan/3DTOPLightOff.png
style:
top: 50%
left: 50%
width: 100%
So I would like to understand how to apply some conditional code to state_image: like this
state_image: >-
{% if switch.smallLight == on OR switch.bigLight == on %}
/local/floorplan/3DTOPTransparent.png
{% elif switch.smallLight == off AND switch.bigLight == off %}
/local/floorplan/3DTOPLightOff.png
{% elif switch.smallLight == unavailable OR switch.bigLight == unavailable %}
/local/floorplan/3DTOPLightOff.png
{% endif %}
Thanks if you want to help me!