3.2. Hello World Part 2: Updating your snap with new features

3.2.1. Description

Learn how to update your application and use Rigado Edge Direct to deploy that update to your development gateway. We’ll walk through this tutorial with the Node.js Hello World snap you created in the previous tutorial.

The current version of the application connects to the first available Thingy. In a case where there is more than one device nearby and turned on, the application will connect to one at random.

In our case, we want to avoid this situation, and bind the application to a specific Thingy using the device’s MAC address.


Figure 3.5 Two Thingies. The green status light indicates the Thingy on the left is connected. The status light turned off completely indicates the Thingy on the right is turned off.

When you complete this tutorial, you will have the new version of your application running on the gateway.

Expected duration: 1 hour.

3.2.2. Prerequisites

3.2.3. Implementing the Changes

  1. Remove the rubber cover from the Thingy device.

  2. Find the Thingy MAC address on the white sticker next to the antenna.


    Figure 3.6 A Thingy with cover removed, showing the white sticker with the MAC address CF:AA:13:A1:5C:A5

  3. Edit the config.json file. Change the value of the deviceMAC property from "*" to the MAC address from the sticker. For the Thingy shown above, the new config.json should look like:

      "app": {
        "sendInterval": 2000,
        "loggingLevel": "INFO"
      "ble": {
        "hciDeviceNum": 0,
        "deviceMAC": "CF:AA:13:A1:5C:A5"
      "mqtt": {
        "host": "demo-mqtt.rigado.io",
        "port": 1883,
        "topic": "/gateway/{hostname}/sensors"
  4. Edit the snapcraft.yaml file. Change the value of the version property from "1.0.0" to "1.0.1":

    name: example-hello-world
    version: '1.0.1'
    summary: Nordic Thingy:52 + Node.js snap example

3.2.4. Release the new Snap version

  1. Upload modified sources to the Build Host. See Raspberry Pi’s guide for how to use scp to do this.

  2. Log in to the Build Host.

  3. Switch to Classic mode:

    $ sudo classic
  4. Update software packages

    $ sudo apt update && sudo apt upgrade
  5. Build the snap. Run in the project directory:

    $ snapcraft
    Snapping 'example-hello-world' /
    Snapped example-hello-world_1.0.1_armhf.snap
  6. Copy the snap file back to your Development Host (e.g. with scp)

  7. Switch to the Development Host

  8. Open the Apps page of Edge Direct.

  9. Select your app, and click the UPLOAD REVISION button.

  10. Upload the new snap file, and release it to the edge channel.

  11. You can monitor the update progress from the Gateways page.

3.2.5. Conclusion

You should be able to check the output via the MQTT web client to confirm the configuration was deployed. This strategy can be used to modify other configurations or even modify the behavior of the Node.js source. For example, you could modify the source to also send other sensor data such as gyroscope, temperature, or air quality data. See the next tutorial for deploying your own version of the Web Dashboard.