Switch with Python

Post deleted by author!

Take a look at the Python API docs:

https://home-assistant.io/developers/python_api/

You could also look into AppDaemon…