Make a switch to a light

Hi there
I am controlling Hass with Google assistant, and I have realized that there is a difference between a light and a switch when I try to control them with voice commands. In automation Hass does not care if it is a switch or a light. Switch requires “switch” key word when I try to control it with Google assistant. I have a mix of hue lights and some light controlled by a switch. Naturally I want to control all my lights as lights, even the ones connected to a switch. My wife will never accept to learn if a light is a hue or controlled by a switch…
I have found a few hints on how to make switches to lights, but not succeeded on my own.
Anyone that can describe exactly what I need to do?

How have you exposed your lights and switches?
I personally did not expose anything automatically, I only expose what I want/need, this way I can also “override” the entity name by giving it an alias which I use with google commands:

Actually I have not chosen to expose anything. Google assistant downloaded all groups, lights and switches, scripts etc when I connected Hass.io with Google assistant in Google home,
I have not used any steps described in the Google assistant component. It seems to work anyway now.

I would just like to redefine switches to lights, then I am all set.

Ah I didn’t realise you were on hass.io.
Then I guess you could always create template lights that pull status and commands from your switches?
https://www.home-assistant.io/components/light.template/

I agree. See for more details…

Ahh. Great. Thanks. Seems to work. Automations work, will try Google assistant when I get back home.
One more thing. When turned on, only the switch shows the “on” status in front end. Not the new light. Any way of fixing that as well? Or do I need to use the switch on the dash board?

Interesting - for me (UK English) turn works, and is the documented command.

make sure you set your light value_template to be the status of your switch…

Ahh,… like this?

    level_template: '{{ 100 if is_state("switch.switch_1", "on") else 0 }}'
    value_template: '{{ is_state("switch.switch_1", "on") }}'

there should be no level template as it’s a switch.
Your value template should look like this:
value_template: '{{ states.switch.switch_1.state }}'

Ok, great. Will try it when I get home. Super thanks for the help!

1 Like

Would there be example script somewhere for this ? I dont have coding skills, but im keen to learn…

I have one z-wave switch that controls light, so obviously i would like to see it as “light” in frontend …

If you want it to look like a light, create a light switch

8 Likes

That was simple, thnx :slight_smile:

Trying to use this in ,my setup. Do I need to pick the entity id of the zwave device of the switch or the actual entity of the switch entity itself. I’ve tried both, but i keep getting device unavailable. Thanks in advance

Edit:
figured it out

light:
  - platform: switch
    name: Light Name
    entity_id: switch.name_switch

For the entity _id assign the actual _switch entity not the z wave device entity_id.

The entity id for the new light will be: light.light_name

4 Likes

If you have multiple switches you need to setup, how would you type it?

like this

light:
  - platform: switch
    name: Light Name
    entity_id: switch.name_switch
  - platform: switch
    name: Light Name 2
    entity_id: switch.name_switch_2
8 Likes

Sorted now, thanks Petro!

I’ve done thi and it now shows up as a light. But it is still showing as a witch also. Anything I can o to have it just show as a light?

No, just remove the switch from the UI. Take a look at the video in the link. It will show you how to configure the user interface.