Publishes the seawater levels from kartverket.no as custom devices on hello.nrfcloud.com/map.
This project serves as an example of how arbitrary device data can be visualized
on hello.nrfcloud.com/map by leveraging LwM2M data objects.
To describe the seawater level readings, the object
14230
has been registered in the
protocol repository.
In addition, the device has been described in the model definition
kartverket-vasstandsdata
in the same repository.
For each water level station (e.g. BGO or TRD) a device has been
registered.
Using the credentials created during the registration process, the code in this repository now connects to the API for water level data and fetches the most recent measurements.
The measurements are then converted to the LwM2M object 14230, serialized as
SenML and published on the
nRF Cloud MQTT API.
The hello.nrfcloud.com/map backend
converts
these messages then back to LwM2M object so it can be
displayed on the map.
Install the dependencies:
npm cinpx cdk bootstrap # if this is the first time you use CDK in this account
npx cdk deployConfigure the nRF Cloud team ID:
aws ssm put-parameter --name /${STACK_NAME:-kartverket-vasstand}/nrfcloud/account/accountId --type String --value "<team ID>"Configure the station credentials:
aws ssm put-parameter --name /${STACK_NAME:-kartverket-vasstand}/credentials/<station>/deviceId --type String --value "<deviceId>"
aws ssm put-parameter --name /${STACK_NAME:-kartverket-vasstand}/credentials/<station>/certificate --type String --value "<certificate>"
aws ssm put-parameter --name /${STACK_NAME:-kartverket-vasstand}/credentials/<station>/privateKey --type String --value "<privateKey>"| Station ID |
|---|
ANX |
BGO |
BOO |
BRJ |
HFT |
HAR |
HEI |
HRO |
HVG |
KAB |
KSU |
LEH |
MSU |
MAY |
NVK |
NYA |
OSC |
OSL |
RVK |
SBG |
SIE |
SOY |
SVG |
TRG |
TOS |
TRD |
TAZ |
VAW |
VIK |
AES |
After deploying the stack manually once,
- configure a GitHub Actions environment named
production - create the secret
AWS_ROLEwith the valuearn:aws:iam::<account ID>:role/<stack name>-cdand a variable (use thecdRoleArnstack output) - create the variable
AWS_REGIONwith the value<region>(your region) - create the variable
STACK_NAMEwith the value<stack name>(your stack name)
to enable continuous deployment.