AVSystem / Anjay-esp32-client

Anjay ESP-32 LwM2M client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Communication with Thingsboard IOT dashboard.

AirWind001 opened this issue · comments

Hello,
I followed your instructions and was able to set up the communication with the coiote IOT dashboard. Now I want to set it up with a local instance of thingsboard with PSK on port 5686 ( DTLS port of thingsboard lwm2m) but I am getting the following error on the esp32.
esp error
eager to hear from you.
thanks

Hi!
Looking at the error code it seems that operation timed out: https://tls.mbed.org/api/ssl_8h.html#a2fdb240812860402a1a946eae8264148
If you were able to connect to coiote using same aplication, client has to be working. Please check if there is a connection between client and serwer and it is not blocked by firewalls or other blockers.

Thanks for the reply.
I'm running thingsboard IOT dashboard locally on an RPi and it doesn't have any firewall by default. To test the network I have simulated a client using wakaama git and there is no network issue there.
image
could this problem be side stepped by creating a client without PSK security? when I try this configuration:
image
it gives the following error and goes into a boot loop:
image

Also, could you please tell me how you checked the error code from the website that you linked (https://tls.mbed.org/api/ssl_8h.html#a2fdb240812860402a1a946eae8264148) It would help me a lot in the future to debug
Thanks

If you want to use nosec, you have to change it manually in code here:
https://github.com/AVSystem/Anjay-esp32-client/blob/main/main/main.c#L61
To use ANJAY_SECURITY_NOSEC mode.
It will also timeout if you provide wrong security configuration, which can be a case here

Regarding mbedtls error, you can find it in the log: -26624 which converts to hexadecimal and can be found on mbedtls page

Thanks for the reply.
when i change it to NOSEC it works. After doing some more testing i can say PSK doesn't work with thingsboard because:

  1. Thingsboard requires the PSK key to be in hexadecimal format. is this possible and if so can you please tell me how?
  2. Thingsboard requires the PSK key to be at least 128 bits long. Does the esp32 support uint128_t?
  1. We have not used thingsboard but it seems that it should be just plain text hexadecimal - for example "0123456789ABCDEF0123456789ABCDEF" you can set it same way as just plain text psk
  2. 128 bits long means at least 4 bytes -> 4 characters, same requirement is with coiote server

Sorry for the late reply,
I'm still facing the same issue with PSK configuration. Any help is very much appreciated.
here is the configuration of the device on thingsboard
image
here is the client configuration on the esp
image
I still get the same handshake timeout error in the terminal window
esp debug timeout
esp-client NOSEC with thingsboard works. wakaama test client (using dtls) with thingsboard works

Hi, it seems that thingsboards requires hexlified, while we use plain text, you can provide in the client psk for example "test", then conver it to hex form (by using i.e. https://www.convertstring.com/EncodeDecode/HexEncode) "74657374" and use it on thingsboard

Let me know if this helped

Hi, I chose the string as:
convertstring32a
and converted it to hex which came out to be
636F6E76657274737472696E67333261
I entered the hex code in the tb dashboard and the plain text key in the esp config and it works.
Thanks a lot for you help

Just noticed it, was on vacation before, great to hear that!