Mqtt item + json

Hi folks,

I have mqtt setup and working. My switch sends a message ok.

To make my milights work I need to send the following:
lights/0x9B55/rgbw/3 with a payload of {“status”:“ON”}

I have an item as follows:Switch myItem { mqtt=">[mqtt:lights/0x9B55/rgbw/3:command:{“status”:“ON”}:1],>[mqtt:lights/0x9B55/rgbw/3:command:{“status”:“OFF”}:0]" }

clearly that, and any permutations, do not work.

I have tried the following:
Switch myItem { mqtt=">[mqtt:lights/0x9B55/rgbw/3:MAP(milight.map):1],>[mqtt:lights/0x9B55/rgbw/3:MAP(milight.map):0]" }
I have a map called milight.map which contains the following:
1={“status”:“ON”}
0={“status”:“OFF”}

None of the above works and I have run out of things to read and differences to try.

Any help appreciated.

Thanks!

Hi Crispin, did you succeed in this? I have the same problem and am looking at trying to perform a JS transform, but know nothing about JS transforms as yet. Learning curve time.
My situation requires a JSON object to be sent to a MQTT 2 DMX converter, so I need multiple settings to pass at once.
I also have MiLight, but havent got it working yet (non priority)

Cheers

Hi,

No, I did not. I’ve since moved on to other things and not revisted it yet.