Rather than maintaining an ever growing list of binary type device classes to support things like people having windows that open horizontally or gates or mailboxes, etc…
Could a custom device class option be implemented that would be defined something like this:
device_class:
- binary_sensor:
- <device_class_name>:
state_off: <off state word>
state_on: <on state word>
icon_off: <mdi icon for off state>
icon_on: <mdi icon for on state>
All options under name would be optional with undefined options defaulting to the device_class: none states and icons.
I would also appreciate the ability to use custom device classes like this. I’ve got some binary sensors that don’t fit into the “normal” categories. Some are alarms, some are status (like steam pressure OK vs LOW), and some are RUNNING vs FAULT. Tom has presented a good idea that I could use as-is.
I was only really looking for a way to customise the mdi icons for the binary sensor motion device class.
I find the current ones (person and beacony thing with and without a slash) to be busy and not readily discernable.
But it appears this customisation connot be done.
I can customise the device class of all my sensors by a glob match… to, say “movement” but then the text isnt quite right.
I can also do customisation at UI level but its then a per-entity type thing and a lot of work/maintenance.
Toms proposed approach is much more generalised… I think it’s a good idea.
This is a great idea. I was actually searching to see if someone had suggested an active/inactive device_class (of which I would have 3-4 already), but making device_class completely customizable is probably the best option.
I’m glad I’m not the only one that would like something like this. I currently have been sifting for an option to show pressed(on) and released(off). Please guys can we fit this in.
Hard to believe this is still not implemented. It’s such a no-brainer. The hard coded device classes are really limiting, considering the amount of novel smart devices entering the market and all the DIY devices around.
Where to put this config? I was try put in configuration.yaml but end with Integration error: device_class - Integration ‘device_class’ not found. when I do config validation…
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.