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.
Odroid N2+ 4GB, Updated to 2025.2, with an RfxTrx433E, Zigbee2MQTT with Slaesh's CC2652RB and more than 65 devices active, Zwave-JS-UI, SolarEdge ModBus, Daikin (via Faikin), ESPEasy devices, iRobot and P1 connected.
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...
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
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.
Odroid N2+ 4GB, Updated to 2025.2, with an RfxTrx433E, Zigbee2MQTT with Slaesh's CC2652RB and more than 65 devices active, Zwave-JS-UI, SolarEdge ModBus, Daikin (via Faikin), ESPEasy devices, iRobot and P1 connected.