Device Class Template

Afternoon All,

Firstly I appreciate what I’m about to suggest / request is viable through custom ui, I just think it might be easier for beginners and more user friendly if we had a device class template. I for one cannot get my head round the custom ui configuration on HASSIO.

What I propose is to have “device class template” that can be used something like this:

device_class:
  - plateform: template
    classes:
      washingmachine:
        friendlyname: "Washing Machine"
        on_value: "Running"
        off_value: "Ready For Load"
        icon: mdi:washing-machine
      freezer:
        friendlyname: "Freezer"
        on_value: "Freezer Okay"
        off_value: "Check Door"
        icon: mdi:fridge

Customize.yaml

sensor.smarthingsmultisensor:
  device_class: washingmachine

#Takes on state and reports "Running", changes icon to yellow (as per normal device_class)

binary_sensor.door_window_sensor_123a12345b1234:
  device_class: freezer
  
#Takes on state and reports "Check Door", changes icon to yellow  (as per normal device_class)

I know we have a few options for device_class but it would be nice to be able to quickly implement our own custom ones as above.

The changing to yellow makes all the difference for me as it’s a nice quick visual check.

This is a great suggestion. Particularly useful for binary template sensors where a custom on/off value is desired for a device class.

Is this still a proposed request? Or has it been solved over the last 2.5 years?

I would love to have a general “yes/no” binary sensor device class. Is there a way to implement this in the current release?

It was never implemented.

The available types of device_class for a binary_sensor are documented here. There’s nothing that displays yes/no for on/off.

As a workaround, you could create a Template Sensor that monitors your existing binary_sensor and reports its state as yes/no.

Perhaps there might be a way to do it with a custom Lovelace card but I am just speculating. Either way, it won’t be as effortless as simply setting the binary_sensor’s device_class.

1 Like