Change binary sensor state text

Hey

So I have multiple binary sensors set up to ping media devices on my network, like my TV, Xbox etc. They are all working perfectly but they display as connected or disconnected, I would rather they show as On and Off

With the level of customisation available in HA I’m sure this is possible, can anyone help me
Thanks

If you have set the binary_sensor’s device_class to connectivity it will displays its states using connected and disconnected.

If you remove the device_class option, it will default to using on and off.

Thanks, I can’t get this option to stick, I can edit the entity and remove device_class which does show on rather than connected but after a few seconds it reverts back to connected.

I’ve tried putting

device_class: power

In my configuration.yaml but HA claimed it is deprecated in current version.

Any ideas how I should get it to stick.
Thanks

** Never mind I’ve got it, needed to out in the customize section rather than the device configuration** thanks for your help

Any idea how to either make the sky sensors icons show a different colour depending on the state or stop the binary sensors doing it, so it’s all the same. Thanks again

For that capability (and more), you need to install this custom component:

It lets you define the desired icon and icon_color based on whatever conditions you want. For example, here is how I control the appearance of the icons and their colors for my thermostat:

In customize.yaml:

climate.thermostat:
  templates:
    icon: >
      if (attributes.operation_mode === 'off') return 'mdi:power-off';
      if (state === 'heat') return 'mdi:fire';
      if (state === 'cool') return 'mdi:snowflake';
      if (state === 'auto') return 'mdi:autorenew';
      if (state === 'idle') return 'mdi:sleep';
      return 'mdi:power-off';
    icon_color: >
      if (attributes.operation_mode === 'off') return 'gray';
      if (state === 'heat') return 'red';
      if (state === 'cool') return 'blue';
      if (state === 'auto') return 'green';
      if (state === 'idle') return 'black';
      return 'gray';