ESP8266/Plight - how to create a correct PilighttoMQTT message?

I played with my OMG (downloaded from master branch today) with Plight only enabled.
It reacts to my hardware RF remote (which can control RF sockets) - that’s what it shows when I press ON button:

22:21:30: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"systemcode":684549,"unitcode":7,"state":"off"}”,“protocol”:“logilink_switch”,“length”:“”,“repeats”:2,“status”:2}

22:21:30: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"unitcode":656613,"battery":"low"}”,“protocol”:“kerui_D026”,“length”:“”,“repeats”:2,“status”:2}

22:21:30: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"unitcode":195981,"state":"opened"}”,“protocol”:“ev1527”,“length”:“”,“repeats”:2,“status”:2}

22:21:30: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"id":1,"state":"on"}”,“protocol”:“ehome”,“length”:“1”,“repeats”:2,“status”:2}

22:21:30: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"id":41,"systemcode":12805,"unit":7,"state":"off"}”,“protocol”:“daycom”,“length”:“41”,“repeats”:2,“status”:2}

and OFF button:

22:22:08: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"systemcode":684549,"unitcode":6,"state":"off"}”,“protocol”:“logilink_switch”,“length”:“”,“repeats”:2,“status”:2}

22:22:08: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"unitcode":656613,"state":"opened"}”,“protocol”:“kerui_D026”,“length”:“”,“repeats”:2,“status”:2}

22:22:08: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"systemcode":19,"unitcode":7,"state":"off"}”,“protocol”:“heitech”,“length”:“”,“repeats”:2,“status”:2}

22:22:08: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"unitcode":195981,"state":"opened"}”,“protocol”:“ev1527”,“length”:“”,“repeats”:2,“status”:2}

22:22:08: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"systemcode":371,"unitcode":7,"state":"off"}”,“protocol”:“elro_800_switch”,“length”:“”,“repeats”:2,“status”:2}

22:22:08: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"id":1,"state":"on"}”,“protocol”:“ehome”,“length”:“1”,“repeats”:2,“status”:2}

22:22:08: (0) home/OMG_2nd_floor/PilighttoMQTT {“message”:“{"id":41,"systemcode":12805,"unit":6,"state":"off"}”,“protocol”:“daycom”,“length”:“41”,“repeats”:2,“status”:2}

Quite a lot for each button, isn’t it?
Anyway, it turns on and off a light when I press ON and OFF button.

Now I want to send these ON/OFF signals via OMG/Plight.
If I follow this guide, my OMG reboots on the following command (tried with or without length, repeats and status):

mosquitto_pub -h 192.168.0.34 -t home/OMG_2nd_floor/commands/MQTTtoPilight -m ‘{“message”:“{"systemcode":684549,"unitcode":7,"off": 1}”,“protocol”:“logilink_switch”,“length”:“”,“repeats”:2,“status”:2}’

If I send something like this, nothing happens:
mosquitto_pub -h 192.168.0.34 -t home/OMG_2nd_floor/commands/MQTTtoPilight -m ‘{“message”:“{"systemcode":684549,"unitcode":7,"state":"off"}”,“protocol”:“logilink_switch”,“length”:“”,“repeats”:2,“status”:2}’

It’s confusing when there is no answer to a message published to the command topic - should it be like that?

The trouble I cannot see anything in Serial Monitor if I connect my ESP8266 directly to my PC with a USB cable:
22:38:19.550 -> ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮BN⸮⸮⸮⸮⸮⸮⸮e'e⸮c%⸮:x⸮⸮9{dl⸮⸮|⸮l⸮| ⸮ l⸮ c|⸮⸮⸮e⸮{⸮c⸮ c⸮⸮gg⸮dno⸮⸮⸮ cpp⸮l{d{d

and OMG goes offline.

I cannot connect it via a FTDI programmer as the emitter should be connected to RX pin, which is used by the programmer.

Could anyone tell me what’s wrong with my approach and how to achieve my goal?

You can change this to pin D2, and put 4 in config_RF.h for the corresponding # define.

Are you sure your serial monitor speed is set to 115200bps ? [quote=“AhmadK, post:1, topic:446”]
mosquitto_pub -h 192.168.0.34 -t home/OMG_2nd_floor/commands/MQTTtoPilight -m ‘{“message”:“{“systemcode”:684549,“unitcode”:7,“state”:“off”}”,“protocol”:“logilink_switch”,“length”:“”,“repeats”:2,“status”:2}’
[/quote]

I don’t know if it is an issue with copy and past but the command seems to be a mix of " and “

ok, will try that

oh, I see… will make it consistent, I just copied OMG’s output…

UPDATE:
There was no need to change EMITTER_PIN as I ended up using an ordinary USB cable to connect my OMG to PC and it works fine.

I manually created the following command making sure there is only one type of double quotes used:

mosquitto_pub -h 192.168.0.34 -t home/OMG_2nd_floor/commands/MQTTtoPilight -m ‘{“message”:“{"systemcode":684549,"unitcode":7,"off":1}”, “protocol”:“logilink_switch”}’

and got this in Serial Monitor:

