knolleary / pubsubclient

A client library for the Arduino Ethernet Shield that provides support for MQTT.
http://pubsubclient.knolleary.net/
MIT License
3.78k stars 1.46k forks source link

Sometimes payload are mixed up with topic. #1027

Open ElectApp opened 10 months ago

ElectApp commented 10 months ago

I use esp8266 to read values from an electricity meter and publish the data on MQTT in json format with PubSubClient library. When working for a long period of time, sometimes the data is incorrect, as shown in the example.

Topic: application/24ff957f-c99e-4f15-ade2-f6ed792a1186/device/24e124468c481581/event/status

Example of the correct payload: {"app_id":"24ff957f-c99e-4f15-ade2-f6ed792a1186","model":"PM3PRL","device_id":"PM3PRL-24E124468C481581-131","devEui":"24e124468c481581","slave_id":131,"time":"2023-09-02 16:18:06","error":0,"log":[{"key":"V_RMS_A","val":233.1},{"key":"I_RMS_A","val":0.0},{"key":"P_A","val": 0},{"key":"Q_A","val": 0},{"key":"S_A","val": 0},{"key":"PF_A","val":0.000},{"key":"WH_A","val":294624},{"key":"Freq_A","val":50.0},{"key":"Op_St","val":21},{"key":"V_RMS_B","val":233.9},{"key":"I_RMS_B","val":0.0},{"key":"P_B","val": 0},{"key":"Q_B","val": 0},{"key":"S_B","val": 0},{"key":"PF_B","val":0.000},{"key":"WH_B","val":1397},{"key":"Freq_B","val":50.5},{"key":"V_RMS_C","val":234.1},{"key":"I_RMS_C","val":0.0},{"key":"P_C","val": 0},{"key":"Q_C","val": 0},{"key":"S_C","val": 0},{"key":"PF_C","val":0.000},{"key":"WH_C","val":21420},{"key":"Freq_C","val":50.0},{"key":"SoftV","val":231}]}

Example of a payload during a problem: {"app_id":"24ff957f-c99e-4f15-ade2-f6ed792a1186","model":"PM3PRL","device_id":"PM3PRL-24E124468C481581-131","devEui":"24e124468c481581","slave_id":131,"time":"2023-09-02 16:17:37","error":0,"log":[{"key":"V_RMS_A","val":232.8},{"key":0�Uapplication/24ff957f-c99e-4f15-ade2-f6ed792a1186/device/24e124468c481581/event/status{"app_id":"24ff957f-c99e-4f15-ade2-f6ed792a1186","model":"PM3PRL","device_id":"PM3PRL-24E124468C481581-133","devEui":"24e124468c481581","slave_id":133,"time":"2023-09-02 16:17:48","error":0,"log":[{"key":"V_RMS_A","val":234.6},{"key":"I_RMS_A","val":0.4},{"key":"P_A","val":98},{"key":"Q_A","val":15},{"key":"S_A","val":99},{"key":"PF_A","val":0.987},{"key":"WH_A","val":85564},{"key":"Freq_A","val":50.0},{"key":"Op_St","val":21},{"key":"V_RMS_B","val":234.5},{"key":"I_RMS_B","val":0.0},{"key":"P_B","val": 0},{"key":"Q_B","val": 0},{"key":"S_B","val

This problem occurs in MQTT broker or libraries?

softwarecrash commented 9 months ago

same here.

anyone a solution?