Bluz goes offline randomly


I have been using Bluz in a door project since December and it has been working great. Not long after I ported the project from a Particle Core to Bluz I also created Home Assistant integration and started using that. After I enabled polling (for state checking) in Home Assistant I have issues where the Bluz goes offline multiple times a day. I keep track of this by using IFTTT to send me an alert when it goes offline. I shouldn’t be hitting any maximums because Home Assistant only polls every 30 seconds (two separate polls though). This morning I woke up to 6 IFTTT alerts of the Bluz going offline. What could be the reason for this?


Which gateway solution are you using? And is the firmware up to date on both your DK and the gateway? How many other DKs (if any) are hooked to the same gateway?

One thing to check for is if the gateway goes offline as well. This could happen if the back-end WiFi isn’t working as expected.

When you say you poll every 30 seconds, what does that mean? Are you checking a variable on bluz? Would it be possible to separate these two simultaneous polls?

You should also check that your code doesn’t block in anyway, this could cause issues with cloud connectivity. If there is any polling happening that can take a long time, or long delay() calls, this can cause issues where bluz could go offline.

Let me know if any of that helps or if you still see the issue.


I haven’t updated in two months or so, I don’t think it is a firmware thing. I will add an alert for the gateway too.

Home Assistant is running a function that is just checking a variable on Bluz, yes. The two polls are separate and don’t necessarily happen at the same exact time.

There is no blocking code or any delays.

Home Assistant - Particle integration

It will be interesting to see if the gateway is disconnecting. If that happens, it will reconnect bluz DK’s connected to it as well, so that could certainly cause the issue. What gateway are you using?

From reading the initial description, this was a project you have had running since last December. Then it started having issues sometime later? So was it working for a long time and then adding the Home Assistant check is what started causing the disconnects?


I am using a Photon with the Gateway Sheild.

Initially I had my own little web gui front end for the service. Then I moved over to Home Assistant and when I turned on polling in my implementation that is when I started seeing these offline notifications.

I just created an IFTTT notification for when the Bluz Gateway goes offline (not the Photon itself).


Just got a notification this morning. The gateway and the Bluz went offline around the same time.


Received two after this today that did not show the gateway going offline.


Interesting. Bluz should really only reconnect to the cloud if the BLE connection is somehow interrupted or if the back-end connection drops. I can’t think of a reason why adding polling would cause either of those, but I wonder if it somehow revealed the problem instead of causing it.

I will try and setup some polling testing here to see if I can recreate the issue and see if we can isolate what the problem might be.


Ok, sounds good. Let me know if you need anything from me.


Sorry for the delay on this, but I have been doing some testing.

I setup a DK on a bluz gateway and let it run for a few days. Then I started polling a variable once every 60 seconds, ran that for a few days. Then I started polling the variable twice, immediately back-to-back, waited 20 seconds, polled it back-to-back again, and did this once every minute as well. I had an IFTTT trigger to text me if the device went offline.

In that entire time, I have seen two disconnects of the DK, and they seem utterly random. In fact, both times the DK went offline, a number of other Photons in my house went offline at the same time. I have some setup for various tasks, and noticed their last handshake times are all the same in the Particle dashboard. This leads me to believe they were caused by a hiccup in my home router or my back-end internet connection.

So I can’t seem to reproduce the issue. Have you noticed any difference? Is it possible it is a WiFi or internet issue? Do you see other WiFi devices go offline around the same time?

The only part I probably didn’t reproduce was two simultaneous polls of a variable, but that cloud should queue them up and it should be the same as polling back-to-back. I don’t think that would make a difference, but perhaps it could.


It is the same sporadic issue. I wake up every morning to a bunch of IFTTT offline notifications and get them randomly through the day. Randomly when I get a notification I’ll immediately go and do a live poll to the DK through Home Assistant and I can never catch it actually offline, so the window must be very small. I never have issues with other wifi devices. I’d imagine that if it was a wifi issue I’d get a notification for both the gateway and the DK constantly and that doesn’t happen often. I could also try to monitor the Photon (one used for the gateway) itself and see what that yields. I can also temporarily turn off polling in Home Assistant to verify that is directly related to polling.