Miio switch as light

Hello all,

I have some trouble making a Xiaomi smart plug (WiFi) available as a light instead of a switch. I was wondering someone could help me with this.

I have the following configured in my configuration.yaml:

light: 
 - platform: switch
    name: L-W-TV Lamp
    entity_id: switch.lwtvlamp
switch:
  - platform: xiaomi_miio
    name: Woonkamer TV Lamp
    host: 172.16.30.12
    token: b528d2ae4ae5622cac6909926bexxxxxx

But this just shows the switch as a switch. I also tried the following:

light:
  - platform: xiaomi_miio
    name: Woonkamer TV Lamp
    host: 172.16.30.12
    token: b528d2ae4ae5622cac6909926bexxxxxx

but then the entity won’t show up at all.

Could someone help me? Thanks

This might not fix things but try the below changes:

So that’s a slight change to the alignment in the light section (spaces removed), and the entity_id changed to the name of the switch.

I’ve also removed the dashes (“-”) from the light name, there was a time Home Assistant didn’t like them so I always keep them out of names as a ‘just in case’. Underscores are the good substitute.