This repository creates a service on a Raspberry Pi to store home energy usage data on AWS DynamoDB by reading the P1 port. This port sends data approximately every 10 seconds, but the data is saved every 5 minutes.
Run this on your desktop device (i.e., not on the Raspberry Pi).
pnpm install
pnpm run cdk:deploy -- -c [email protected]
Go to the created IAM user, click "Create access key" and follow the steps in the console. Temporarily store the access key and secret access key.
Run this on the Raspberry Pi.
cd ~ && mkdir Projects && cd Projects
git clone https://github.com/mellevanderlinde/energy-meter.git
cd energy-meter
cp apps/meter/.env.template apps/meter/.env
nano apps/meter/.env
Use the editor to fill AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
with the values that belong to the AWS IAM user that was created in step 1.
Create a service that always runs in the background. The service restarts after a reboot.
docker compose up --build --detach
The webpage can be used to monitor energy usage. This requires AWS credentials to read from DynamoDB, unless MOCK_DATA=true
is specified.
pnpm install
pnpm dev
# use mock data
MOCK_DATA=true pnpm dev