Hi,
I have a sensor custom component that reads the data from my UPS and as such can tell me if there has been a power failure. At the moment the badge simply reads PG (power good) or PF (power fail).
I have been trying to get it to display icons instead but I can only get a white empty badge.
In the “entity_picture(self)” function I am returning doing the following:
```@property
def entity_picture(self):
if ((unitdict[self._data_id] == ‘icon’) and (self._state in ICONS)):
_LOGGER.info("*************Return Icon:"+ICONS[self._state])
return ICONS[self._state]
else:
return Noneand:
ICONS={
“PG” :‘mdi:power-plug’,
“PF” :‘mdi:power-plug-off’,
}`
the function does return the correct thing (i.e. mdi:power-plug) when it should but the badge itself always is white.
I think I am missing something that tells the custom component that this should be an icon. I really don’t know.
Please note I am quite new to this so could be doing something VERY stupid.