Good morning mates,
During creating my lights map, I am tring to set opacity value from a sunlight template sensor.
The idea is to have “darker” rooms in the evening, clear rooms during the day when the light state is off.
This is my card config:
type: picture-elements
title: Interrato
path: floorplan
panel: true
icon: mdi:floor-plan
image: /local/interratov3.png
elements:
- type: image
tap_action:
action: toggle
entity: switch.gruppo_luci_interrato
image: /local/interratooff.png
state_filter:
‘off’: opacity(60%)
‘on’: opacity(1%)
style:
top: 70.3%
left: 20%
width: 24.1%
In this case, when the light is off I have 60% of opacity, when is on 1% of opacity of a black image (nterratooff.png)
My idea is to use the value of the sunlight sensor for off state filter opacity.
How may I use the variable?
My idea should be defining the variable
variables:
- states[‘sensor.sunlight_pct’].state
And use like this in the image entity
state_filter:
‘off’: opacity({{ (state.sensor.sunlight_pct) }}%)
But I have only 100% opacity (or I think unmatched value)
Thank you lots,
Andrea