Implement switch entity with Pyscript #776
|
Is it possible to use Pyscript to implement a switch entity? I want to create a switch in HA, where my Python code is called to get and set the switch state. I'm not trying to get/set an existing switch, I want to create one. Is this possible? What if I used a switch template? I can get the value of the switch template from a state variable set by Pyscript. And maybe I can make the turn on and turn off actions trigger Pyscript functions using |
Answered by
TechnoFairyGirl
Nov 16, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Yes. This works.
The code:
\
The template switch: