thingsboard-client-sdk
thingsboard-client-sdk copied to clipboard
how to make the rpc call example to work with nodemcu
Hello guys. i have a nodemcu that i want to connect to the thingsboard cloud and use the switch widget. when i try to upload the 0002-arduino_rpc.ino sketch on the a Arduino it compiles correctly but when i try to change the board to nodemcu it gives me this error
In file included from C:\Users\hoovd\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266/Arduino.h:29:0, from sketch\switch_with_new_library.ino.cpp:1: C:\Users\hoovd\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h: In instantiation of 'void ThingsBoardSized<PayloadSize, MaxFieldsAmt, Logger>::process_message(char*, uint8_t*, unsigned int) [with unsigned int PayloadSize = 64u; unsigned int MaxFieldsAmt = 8u; Logger = ThingsBoardDefaultLogger; uint8_t = unsigned char]': C:\Users\hoovd\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:387:5: required from 'static void ThingsBoardSized<PayloadSize, MaxFieldsAmt, Logger>::on_message(char*, uint8_t*, unsigned int) [with unsigned int PayloadSize = 64u; unsigned int MaxFieldsAmt = 8u; Logger = ThingsBoardDefaultLogger; uint8_t = unsigned char]' C:\Users\hoovd\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:247:5: required from 'bool ThingsBoardSized<PayloadSize, MaxFieldsAmt, Logger>::RPC_Subscribe(const RPC_Callback*, size_t) [with unsigned int PayloadSize = 64u; unsigned int MaxFieldsAmt = 8u; Logger = ThingsBoardDefaultLogger; size_t = unsigned int]' C:\Users\hoovd\Documents\Arduino\ThingsBoard\switch_with_new_library\switch_with_new_library.ino:145:52: required from here C:\Users\hoovd\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:329:16: error: return-statement with a value, in function returning 'void' [-fpermissive] return false; ^ C:\Users\hoovd\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:334:16: error: return-statement with a value, in function returning 'void' [-fpermissive] return false; ^ exit status 1 Error compiling for board NodeMCU 1.0 (ESP-12E Module).
Could someone tell me how to edit my code to work with my nodemcu?
Same issue here. The compilation goes well if the board is Arduino but not for ESP8266. I try using a separate connection from the thingsboard with pubsubclient just for RPC, it works but then it keeps reconnecting from time to time.
Correcting myself, I download this library and replace on Arduino IDE libraries then I was able to compile for NodeMCU.
Fixed.