How to switch a Selector Switch from Python

Python and python framework

Moderator: leecollings

Post Reply
User avatar
jjnh
Posts: 33
Joined: Sunday 09 December 2018 14:06
Target OS: Linux
Domoticz version: 2023.1
Location: Netherlands
Contact:

How to switch a Selector Switch from Python

Post 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.
Odroid N2+ 4GB, with an RfxTrx433E, Zigbee with Slaesh's CC2652RB, Z-Wave, BroadLink IR using RM mini 3 and P1 connected.
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: How to switch a Selector Switch from Python

Post 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...
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jjnh
Posts: 33
Joined: Sunday 09 December 2018 14:06
Target OS: Linux
Domoticz version: 2023.1
Location: Netherlands
Contact:

Re: How to switch a Selector Switch from Python

Post 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.
Odroid N2+ 4GB, with an RfxTrx433E, Zigbee with Slaesh's CC2652RB, Z-Wave, BroadLink IR using RM mini 3 and P1 connected.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest