beegee-tokyo / SX126x-Arduino

Arduino library to use Semtech SX126x LoRa chips and modules to communicate
MIT License
236 stars 64 forks source link

How to change Chirpstack servers seamlessly to field nodes #115

Closed gabrielbravov closed 10 months ago

gabrielbravov commented 10 months ago

Hello friends,

I have a need that i can’t to solve alone.

We have a Chirpstack server running in production environment and if i need to change the servers for any reasons, we need to reset the field nodes to make a new Join Session with new devaddress.

¿it’s there any function or way to reconnect to Lora and recieve a new devaddress when i change the server? I need to solve that for failover reasons, to make my network more robust.

I’m using wisblock boxes with RAK4630 inside and using Arduino Framework with SX126x-Arduino library from Begee-Tokyo.

I tried with “lmh_join();” before to send any message but doesnt works. I too tried with “int8_t loraInitResult = initLoRaWan();” before to send all my messages but neither worked it.

EDIT: To add more information, if i power off the Chirpstack server and then i power up the same server, the field nodes still can to connect to Chirpstack and send messages (because they're using the same Join Session or DevAddress), but if i power off the Server and power up another server in the same ip, the field nodes cant to communicate with the new server, i think that happens because the Join Session or DevAddress it's registered in the old server that it's powered off.

beegee-tokyo commented 10 months ago

When staying with OTAA as join method, I see only one solution. Use a confirmed packet send every now and then to check whether the connection to the LNS is still working. If there is no ACK received from the LNS for the confirmed packet, you can restart joining with lmh_join() or reset the device to perform a new join request.

If you can switch to ABP as join method, the device should be able to send to the new LNS if it is registered with the same keys there. (not tested).

Answered as well in the RAK forum