Github Devices Community Docs Blog

OMG 0.9.2 ESP32 + Pilight

I have compiled 0.9.2 for Pilight and I am struggling to understand how to get things running for a KAKU type of switch

When using the remote to switch on, OMG senses the following (via serial):

Creating RF PiLight buffer
Pub json into:
home/OMG_Pilight/PilighttoMQTT
{"message":{"id":3028992,"unit":1,"state":"on"},"protocol":"arctech_switch","length":"3028992","repeats":2,"status":2}
Pub data per topic
protocol
arctech_switch
length
3028992
repeats
2
status
2
Creating RF PiLight buffer
Pub json into:
home/OMG_Pilight/PilighttoMQTT
{"message":{"id":3028992,"unit":1,"state":"up"},"protocol":"arctech_screen","length":"3028992","repeats":2,"status":2}
Pub data per topic
protocol
arctech_screen
length
3028992
repeats
2
status
2
Creating RF PiLight buffer
Pub json into:
home/OMG_Pilight/PilighttoMQTT
{"message":{"id":3028992,"unit":1,"state":"on"},"protocol":"arctech_dimmer","length":"3028992","repeats":2,"status":2}
Pub data per topic
protocol
arctech_dimmer
length
3028992
repeats
2
status
2
Creating RF PiLight buffer
Pub json into:
home/OMG_Pilight/PilighttoMQTT
{"message":{"id":3028992,"unit":1,"state":"opened"},"protocol":"arctech_contact","length":"3028992","repeats":2,"status":2}
Pub data per topic
protocol
arctech_contact
length
3028992
repeats
2
status
2

To convert MQTT to RF I do the following in HiveMQ:
image

Via serial I read the following:

Hey I got a callback 
MQTTtoPilight json data analysis
MQTTtoPilight failed json read
protocol is not available

Any clue? I am not quite familiar with json (maybe that is the problem).

Hello,

You have to use the following commands type (different from what you receive) to make it works:

Thanks for the quick reply!:+1:

I assumed that a copy of the same message into the home/OMG_Pilight/commands/MQTTtoPilight topic would be sufficient. Which is not. The differences were easily overlooked:

  • The message needs to be put between quotation marks and consequentely inside the message you need to use the escape character \ before any quotation mark. So the format "message":{"id":3028992}, that was read from the terminal must reformatted into "message":"{\"id\":3028992}",
  • "state":"on" must be reworked into "on":1

And then it worked for me! Final complete message:

{"message":"{\"id\":3028992,\"unit\":1,\"on\":1}","protocol":"arctech_switch","length":"3028992","repeats":2,"status":2}

Confusing part for me was that in your reference, the escape characters are shown both in the terminal as well as in the transmitted command. In my terminal these escape chars did not show up.

Thanks again!

1 Like