Installing the Gateway Software on a Raspberry Pi

This will run you through the process of installing the BrewMonday Gateway software on a Raspberry Pi and configuring it to work with your BrewMonday Account.
Typical time to complete this procedure is 5 - 10 minutes (not including software download time).
This is for connecting a bare-bones Raspberry Pi to WiFi.

Getting Started

What you'll need:
  • A Raspberry Pi 3 B+ with a power adapter and micro SD card (4GB or higher recommended). Pi 4 and Pi Zero coming shortly.
  • Balena Etcher (free) or other software to flash the Pi software to an SD card
  • Fing (free) or another app for finding the IP address of your Pi on your network.
Notice: The Raspberry Pi 3B+ is in short supply and support for the Pi Zero and Pi 4 is coming. The software is in the testing phase.
Insert your micro SD card into its adapter if necessary, then insert the card into your computer.
Open Balena Etcher (or another OS image flashing software of your choice) and flash the downloaded BrewMonday Gateway Software file ( file to your SD card.
Now, your computer may eject the SD card when it's finished. If so, take it out and plug it back in. A disk image called boot should be available on your desktop or in your list of devices.
To connect your Raspberry Pi to your WiFi network, create a new text file and save it with the filename: wpa_supplicant.conf
Put the following code in the file, replacing 'US' with your 2-digit country code from the list here, and your router's network SSID and PASSWORD respectively:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
You will need to save this file as a Unix (LF) text file. A good plain-text editor will allow you to save with Unix (LF) line breaks, but you will have to verify this on your own. If you're using Mac OS, TextEdit should do this by default, and on Windows double-check the format if you're using Notepad or another plain-text editor. Do not use a word processing program.
Copy the wpa_supplicant.conf file to your newly-created boot SD card image.
Eject the card, insert it into your Pi, then connect it to a power source.
Wait a minute or 2 for it to boot up, and if everything went smoothly, your Pi should now be connected to your network.
Now, we will need to obtain the IP address using an app like Fing or other WiFi device locator. Fing is free and available for iOS or Android.
Open Fing, refresh the list of devices and look for your Raspberry Pi on your network. If it doesn't show up, wait another minute or so then refresh the list again. It should look something like this:
Note the IP address — Yours will likely be different from the example above.
Open Terminal and type the following, replacing the IP address with your own:
You should get the following message:
The authenticity of host ' (' can't be established.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Type yes and hit return
The default password for Raspberry Pi is raspberry
Since SSH is enabled on your Pi you should change the password. Once logged into your Pi, type passwd to set a new password.
Next, let's log in to the BrewMonday app and go to Devices in the navigation menu. Your account comes with 2 devices already provisioned. If you're not already using one, select the device's gear icon and click the Edit button, else add a new device if there are none or they are in use.
Give the device a name and optionally a location name, like "Garage" or something, and make sure to select Raspberry Pi Gateway as the device type.
Keep this screen handy so you can copy the Device Id and Auth Key for the next step.
Next, back in the Terminal, we'll run a script to inject your Device Id and Auth Key into the device. The command is: bm-set-creds <device-id> <auth-key> replacing <device-id> and <auth-key> with your credentials from the 'Edit Device' screen in the BrewMonday app. The command should look like this:
bm-set-creds 00000000000000000000000000000000 11111111111111111111111111111111
Note the single spaces and make sure it looks good before hitting <enter>.
Restart the daemon using sudo systemctl restart avmsagwd and verify it comes back up using systemctl status avmsagwd. Your gateway should now be ready to send data.
Back in the BrewMonday app, make sure to select Raspberry Pi Gateway as the device type then click "Save" to save the changes if you haven't done so already.