Page 1 of 1
MQTT switch on rpi1 and light on rpi2
Posted: Thursday 15 April 2021 23:10
by goblin
hello experts,
i have two Rpi's with Domoticz and want to use a switch button on the client to switch a light on the server and v.v. via MQTT
Sounds simple but can't get it work.
assume i have a situation like mentioned in "
https://www.domoticz.com/wiki/MQTT#Architecture" where "other" is my second Rpi.
Can i use "on Action/Off Action" at edit light-switch ?
Thanks,
RPI 3
Mysensors gateway,
rflink Gateway
esp8266
Re: MQTT switch on rpi1 and light on rpi2
Posted: Thursday 15 April 2021 23:44
by waltervl
Re: MQTT switch on rpi1 and light on rpi2
Posted: Thursday 15 April 2021 23:54
by waaren
goblin wrote: ↑Thursday 15 April 2021 23:10
Can i use "on Action/Off Action" at edit light-switch ?
If there is no specific need to use MQTT you could simply use
Code: Select all
http://<target domoticz ip: target domoticz port>/json.htm?type=command¶m=switchlight&idx=<target device idx>&switchcmd=On
http://<target domoticz ip: target domoticz port>/json.htm?type=command¶m=switchlight&idx=<target device idx>&switchcmd=Off
in the On Action / Off Action fields of the edit switch screen of the source system.
You will have to allow password-less access for your home LAN (Settings: LOcal Networks (no username / password) or include passwords in the JSON API for this to work.
Using this method you are not limited by the requirements of the shared devices setup (same endian / same version)
Re: MQTT switch on rpi1 and light on rpi2
Posted: Friday 16 April 2021 11:34
by xury
I've done a Node-Red flow named Domoticz to Domoticz. You can adapt it to you. Is available on the node Red site.
With kind of switch device you use?
Re: MQTT switch on rpi1 and light on rpi2
Posted: Friday 16 April 2021 20:57
by goblin
tenx
let's dive into it this weekend.
should get something to work
