Page 1 of 1

How to switch a Selector Switch from Python

Posted: Sunday 21 March 2021 14:51
by jjnh
I am pretty new to Python programming.

Right now I am trying to find out how to gracefully switch a selector switch from Python.

I can turn switches on and off using:

Code: Select all

import domoticz
import DomoticzEvents as DE
DE.Command("{name of the device", "on")
But switching a selector switch does not work.
In the meantime I solved it with a CURL command, but there must surely be a better way.

Re: How to switch a Selector Switch from Python

Posted: Sunday 21 March 2021 20:35
by waltervl
If you are not planning to create a Python plugin but just a script to automate some devices you better start with dzVents as it is way better documented and has a better integration with Domoticz and better support https://www.domoticz.com/wiki/DzVents:_ ... _scripting

Just my 2 cents...

Re: How to switch a Selector Switch from Python

Posted: Monday 22 March 2021 10:59
by jjnh
Thanks for the response. I indeed see that there is very little clear documentation on interfacing with Domoticz from Python.

Having several Dzvents script up and running I indeed agree this is much better, however I am building a script which automates interaction with a Yahboom cooling hat for my Raspberry Pi. This cooling hat uses I2C interfaces to steer a fan, Oled display and some RGB lighting. Therefore I need to import Python libraries.