Objective
- Visually report a defect with a red icon on the dashboard
- Do not display anything when everything is fine
![]()
The example above shows on the left a concern to connect with the portal automation management cabinet, everything goes well on the right.
Will not be treated here the way I get the information on or off but only its display.
For an example, see: this paragraph.
For my example, the entity that gives me the information is: binary_sensor.ping_portal
- on = ping ok so everything is fine
- off = failure
Customise the icon to display
Customization is done in the file customized_glob.yaml
Here is the code of my example, it will be valid for all entities that start with binary_sensor.ping_:
binary_sensor.ping_*: templates: icon: "if (state === 'off') return 'mdi:close-network-outline'; else return 'mdi:void';" icon_color: "if (state === 'off') return '#ff0000'; else return '#00b300';"
- mdi:close-network-outline corresponds to the icon with the cross symbolising the connection gap
- mdi:void corresponds to an empty icon
