How to make all my switches lights?

I have Sonoff (ESPurna) switches which are autodiscovered by Home Assistant.

One problem is that there are (correctly) classified as switches, while in reality they are all in from of lamps. I would therefore like them to be classified as lights (especially for the icon because I do not know if there are other differences)

The solution I use today is to explicitly define them as lights - thus loosing the autodiscovery capacity.

I tried to

  customize_glob:
    "switch.*":
      device_class: light

but this does not work.

I also tried to change the icon via customize_domain(since I am not sure whether anything else matters in my case), but this did not work either: EDIT: this works but I dio not know what I am loosing when not using the right device class (and just overriding the icon)

Good news - there is a Light Switch for that.

Thank you. How would I apply this to all my (autodiscovered) switches ?

I don’t think that there is an automated way to do that for each switch. I have done that manually for my switches.

Just to make sure I understand: this means that I would need to have a block like this one for each switch?

  - platform: switch
    name: Light in the bedroom
    entity_id: switch.bedroom_light
  - platform: switch
    name: Another light in the bedroom
    entity_id: switch.another_bedroom_light

Yes, I believe there is no shortcut.

I found some kind of workaround by overriding the icon (see my edit in the question)

1 Like