Is there no way to dynamically set a background image in a picture element?
I want the background image to change based on a set of criteria but I want my badges to remain in place.
everything works except the image doesnt accept if statements or even variable?
ive tried the methods (sample data) but neither work:
variables:
current_image: >-
/local/images/animated-power-graph/01.gif
type: picture-elements
elements:
- type: state-badge
entity: sensor.solar_kw_total
style:
top: 9%
left: 75%
transform: scale(0.7,0.7)
'--ha-label-badge-title-font-size': 0em
- type: state-badge
entity: sensor.solar_used_for_house_kw
style:
top: 47%
left: 78%
title: Solar To House
transform: scale(0.7,0.7)
'--ha-label-badge-title-font-size': 0em
image: '{{ current_image }}'
and this:
type: picture-elements
elements:
- type: state-badge
entity: sensor.solar_kw_total
style:
top: 9%
left: 75%
transform: scale(0.7,0.7)
'--ha-label-badge-title-font-size': 0em
- type: state-badge
entity: sensor.solar_used_for_house_kw
style:
top: 47%
left: 78%
title: Solar To House
transform: scale(0.7,0.7)
'--ha-label-badge-title-font-size': 0em
image: >
{% if states('sensor.solar_used_for_house_kw')|float > 0 %}
/local/images/animated-power-graph/02.gif
{% else %}
/local/images/animated-power-graph/01.gif
{% endif %}