USB-Relay-2 programming

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

Post Reply
njlammerts
Posts: 153
Joined: Wednesday 12 August 2020 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Fryslan
Contact:

USB-Relay-2 programming

Post by njlammerts »

For a small project I want to switch a 230V pump with Raspberry-Pi and 3-5 temperature sensors. I got the DS18B20 but gut stuck with the address ID problem viewtopic.php?t=39559 (please do not respond here)

For the switching of the pump I want to use a small 2-way relais board with USB.
2-channel-usb-relay-module.jpeg
2-channel-usb-relay-module.jpeg (58.97 KiB) Viewed 1165 times
The USB-Relay-2 board is described at GitHub https://github.com/pavel-a/usb-relay-hid and with the V-USB Wiki page.

i have no programming skills but got so far that I can switch them off / on from the cmd prompt
Schermafbeelding 2023-01-05 om 17.50.55.png
Schermafbeelding 2023-01-05 om 17.50.55.png (28.83 KiB) Viewed 1165 times


Can someone help me with a way I can switch them on/off from Domoticz, with a script etc? or maybe from a dummy switch, who calls a script ?

I got some extra info from this location, including drivers https://github.com/bbqkees/Domoticz-Pi- ... -solutions But I can't get step 2 to work.

All help and info is much appreciated!!
User avatar
waltervl
Posts: 6689
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: USB-Relay-2 programming

Post by waltervl »

You can make a virtual switch per relay and put this commands in a bash script that you can use in action script. But for that you need to make rise commands run without sudo to be sure it will run from Domoticz (depends on your Domoticz install).

For that you need those udev rules.....

So summary.
1. Set udev rules
2. Make bash scripts to use in Domoticz https://www.domoticz.com/wiki/Scripting ... ua_Scripts
3. Make virtual switches on Domoticz https://www.domoticz.com/wiki/Dummy_for ... l_Switches
4. Link switches to bash scripts. Edit device and please on and of script link in the on and off action field.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest