Page 1 of 1

MQTT -> control more then one switch by one message

Posted: Saturday 18 April 2020 11:19
by RafWojTar
Hi,

I hope this is the right forum section for this topic...

Is it possible to control more then one Domoticz's Ligth/Switch by MQTT broker message ("Domoticz/in" topic).

Everythings work fine when I use MQTT Topic: domoticz/in, Message: { "idx" : 2, "nvalue" : 1}

But I want to control more than one ligth/switch in one MQTT message, is it possible ?
I try to use JSON array like:

Code: Select all




{{ "idx" : 2, "nvalue" : 1} { "idx" : 3, "nvalue" : 1} }

[ { "idx" : 2, "nvalue" : 1}, { "idx" : 3, "nvalue" : 1} ]

{[{ "idx" : 2, "nvalue" : 1}, { "idx" : 3, "nvalue" : 1}]}

{ "idx": [ { "idx" : 2, "nvalue" : 1}, { "idx" : 3, "nvalue" : 1} ] }

{ "idx": 2, "nvalue": [ { "idx" : 2, "nvalue" : 1}, { "idx" : 3, "nvalue" : 1} ] }


someone could point to me whether I use the wrong syntax or Domoticz doesn't handle such inquiries ?




R.W.

Re: MQTT -> control more then one switch by one message

Posted: Saturday 18 April 2020 18:43
by waaren
RafWojTar wrote: Saturday 18 April 2020 11:19 Is it possible to control more then one Domoticz's Ligth/Switch by MQTT broker message ("Domoticz/in" topic).
But I want to control more than one light in one MQTT message, is it possible ?
If you want to do this in one command then you could use a domoticz group, with the devices you want to handle included, and send

Code: Select all

mosquitto_pub -m '{"command": "switchscene", "idx": 1, "switchcmd": "On" }' -t domoticz/in
please note that On / Off are case sensitive. on / off does not work.

More information on MQTT in / out domoticz can be found in the wiki

Re: MQTT -> control more then one switch by one message

Posted: Tuesday 21 April 2020 5:18
by RafWojTar
I didn't mean to control the switch, I wantd to keep the temperature up to date.
(I could suggest that I used nvalue in JSON - sorry)

Group control won't solve the problem ;-)

But I appreciate the hint and thank you very much

R.W.