Modify Standalone device for Gateway device

#1

Hi.

With a sensor network design, I started the platform with a device with the standalone configuration and now I would like to modify it to Gateway. Will there be any losses in the existing configurations with standalone? How do I transfer what I created for the new configuration? * What and how should I change it in my code (* Arduino * - XbeeCoordinator / Ethernet) for this?

Thank you for your attention.

#2

Switching a device from standalone to a gateway will not impact any other settings. In terms of your source code, the only difference between a standalone device and a gateway is that a gateway is permitted to report state on behalf of its peripherals.

When using MQTT, this just means it can publish to other peripheral’s state topics and subscribe to other peripherals’s command topics.

losant/gateway-device-id/state
losant/gateway-device-id/command

losant/peripheral-device-id/state
losant/peripheral-device-id/command

How a gateway connects to Losant is identical to how a standalone device connects.

1 Like
#3

Hi, Brandon.

I am not quite sure where I should identify my peripherals. My gateway is an Arduino and it is receiving data from the peripherals via XBee. When the data arrives at gateway, it uses this function to send the data to Losant.

void report(double humidity, double tempC, double tempF, double heatIndexC, double heatIndexF) {
  StaticJsonBuffer<500> jsonBuffer;
  JsonObject& root = jsonBuffer.createObject();
  root["humidity"] = humidity;
  root["tempC"] = tempC;
  root["tempF"] = tempF;
  root["heatIndexC"] = heatIndexC;
  root["heatIndexF"] = heatIndexF;
  device.sendState(root);
  Serial.println("Reported!");
}

Where I should identify my peripherals?