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
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
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.
Thanks from me as well - in my case I have a zigbee 4 way relay, and each relay appears as a light rather than a switch. I am using it to control a projector screen - eg one relay triggers the screen to go down, one relay triggers it to go up. I wanted to use voice commands on it, but had to say things like âhey google, turn projector screen onâ. Now I can say more natural things like âhey google, lower projector screenâ. Small victories.
I know that Iâm late to this topic but I canât seem to get my Tuya Water Valve Controller that ZHA has identified as a light to be either a switch or a valve using this suggestion. I fairly sure that I have the correct IEEE id, Iâve restarted HA, and still no joy. I thinking that it could either be that I need to fully restart my HAOS system, put this zha: entry into another yaml file or move ahead with a template. Any suggestions would be appreciated - attached are screenshots of my configuration.yaml, the Tuya Zigbee details, and the âManage Zigbee Deviceâ window.
Thank you! This saved me. I had both a HUE light strip that I couldnât add to the count of switches in a room, and the same with a Leviton Decora. Not only can I see the correct count of lights + switches in those rooms, but I can also turn them on and off with a general button for each room, which before was impossible.
Iâm glad you brought this up, because the way I had it written is actually not recommended.
See the warning here.
Warning
Avoid using states.sensor.temperature.state, instead use states('sensor.temperature'). It is strongly advised to use the states(), is_state(), state_attr() and is_state_attr() as much as possible, to avoid errors and error message when the entity isnât ready yet (such as during Home Assistant startup).
I had switched my template some time ago, but forgot about this post. I updated the guide with the proper template.