Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes payload are mixed up with topic. #1027

Open
ElectApp opened this issue Sep 2, 2023 · 3 comments
Open

Sometimes payload are mixed up with topic. #1027

ElectApp opened this issue Sep 2, 2023 · 3 comments

Comments

@ElectApp
Copy link

ElectApp commented Sep 2, 2023

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
Copy link

same here.

anyone a solution?

@wagfeliz
Copy link

I am also having something that maybe its the same of this problem. In my case the message gets deliver with diferrent length of bytes. It seems to happen if you use bytes and low amount of data, maybe something wrong with the MQTT_MAX_HEADER_SIZE...

@wagfeliz
Copy link

Something I notice, depending of the content in bytes of the message, the size of the delivery changes, example, if I send 23 bytes of 1, it will publish 40 bytes, if I publish 23 bytes of 200, it will publish 21 bytes.
If I publish 1 byte of anything, its crashing and dont send anything, in my case the esp32... very weard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants