Guide: Change Light Entity to Switch

Just wanted to share a simple configuration for how I did this, as it was not immediately obvious to me, and there were not any other posts covering this that I found.

I have a Zigbee relay which when paired, erroneously showed the main relay switch as a light. This would be fine except certain things like thermostats expect a switch, not a light. There is a helper which allows changing a switch to a light, or another entity type, but not the other way around. However, this process is still trivial with a template helper.

  1. Create a template helper, and select the switch template type
    image

  2. Name it the same as your current light entity. When it is done, you will have two entities:

light.your_entity
switch.your_entity
  1. Have the value template simply point to your light’s state:
{{ states.light.your_entity.state }}
  1. Set the turn on and off actions to simply turn the light on and off:
action: light.turn_on
metadata: {}
data: {}
target:
  entity_id: light.your_entity
action: light.turn_off
metadata: {}
data: {}
target:
  entity_id: light.your_entity
  1. Point the device of the template to the device that the light is associated with.
    image

  2. In the device, hide the light entity (optional, but this is how the change device type helper works, so this mirrors that function).
    image

  3. That’s it! When you change the state of either the light or the switch, the other will match its state, so you can now use this new switch entity in a thermostat or similar.

This could also very easily be done in YAML, but I like how fast this is to setup through the UI as well :slight_smile:

3 Likes

I just signed up to say thank you for posting this with the detail. It solves a problem I have with zigbee relay devices and USB switches too. Would be helpful to be able to edit the entity type in the interface but this is a good workaround.