Device keeps on disconnecting and re-connecting to Rainmaker via MQTT

djorr5
Posts: 16
Joined: Fri Nov 17, 2023 4:12 am

Device keeps on disconnecting and re-connecting to Rainmaker via MQTT

Postby djorr5 » Mon Sep 23, 2024 7:01 am

Hi All,

Have a strange one but I have flashed a board with custom firmware using the Rainmake zigbee gateway example as a base. I can succesfully claim the device and get it enrolled into my dashboard with everything working well. However throughout the day the board will disconnect and then reconnect a couple of seconds later. In the Rainmaker app under notifications I see hundreds of offline then online messages. The device reconnects within random times of 2 - 80 seconds. I doubt it is the wifi strength issue as I have it transmitting data back to insights and RSSI normally sits at about -40db and when the errors happen there is no difference in RSSI at that time. Also in the same location I had it running as a Zigbee coordinator sending MQTT packets back to a Mosquitto broker without any issues.

Is there some kind of session setting with the Rainmaker MQTT broker that I need to tweek to stop it reporting online offline messages randomly?

I am getting the attached error messages through Insights, not sure why it thinks I haven't uploaded a firmware package but I have uploaded the latest ZIP that is flashed on the device.
Attachments
Screenshot 2024-09-23 165313.png
Screenshot 2024-09-23 165313.png (220.17 KiB) Viewed 2251 times

ESP_Vikram
Posts: 25
Joined: Fri Nov 23, 2018 12:07 pm

Re: Device keeps on disconnecting and re-connecting to Rainmaker via MQTT

Postby ESP_Vikram » Mon Sep 23, 2024 12:29 pm

Hi @djorr5,

From logs, as you have observed, it seems the device is getting connected and then disconnected frequently. The Insights logs however, are not much useful.

- Does the raw example(without any custom changes) work as expected?
- Can you please share more context: IDF version used, the chipset used?
- Can you check if you have by mistake flashed the same certificates on multiple devices? If so, only one device can be active at the same time.

Now the Insights logs not getting resolved case:
If you've the IDF >= 5.2, there is a bug in the Insights sha reporting for latest IDFs, which manifests backend into not getting match for the firmware and hence logs not getting resolved.
You may find the discussion and a fix being discussed here:
https://github.com/espressif/esp-insights/issues/45
https://github.com/espressif/esp-insights/pull/47

If you have the IDF version >= release/v5.2, do try the fixes discussed above and share the resolved logs.

djorr5
Posts: 16
Joined: Fri Nov 17, 2023 4:12 am

Re: Device keeps on disconnecting and re-connecting to Rainmaker via MQTT

Postby djorr5 » Sun Sep 29, 2024 11:25 pm

Hey, thanks for the reply and info on Insights issue. I have rectified as per the post and now get correct error messages. To give you more details about the setup:

Using ESP32S3 on a custom board connected via UART to a H2 for Zigbee and this has worked well when I configured it as a Zigbee coordinator using only the ESP Zigbee SDK talking to HA via MQTT.

I am using IDF 5.3 as I was getting build errors with 5.4 and managed to resolve it by using 5.3 instead.

There shouldn't be the same certificates on more than 1 board, but I have flashed the same code to 2 different boards whilst developing. One I used assisted claiming and the other I used the CLI to claim for admin rights and another account to claim via the Rainmaker app. Is there a way to check in the dashboard which certificates are being used? I currently only have 1 board online anyway.

After updating the settings I now get the logs in Insight. Looking at the logs it shows:


The other thing I have noticed is that it stops updating Insights after a certain number of days.

Update: I reflashed the board on the 29th and so far haven't had any offline messages. I am wondering if it fails once I bring another board online. Wouldn't a different certificate get provisioned to the board based on claiming? I am not using my own certificates.
Attachments
Screenshot 2024-09-30 091510.png
Screenshot 2024-09-30 091510.png (291.55 KiB) Viewed 1918 times

djorr5
Posts: 16
Joined: Fri Nov 17, 2023 4:12 am

Re: Device keeps on disconnecting and re-connecting to Rainmaker via MQTT

Postby djorr5 » Mon Oct 14, 2024 12:11 am

So after working without issues for a week it suddenly starts disconnecting and reconnecting again. I had over 60 disconnect and reconnects early on the 12th October. Nothing shows up in Insights though, it is only notifications to the App. No changes to code, no changes to network infrastructure and the amount of data being transferred is very minimal. Any idea what could be going on?

I have connected a laptop to it in situ and as I have re-powered the device it has stopped with the disconnect re-connect messages for now. Will have a look at the logs as soon as it starts up again.

Who is online

Users browsing this forum: No registered users and 32 guests