so we can set an on/off icon on any entity, and not only a generic icon and not specifically requiring a device_class at all.
Tbh, its a bit if a mystery the current HA frontend lacks that rather basic functionality in UX and feedback.
(just so you are aware: all of these options/wishes on states used for the icon selecting mentioned above are available with custom-ui, but I dont want to advertise that anymore…)
I think an easier starting point is simply if I assign an icon x=mdi:gate
then if x-open exists (mdi:gate-open), then use it when the state is on/open.
Most icons are already named like this. It wouldn’t need any definitions at all.
But not all and therein lies the problem… There’s no control over the MDI set (from HA) and there are other sets people use too. This is what’s called a tight coupling between “systems” which generally is a bad idea.
Yes, PLEASE!!
This is not something exotic that occurs in an edge case or here and there. I literally have multiple occasions where I scratched my head why this is not possible and I have to define duplicate template sensors.
I find it so annoying that this has never been implemented. There have been suggestions made around this topic for close to 5 years but absolute tumbleweed from the developers on it. I’m yet to see a single comment about why it would be a bad idea to have this.
It’s all very well declaring 2023 to be the “Year of the Voice” and having big plans for the whole year, but it would be nice if they could address some simpler functionality such as this, which would make a huge improvement.
I found this thread because I was looking to define my own device class. So I voted yes. This really seems to fit with the HA customization/configuration paradigm.
The problem with this feature, is that it is disconnected between frontend and backend:
Meaning if we want to add a new class it needs to be updated in both the core and the frontend. As the icon information for example is clearly only available in the frontend (see code snippet above) while the textual content is available in the core:
What I am trying to say that my feeling is that to implement the functionality to be able to redefine the icons and state texts from config may be a bit bigger task. I will think about it a bit more, maybe there is a nice solution.
Ok looking a bit deeper, I think with the introduction of the “custom” device class it is possible to do it, as the current implementation in the frontend has access to the stateObj, so we can pass the icon name from the backend(core) to the frontend eith minimal change to the code and keeping backward compatibility like this: