New binary_sensor class: "error"

Hi,

I’d like to propose a new class for binary sensors to accomodate for generic error conditions.
The sensor class could for example be called error or generic_error.
States would be “ERROR” and “OK” with some red “X” icon for the error state and a checkmark for the ok state.

This could be used for all sorts of sensors that trigger on any kind of error condition, for example I’m having a command line binary sensor to check for errors in my OWZ_Log.txt file:

platform: command_line
name: OpenZWave Error
command: "/bin/bash -c '/bin/grep -q ERROR /config/OZW_Log.txt && /bin/echo ON || /bin/echo OFF'"
payload_on: "ON"
payload_off: "OFF"

Sebastian

You can take a https://home-assistant.io/components/sensor.template/ and have it extract both state and icon from your command line sensor.

1 Like

Wow, that’s really cool! I didn’t know about the icon_template part yet!
Still, with eyes on reducing unnecessary complexity, I’d prefer an additional sensor class.
There are already 16 different sensor classes, so one more shouldn’t hurt :wink:

Alternatively, one could make a totally generic binary_sensor with options to specify on/off state names and on/off icons.

Sebastian