Closed blubbel42 closed 1 year ago
thanks for repoting
was able to reproduce; state based icon overwires are broken will have a look
hey, should be fixed update to main in hacs and restart appdaemon
Thanx!! That was really damn fast! Can confirm Bug is fixed, does work now.
Not sure where to ask this, but is there an easier way to do this?
weatherOverrideForecast4:
entity: sensor.victron_battery
name: Batt
icon:
"100": mdi:battery
"99": mdi:battery-90
"98": mdi:battery-90
"97": mdi:battery-90
"96": mdi:battery-90
"95": mdi:battery-90
"94": mdi:battery-90
"93": mdi:battery-90
"92": mdi:battery-90
"91": mdi:battery-90
"90": mdi:battery-90
"89": mdi:battery-80
"88": mdi:battery-80
"87": mdi:battery-80
"86": mdi:battery-80
"85": mdi:battery-80
"84": mdi:battery-80
"83": mdi:battery-80
<etc>
you can do this based on homeassistant templates:
icon: 'ha:{{ state_attr("climate.wohnzimmer_boden","current_temperature")}}'
you just need a template that outputs the icon name you are searching for
https://docs.nspanel.pky.eu/entities/?h=icons#override-icons-or-names https://www.home-assistant.io/integrations/template/
You can test templates in the HA Dev Tools
(best way to implement this is probably do devide the battery value by 10 and convert it to an iteger and then append it to the name of the icon)
I had this originally, but it didn't work:
icon: >
{%if(int(states("sensor.victron_battery")) > 99) %}
mdi:battery
{%elif(int(states("sensor.victron_battery")) < 10) %}
mdi:battery-alert-variant-outline
{%else%}
mdi:battery-{{int(states("sensor.victron_battery")) // 10}}0
{%endif%}
Where do I need to insert the "ha:
"?
try this
icon: >
ha:{%if(int(states("sensor.victron_battery")) > 99) %}
mdi:battery
{%elif(int(states("sensor.victron_battery")) < 10) %}
mdi:battery-alert-variant-outline
{%else%}
mdi:battery-{{int(states("sensor.victron_battery")) // 10}}0
{%endif%}
I'm not sure if the newlines are an issue, maybe you have to do it in one line:
ha:{%if(int(states("sensor.0x00158d0004314218_battery")) > 99) %}mdi:battery{%elif(int(states("sensor.0x00158d0004314218_battery")) < 10) %}mdi:battery-alert-variant-outline{%else%}mdi:battery-{{int(states("sensor.0x00158d0004314218_battery")) // 10}}0{%endif%}
I tried it like this:
icon: 'ha:{%if(int(states("sensor.victron_battery")) > 99) %}battery{%elif(int(states("sensor.victron_battery")) < 10) %}battery-alert-variant-outline{%else%}battery-{{int(states("sensor.victron_battery")) // 10}}0{%endif%}'
(and I checked that I got ha:battery-50
in the Template playground in Dev tools with a 50% charge), but unfortunately it still doesn't render an icon, just text:
Adding "mdi:" back resulted in this:
This is running version 3.7.3, by the way, on the US-P display.
You are right, the main reason for the templates was to display values from HA instead of icons. You can use the character of the icon instead of the name. Just click on the U in the cheat sheet and use it instead if the name.
PROBLEM DESCRIPTION
A clear and concise description of what the problem is. When configuring StatusIcons in the newest dev (e2e91ad) which use colors for different states the colorchange will not work, when using different icons for different states all status and weathericons dissapear. Everything else works fine
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Log output here: