Prototype dashboard for viewing electricity usage consumed from the Octopus Energy API using Golang (for data collection), InfluxDB (for data storage), and Grafana (for visualization).
- Create a
.env
file in the root directory with the following content:
# Octopus energy config (get your values from https://octopus.energy/dashboard/developer/)
OCTOPUS_ENERGY_API_KEY=<YOUR-API-KEY>
ELECTRICITY_METER_MPAN=<YOUR-MPAN-NUMBER>
ELECTRICITY_METER_SERIAL_NUMBER=<YOUR-SERIAL-NUMBER>
# InfluxDB config
INFLUXDB_USERNAME=admin
INFLUXDB_PASSWORD=admin1234
INFLUXDB_TOKEN=O-mfkVnkRYlueeyffw8q0T_K2Cf4TJMtFGlZaZoFxG-v80ZhvWSGZyJwMaRrIAIHWtA6pZ_bDQCwTvApccFcVw==
- Start the dashboard with:
docker-compose up -d
-
Run
main.go
to collect data. -
Create DBRP mappings:
docker-compose exec influxdb bash
influx bucket list # to determine ID of 'consumption bucket' - see https://docs.influxdata.com/influxdb/v2.1/organizations/buckets/view-buckets
influx v1 dbrp create --db consumption --rp infinite --bucket-id <bucket-id> --default
- Visit http://localhost:3001 and navigate to 'Consumption (InfluxQL)' dashboard.