Rather than maintaining an ever growing list of binary sensor device classes to support things like people having windows that open horizontally or gates or mailboxes, etc…
WTH not implement support for custom device classes that could possibly be defined like this:
device_class:
- <domain>
- <class>
state_on: <on state word>
state_off: <off state word>
icon_on: <mdi icon for on state>
icon_off: <mdi icon for off state>
The class would have to be unique and not clash with existing core device classes for the domain.
For example:
device_class:
- binary_sensor:
- gate:
state_off: 'Closed'
state_on: 'Open'
icon_off: 'mdi:gate'
icon_on: 'mdi:gate-open'
- maibox:
state_off: 'Empty'
state_on: 'Full'
icon_off: 'mdi:mailbox'
icon_on: 'mdi:mailbox-up'
All configuration options could be optional with undefined options defaulting to the device_class: none
states and icons.
This could also be extended to other binary state domains like switches and covers:
device_class:
- binary_sensor:
- gate:
state_off: 'Closed'
state_on: 'Open'
icon_off: 'mdi:gate'
icon_on: 'mdi:gate-open'
- maibox:
state_off: 'Empty'
state_on: 'Full'
icon_off: 'mdi:mailbox'
icon_on: 'mdi:mailbox-up'
- switch:
- television:
icon_off: 'mdi:television-classic-off'
icon_on: 'mdi:television-classic'
- cover:
- double_garage:
state_off: 'Closed'
state_on: Open'
icon_off: 'mdi:garage-variant'
icon_on: 'mdi:garage-open-variant'
The cover also has optional opening
and closing
states. If this preculdes its inclusion, so be it. The main request is for binary_sensor custom device classes.
This request specifically does not include custom device classes for the sensor
domain. Control over the classes in that domain needs to be maintained (e.g. for energy dashboard).
I also relaise this request may have become a bit more complicated due to recent improvements to the automation editor, as it is now able to show translated states.
There is a currently open feature request for this that has garnered 78 votes at the time of publishing this post.
Thank you for your consideration of this request and continued interest in user feedback.