Hello,
I have troubles with a dynamic template_icon. It cost my many ours but i can’t get it right.
I have connect my LG hombot to Ha. I would like to have a dynamic icon from the battery value.
This is the state from HA:
I would like to for example: mdi:battery when the battery is 100%.
mdi:battery-10 by 10%, mdi:battery-20 by 20 battery, etc.
I can’t get i right, i have no icon, or the default icon. Can someone help me?
This is the code fo now to try, but this is not working now: What do i wrong?
- platform: command_line
command: "curl http://192.168.2.19:6260/status.txt | awk 'NR==2' | awk -F'=' '{print $2}' | awk -F'\"' '{print $2}'"
name: HomBot_Battery
unit_of_measurement: "%"
icon_template: "{% if is_state('sensor.hombot_battery', '100') %}mdi:battery{% else %}mdi:battery-unknown{% endif
%}"