add icon or icon template to the sensors.
See original GitHub issueDo you ever plan to add icons to sensors, better icon templates? Because now, after creating sensors, you have to create sensor templates and only add icons there.
multiscrape:
- resource: https://www.home-assistant.io
scan_interval: 3600
sensor:
- name: Latest version
select: ".current-version > h1:nth-child(1)"
value_template: '{{ (value.split(":")[1]) }}'
- name: Release date
select: ".release-date"
binary_sensor:
- name: Latest version == 2021.7.0
select: ".current-version > h1:nth-child(1)"
value_template: '{{ (value.split(":")[1]) | trim == "2021.7.0" }}'
sensor:
- platform: template
sensors:
latest_version_good:
friendky_name: Latest version
value_template: '{{ states('sensor.latest_version') }}'
icon_template: >-
{% if is_state('sensor.latest_version', states('sensor.version')) %}
mid:movie-star-outline
{% else %}
mid:history
{% end if %}
binary_sensor:
- platform: template
sensors:
latest_version_good:
friendly_name: Latest version
value_template: '{{ is_state('binary_sensor.latest_version', 'on') }}'
icon_template: >-
{% if is_state('binary_sensor.latest_version', 'on') %}
mid:check-circle-outline
{% else %}
mid:checkbox-blank-circle-outline
{% end if %}
After that, duplicate sensors appear with and without icons.
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
Change Icon in a template sensor - Configuration
hi there, i have created a sensor for a hue motion sensor to add the battery ... The code is the same as...
Read more >Using a Template to Change a Sensor's Icon in Home ...
The value_template , where you define the states of the sensor based on inputs; The icon_template , where you change the type of...
Read more >Templates and Custom Sensors in Home Assistant - YouTube
Material Design Icons : https://materialdesignicons.com/ * How to ... to use a custom sensor in a Home Assistant dashboard 23:46 Add a custom ......
Read more >Motion Sensor Icon - Dribbble
Discover 1 Motion Sensor Icon design on Dribbble. Your resource to discover and connect with designers worldwide.
Read more >Template Sensor - Home Assistant 中文网
To enable Template Sensors in your installation, add the following to your ... (template)(Optional)Defines a template for the icon of the sensor.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it’s easier for binary sensors to provide a boolean as input for the icon template instead of a string. I’ll try to clarify the description. Thanks!
Could you elaborate on your issue? Works for me:
{% if value == True %}