08:31:46.904 → Hey I got a callback
08:31:46.904 → MQTTtoPilight json data analysis
08:31:46.904 → MQTTtoPilight msg & protocol ok
08:31:52.804 →
08:31:52.804 → Soft WDT reset
08:31:52.804 →
08:31:52.804 → ctx: cont
08:31:52.804 → sp: 3ffff630 end: 3fffffd0 offset: 01b0
08:31:52.804 →
08:31:52.804 → >>>stack>>>
08:31:52.804 → 3ffff7e0: 000000b4 3fff4c54 3fff4ce4 40201dcc
08:31:52.804 → 3ffff7f0: 00000001 3ffe9dd8 3fff4c54 40209a12
08:31:52.804 → 3ffff800: 000a7205 3fff4c5c 3fff433c 3fff4b06
08:31:52.804 → 3ffff810: 3fff1da4 0000032e 0000032e 4010020c
08:31:52.804 → 3ffff820: 3fff1da4 0000052b 0000052b 4010020c
08:31:52.804 → 3ffff830: 3fff1da4 00000519 00000519 4010020c
08:31:52.804 → 3ffff840: 401068a8 3ffff8dc 00000026 401068d9
08:31:52.804 → 3ffff850: 3fff3fe4 00000026 3ffff8dc 402161a2
08:31:52.804 → 3ffff860: 00000001 3ffff890 0000000a 00000032
08:31:52.804 → 3ffff870: 3a225c64 2e373431 3fff49d4 3fff0088
08:31:52.804 → 3ffff880: 3fff34ac 0000000a 00000032 40216238
08:31:52.804 → 3ffff890: 011c0354 79746964 011c0354 2c302e33
08:31:52.804 → 3ffff8a0: 6162225c 011c0354 011c0354 011c0354
08:31:52.804 → 3ffff8b0: 70222c22 6f746f72 011c0354 6574223a
08:31:52.804 → 3ffff8c0: 68696e6b 226c6c61 656c222c 6874676e
08:31:52.804 → 3ffff8d0: 31223a22 011c0354 70657222 011c0354
08:31:52.804 → 3ffff8e0: 0354011c 011c0354 011c0354 011c0354
08:31:52.804 → 3ffff8f0: 25b8011c 00000000 00000000 40106a34
08:31:52.804 → 3ffff900: e003702d 40106974 3fffc258 4000050c
08:31:53.304 → 3ffff910: 4021060b 00000030 00000000 00000022
08:31:53.304 → 3ffff920: 3fffc200 40106974 3fffc258 4000050c
08:31:53.304 → 3ffff930: 40210613 00000030 00000018 ffffffff
08:31:53.304 → 3ffff940: 40210a13 00000000 00000075 00000014
08:31:53.304 → 3ffff950: 0000007e 6000001c 00000001 0000138e
08:31:53.304 → 3ffff960: 0000008e 3fff49b0 3fffdafc 3fff4c39
08:31:53.304 → 3ffff970: 0000001a 3fff4c3e 00000000 00000030
08:31:53.304 → 3ffff980: 40106a45 00000000 00000000 40106a34
08:31:53.304 → 3ffff990: e003702d 3fff1760 feefeffe 40106679
08:31:53.304 → 3ffff9a0: 000000b8 3fff1160 feefeffe 40106679
08:31:53.304 → 3ffff9b0: 000000ea 3fff1160 3fffc258 40106679
08:31:53.304 → 3ffff9c0: 00000086 3fff0b60 00000000 40106679
08:31:53.304 → 3ffff9d0: 00000066 3fff1360 00000000 00000020
08:31:53.304 → 3ffff9e0: 40106a45 00000000 00000000 00000020
08:31:53.304 → 3ffff9f0: 40106a45 00000000 00000000 40106a34
08:31:53.304 → 3ffffa00: e003702c 40218f77 00000018 00000022
08:31:53.304 → 3ffffa10: 3fffc200 40106974 3fffc258 3fff1da4
08:31:53.304 → 3ffffa20: 00000030 00000030 00000000 40100579
08:31:53.304 → 3ffffa30: 40000ea6 40218f77 00000018 fffffffe
08:31:53.304 → 3ffffa40: 40000ea3 00000000 00000001 3fff4a08
08:31:53.304 → 3ffffa50: 00000000 0000001f 3fff1b9c 3fff4a08
08:31:53.304 → 3ffffa60: 00000030 3ffffac0 3ffffac0 40218f77
08:31:53.304 → 3ffffa70: 3fff49d4 0000002a 3ffffac0 40218fc3
08:31:53.304 → 3ffffa80: 00000000 3ffffd10 3ffffac0 40218ff5
08:31:53.304 → 3ffffa90: 3ffffac0 3ffffd10 3ffffac0 40219042
08:31:53.304 → 3ffffaa0: 3fff49d4 3ffffd10 3fff49d4 3fff4a08
08:31:53.304 → 3ffffab0: 00000000 3ffffd10 3fff49d4 402130a8
08:31:53.304 → 3ffffac0: 3fff4adc 0000002f 0000002a 65727574
08:31:53.304 → 3ffffad0: 2e313a22 68222c31 64696d75 22797469
08:31:53.304 → 3ffffae0: 00000000 00000000 00000020 40100f22
08:31:53.304 → 3ffffaf0: 3ffea7e0 40104304 3ffee090 3ffe978b
08:31:53.304 → 3ffffb00: 00000001 40103523 3ffee960 40100f22
08:31:53.304 → 3ffffb10: 40103986 40104304 3ffee090 40101e0e
08:31:53.304 → 3ffffb20: 00000001 40103523 3ffee960 40106679
08:31:53.304 → 3ffffb30: 00000072 3fff1360 7fffffff 00000000
08:31:53.304 → 3ffffb40: 0000013f 40103266 00040000 00000020
08:31:53.304 → 3ffffb50: 40106a45 00000000 00000000 40106a34
08:31:53.304 → 3ffffb60: e003702d 15250a59 00000000 00000020
08:31:53.304 → 3ffffb70: 40106a45 00000000 00000000 40106679
08:31:53.304 → 3ffffb80: 00000068 3fff1360 3fffc258 4000050c
08:31:53.304 → 3ffffb90: 40103269 00040000 7fffffff 00000000
08:31:53.304 → 3ffffba0: 00000022 40103266 00040000 40106a34
08:31:53.304 → 3ffffbb0: 3ffee960 40102192 00000000 fffffffe
08:31:53.304 → 3ffffbc0: 000002c0 3fffc6fc 50510000 4000050c
08:31:53.304 → 3ffffbd0: 3fffc278 40101fe8 3fffc200 00000022
08:31:53.304 → 3ffffbe0: 3ffffbf0 00000030 00000010 ffffffff
08:31:53.304 → 3ffffbf0: 40212b1d 00000030 00000010 ffffffff
08:31:53.304 → 3ffffc00: 40212daa 00000000 00000006 00000000
08:31:53.304 → 3ffffc10: 00004bc6 00000000 00000000 fffffffe
08:31:53.304 → 3ffffc20: 000002c0 3fffc6fc 00000000 3fff00b0
08:31:53.304 → 3ffffc30: 00000001 00056dbf 3fff1c5c 00000030
08:31:53.304 → 3ffffc40: e003702d 3ffeb090 00000000 00000020
08:31:53.304 → 3ffffc50: 40106a45 00000000 00000000 00000022
08:31:53.304 → 3ffffc60: 3fffc200 40106974 3fffc258 4000050c
08:31:53.304 → 3ffffc70: 40215fdf 00000030 00000010 ffffffff
08:31:53.304 → 3ffffc80: 40216621 3ffffd90 00000006 00000000
08:31:53.304 → 3ffffc90: 00004bc6 00000000 00000000 fffffffe
08:31:53.304 → 3ffffca0: 00000000 3ffffcd0 00000001 4021249c
08:31:53.304 → 3ffffcb0: 00000000 00000000 4bc6a7f0 40212028
08:31:53.304 → 3ffffcc0: 3fff487c 0000000f 0000000f 40212548
08:31:53.304 → 3ffffcd0: 00000000 3fff4a08 3fff1c5c 00000030
08:31:53.304 → 3ffffce0: 00056dbf 00000001 3fff00b0 3fff00ea
08:31:53.304 → 3ffffcf0: 3fff4a28 3fff00c0 3ffffd10 40213282
08:31:53.304 → 3ffffd00: 4021a210 3ffffd10 00000200 00000028
08:31:53.304 → 3ffffd10: 3ffffd00 3ffffd18 3ffffd28 3fff49cc
08:31:53.304 → 3ffffd20: 00000002 3fff49d4 00000000 3fff49ff
08:31:53.304 → 3ffffd30: 00000002 3fff4a08 0000001f fffffffe
08:31:53.304 → 3ffffd40: 00000000 00000000 00000002 40106679
08:31:53.304 → 3ffffd50: 0000006a 3fff1360 0000001f 40104bfd
08:31:53.304 → 3ffffd60: 00000005 00000000 00000020 00000020
08:31:53.304 → 3ffffd70: 40106a45 00000000 00000000 40106a34
08:31:53.304 → 3ffffd80: e003702c 00000001 3fff0088 40216621
08:31:53.304 → 3ffffd90: 00007fff 1534b590 3ffeec58 40106679
08:31:53.304 → 3ffffda0: 00000054 3fff1360 3fffc258 4000050c
08:31:53.304 → 3ffffdb0: 4000dd31 00000030 00000010 40106679
08:31:53.304 → 3ffffdc0: 00000128 3fff1360 00000000 40106a34
08:31:53.304 → 3ffffdd0: e003702c 126211f0 00000000 00000020
08:31:53.304 → 3ffffde0: 40106a45 00000000 00000000 40106a34
08:31:53.304 → 3ffffdf0: e003702d 40106974 3fffc258 4000050c
08:31:53.304 → 3ffffe00: 40214f62 00000030 00000010 00000022
08:31:53.304 → 3ffffe10: 3fffc200 40106974 3fffc258 4000050c
08:31:53.304 → 3ffffe20: 402191f4 00000030MQTT connection…