Provisioning and registering a CoFyBox requires a number of steps:
- Downloading a base image
- Registering a new device with Balena and recording the device details
- Uploading these device details to the CoFyCloud service
- Flashing the image to an SD card and installing it in a RaspberryPi
- Connecting the Pi to a network
The CoFy Box images are stored on ASW S3 and are pre-loaded with the latest
version of the CoFy Box software.
If provisioning your own SD card, you will need:
- A microSD card with at least 32 GB capacity
- A microSD card drive for your computer (built in or a USB one)
- Install Balena CLI (IMPORTANT: use the latest standalone version from Github)
- Install AWS S3 CLI (either package manager or AWS direct DL)
- Install jq (probably package manager)
- Install Balena Etcher
- A Balena Cloud account connected with the appropriate application.
- The base image or an AWS account with permissions to access the S3 bucket containing the images.
- Access to the CoFyCloud sandbox.
This folder contains the files and scripts used in HEMS provisioning which implement the provisioning flow.
¶ Download and register with Balena
If you already have an image you can start at step 4.
If creating a development device, download the image from Balena Dashboard using these steps instead (requires access to Cofyco Balena organisation).
- Clone or download the Cofybox-balena project
- Login to balena-cli with
sudo balena login
(if required)
- Run 1_download_sdimg.sh to download latest image (this only needs to be done once in any session).
- Run (with sudo) 2_prepare_sdimg.sh to create a new device on balena and generate an image for this device. The image will be named using the balena name e.g. happy-lion.img.
- The script will record the device details in the
devices.log
file. These details are used to register the device with the CoFyCloud.
- Open Balena Etcher and burn your new img from the
tmp/
folder to an SD card.
- If the image burn was successful, cleanup by removing the image that you have just burned.
- Repeat 4-6 if you need to burn more than one device.
- Device data is appended to devices.log (for making labels etc.).
¶ Raspberry Pi 3/4 and 32/64 bit
To select a different architecture edit ARCH_NAME
in the 1_download_sdimg.sh
script (default is RPI3-32bit).
Possible choices are:
- rapsberrypi3
- rapsberrypi3-64
- rapsberrypi4-64
- Log in to the Community Portal section of
https://app.cofybox.io
- Take the device details from the
devices.log
file generated above.
- Either upload the file, or individually register a device.
- Add the Balena device uuid (eg.
45b5050581d7489446cda2187058d33d
) as the Registration Token. Add the device name (eg. bitter-lake
) as the reference.
- Connect the CoFyBox to an internet connected router with an ethernet cable.
- Log into Balena Cloud to verify that the device is running and available under the correct Balena app.
- Log into the Community Portal section of
https://app.cofybox.io
and verify that the device status is a green tick.
Installation and Commissioning