Mqtt json publish don't work on my sonoff bridge rf

In User_config.h i have
#define jsonPublishing true
#define simplePublishing true

When i press button A radio command in serial monitor i can see this (note the json string is correct)

Creating SRFB buffer
isAduplicate?
Adv data SRFBtoMQTT
Pub json into:
home/OpenMQTTGateway001/SRFBtoMQTT
{“raw”:“1E3C00F002EE7E42E2”,“value”:“8274658”,“delay”:“7740”,“val_Thigh”:“240”,“val_Tlow”:“750”}
Pub data per topic
raw
1E3C00F002EE7E42E2
value
8274658
delay
7740
val_Thigh
240
val_Tlow
750
[RFBRIDGE] Sending ACK

In terminal mosquitto i see only simplePublishing like this but nothing in format json

home/OpenMQTTGateway001/SRFBtoMQTT/raw 1E3C00F002EE7E42E2
home/OpenMQTTGateway001/SRFBtoMQTT/value 8274658
home/OpenMQTTGateway001/SRFBtoMQTT/delay 7740
home/OpenMQTTGateway001/SRFBtoMQTT/val_Thigh 240
home/OpenMQTTGateway001/SRFBtoMQTT/val_Tlow 750

I need json because single is not usable like this.
raw is identity off Button A of my radio command ok but
home/OpenMQTTGateway001/SRFBtoMQTT/value 8274658 can be value for Button B or other

Single topic must be like this i think
home/OpenMQTTGateway001/SRFBtoMQTT/1E3C00F002EE7E42E2/raw 1E3C00F002EE7E42E2
home/OpenMQTTGateway001/SRFBtoMQTT/1E3C00F002EE7E42E2/value 8274658
home/OpenMQTTGateway001/SRFBtoMQTT/1E3C00F002EE7E42E2/val_Thigh 240
home/OpenMQTTGateway001/SRFBtoMQTT/1E3C00F002EE7E42E2/val_Tlow 750

Can you tell me what i need to make for json work or why single topic is not good.

thank’s by adance and sorry for my very bad english

**Ps: **
openmqttgateway 0.9 beta
**I use library **
ArduinoJson by Benoit Blanchon Version 5.13.3 INSTALLED
PubSubClient by Nick O’Leary Version 2.7.0 INSTALLED

Hello,

try to modify in pubsubclient.h:
#define MQTT_MAX_PACKET_SIZE 1024

When i search pubsubclient.h i have see i have 4 pubsubclient.h in different directory
I’m not a confirm user of ide arduino and i don’t know how compilation make priority with library then
I have deleted all libraries in directory in my /home/fran6t/Arduino/libraries
I copy paste all library of your project directory lib
Then i build and upload
And victory it’s works without modification of pubsubclient.h
home/OpenMQTTGateway001/SRFBtoMQTT {“raw”:“1E5000FA02EE7E42E2”,“value”:“8274658”,“delay”:“7760”,“val_Thigh”:“250”,“val_Tlow”:“750”}

In your lib/PubSubClient (version 2.6)
#define MQTT_MAX_PACKET_SIZE 512

In IDE arduino stable PubSubClient (version 2.7)
#define MQTT_MAX_PACKET_SIZE 128

I change in 2.7 128 by 512

All it work.

Many Many thank’s for your help and for your job

with pleasure have fun with omg

1 Like