WTH can't we have a Binary Sensor with Yes or No

I realize that this has come up multiple times and likely isn’t the right section to ask in. But if you don’t ask, you don’t get :slight_smile:

Could you look into creating a simple binary sensor in ESPHome that returns Yes or No ( instead of On or Off ) to Home Assistant ?

Thanks for all the great work you do

Are you asking for a binary sensor whose actual state is “Yes/No” or a new device class for binary sensors so that the frontend representation is “Yes/No”? The latter is probably more likely to be acted on… I’m not sure, but the former is probably against the current architecture guidelines.

1 Like

I may not get the terminology right. But I’m thinking the former

In my scenario, I use an ultrasonic sensor to determine if a car is in the garage or not. I’d like it to return Yes or No ( instead of On or Off ) to Home Assistant

This is purely cosmetic so not likely worth a devs time. But it’s the month of WTH…so I thought WTH

If anyone can think of a way to do it with other code fudgery, I’m open to it

I would expand this, WTH I cannot have a custom configurable device_class.

device_class:
   binary:
      lunch:
         "true": 
             name: ready
             icon: mdi:lunch
        "false":
             name: not_ready
             icon: mdi:not-lunch

binary_sensors are purely on or off. The only thing that changes is how their displayed, based upon the device class.

1 Like

That’s the ask, make the representation configurable. Think of a blueprint for sensors.

Template sensor helper, state template:

{{ 'Yes' if is_state('binary_sensor.your_source','on') else 'No' }}

Binary sensors are defined as on or off — you can use device classes to give a variety of different front-end representations of that, but please don’t make the back end more complicated.

Perhaps put a feature request in for a “yes / no” device class to be added.

1 Like

You can do that, but it sucks:

  • You need a separate icon handling
  • It’s not a binary sensor anymore, triggering on it will require some jumps
  • Cannot be multi-lingual
  • You need separate color handling on the dashboard (will not be yellow automatically when on)

This has been requested before. I’m guessing it is just too big an ask. I’ve given up asking.

2 Likes