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.
-
Create a template helper, and select the switch template type
-
Name it the same as your current light entity. When it is done, you will have two entities:
light.your_entity
switch.your_entity
- Have the value template simply point to your light’s state:
{{ states.light.your_entity.state }}
- 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
-
Point the device of the template to the device that the light is associated with.
-
In the device, hide the light entity (optional, but this is how the change device type helper works, so this mirrors that function).
-
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