nashant
(Nashant)
1
Is it possible to create a usable switch just via the api? I’m trying to create a switch using
hass.states.set('switch.test_switch', 'off')
but, while it creates it, it’s not usable. If I try to toggle the switch it gives me
Unable to find referenced entities switch
I’m creating the switch from a pyscript script, but I suspect it would be the same from a python_script script.
Is what I’m trying to do even possible?
Tinkerer
(aka DubhAd on GitHub)
2
I’d bet that the switch
platform isn’t loaded, so while you’ve created the entity there’s nothing attached to it.
nashant
(Nashant)
3
If I’ve got other switch entities already present shouldn’t it be loaded? Or do I need to load the platform manually before I create the switch?
Tinkerer
(aka DubhAd on GitHub)
4
If you have other entities associated with a platform then it should be fine
nashant
(Nashant)
5
Should I have to tell it that it’s a template switch? Or is just that it’s a switch enough?