Open maheru8 opened 7 hours ago
The output is only weird, because you print out non-terminated strings like it is a null-terminated string. If you measure the characters you can see that {"heatingTemp":21}
has indeed a size of 18.
So the received data is corect and works as expected.
Which version of the library are you using, because a similair issue has been fixed previously and additionally can you enable THINGSBOARD_ENABLE_DEBUG
on the top of your main.cpp file instead of a local file in the library, because you currently only enable debug mode for that specific file instead of the whole library.
I use this versions:
dependencies:
bblanchon/arduinojson:
component_hash: 463812931f99cb7a554d64311288f537b43daaca3eed2427557b907af393447c
dependencies: []
source:
registry_url: https://components.espressif.com
type: service
version: 6.21.5
idf:
source:
type: idf
version: 5.3.1
thingsboard/thingsboard:
component_hash: 9ad01bde84b322c01f36e1d3f6bb036cc86acac58c87a7f4a43328ced240fd3e
dependencies:
- name: idf
registry_url: https://components.espressif.com
require: private
version: '*'
- name: bblanchon/arduinojson
registry_url: https://components.espressif.com
require: private
version: ^6.21.5
source:
registry_url: https://components.espressif.com/
type: service
version: 0.14.0
direct_dependencies:
- idf
- thingsboard/thingsboard
manifest_hash: fd7c1ec86f2e90e5e2b8e58fe6a6a0381e8c7d159a11ff3cb5c788a510af4ef6
target: esp32s3
version: 2.0.0
Using example named "0017-espressif_esp32_process_shared_attribute_update", which is available on ESP Component Registry under Examples, I can't get my shared attributes when I update them on thingsboard. I have THINGSBOARD_ENABLE_DEBUG enabled on top of my main.cpp and I can see in debug log that attributes are received on MQTT socket using this example script, but my callback function is never called so I didn't receive any parameters in my main code. After code change specified in my first comment everything worked.
I wasn't receiving shared attribute updates at all using demo code (with server, device key and variable names changed). When I turned on THINGSBOARD_ENABLE_DEBUG I saw weird lines in the log:
This is mqtt_event_handler from Espressif_MQTT_Client.h before: