MQTT -> control more then one switch by one message

Moderator: leecollings

Post Reply
RafWojTar
Posts: 3
Joined: Saturday 18 April 2020 9:01
Target OS: Linux
Domoticz version:
Contact:

MQTT -> control more then one switch by one message

Post 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.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

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

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RafWojTar
Posts: 3
Joined: Saturday 18 April 2020 9:01
Target OS: Linux
Domoticz version:
Contact:

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

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest