(SYSTEM_MODE(AUTOMATIC)); for Gateway & Electron


#1

What is the effect of using SYSTEM_MODE(AUTOMATIC) with a Gateway and an Electron?

I have 3 Bluz units connected to a Gateway equipped with an Electron. I want to retain the capability of changing some variables on the Bluz units (via Particle Functions on the Bluz firmware) using my phone ONLY if I am in the vicinity of the Bluz units. However, I do not want this to cause the Electron to connect to the cloud (for reducing data usage).

I would appreciate your input on the best way of accomplishing this?


#2

I am not sure the two are tied together.

SYSTEM_MODE(AUTOMATIC) just means that the device will automatically connect to the cloud.

However, when you say “change variables using your phone ONLY when you are in the vicinity of bluz units” that means that you are detecting proximity to each bluz device. That can only be achieved when they are not connected. If you want to change variables only when the phone is nearby, and hence in range to connect, then it would be easiest to use local communication with the phone, or have it act as a gateway. That way you don’t need the Electron at all, and you can detect proximity to the devices easily from the phone.


#3

Thank you @eric.

My question was not articulated well.

In my setup, I have 3 Bluz units connected to an Electron gateway. If the firmware running on the Bluz does NOT contain any Particle.Publish statements (only Particle varibales and functions), it is OK then to have (SYSTEM_MODE(AUTOMATIC)); without the Electron connecting the Bluz units to the cloud?

To save on data, I do not want the Bluz units to connect directly to the cloud. (I am familiar with including this statement gateway.set_ble_local(true); on the Electron acting as Gateway).

This way if I need to change any variables (via Particle functions on the Bluz), I can just use my phone to connect when I am in the vicinity? This will be done infrequently …


#4

In order to use any of the Particle commands, including variables and functions, you must have a connection to the cloud.

The only other way would be to have the Electron have variables and functions which you could call, and then it polls the bluz devices. This would be harder with variables, but you could have a function that fetches the value from bluz and then stores them in a variable, and then retrieve that.

Would that work for your use case?


#5

Thanks @eric. Yes, this would indeed also work fine but will complicate the code as I do not know how to receive and parse data sent by the Electron as I am not a C programmer.

I understand that Particle variables and functions would only work through the cloud. What I meant to say is if those Bluz units have Particle functions in their firmware but are only using BLE to connect to the Electron Gateway, would these Particle variables cause the Electron to automatically connect to the cloud (which I do not want)? Or will these statements just be ignored since there is no cloud connection …


#6

They will be ignored. Each device explicitly controls it’s own cloud connection through the system mode, so one device can’t force another to connect