Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brockinit/2817db31b22d78b6f0744164ef9160eb to your computer and use it in GitHub Desktop.
Save brockinit/2817db31b22d78b6f0744164ef9160eb to your computer and use it in GitHub Desktop.
Energy Monitor App Demo Instructions

Steps to run Energy Monitor App

Requirements

  • Node 6.10.3

  • Docker

Front-End Setup

  • git clone git@github.com:sudokrew/energy-monitor-frontend.git

  • npm i

  • npm run dev

  • Navigate to /login in the browser

API Setup

  • git clone git@github.com:sudokrew/energy-monitor-api.git

  • npm i

  • Add a .env file to the root of the project

  • Paste this into the .env file:

ENERGY_MONITOR_API_VERSION=1.0.0
SERVER_PORT=3001
NODE_ENV=development
POSTGRES_HOST=energy-monitor-postgres
POSTGRES_PORT=5432
POSTGRES_NAME=energy_monitor_dev
POSTGRES_USER=brockinit
POSTGRES_PSWD=null
POSTGRES_CLIENT=postgres
INFLUXDB_HOST=energy-monitor-influxdb
INFLUXDB_PORT=8086
INFLUXDB_NAME=energy_monitor_dev
INFLUXDB_USER=root
INFLUXDB_PSWD=root
INFLUXDB_DATA_MEASUREMENT=energy_monitor_data
  • npm run dev

  • docker exec -it energy-monitor-postgres psql -d energy_monitor_dev -U brockinit

  • In the root of the project, copy the contents of seed.sql and paste them into the terminal. This should run your seed script and create the database tables

  • \q to exit postgres

  • Place the dev.txt file in the root of the project

  • Follow the following steps to seed the influx time-series database:

  1. docker cp dev.txt energy-monitor-influxdb:/dev.txt
  2. docker exec -it energy-monitor-influxdb bash
  3. Verify that dev.txt is there by typing ls
  4. Exit docker container by typing exit
  5. docker exec -it energy-monitor-influxdb influx -import -path=dev.txt -precision=ms
  6. docker exec -it energy-monitor-influxdb influx -precision rfc3339
  7. use energy_monitor_dev
  8. show measurements
  9. exit
  • node fakeData.js

At this point, you will have started the docker container, seeded both databases, and began the script that generates fake data for the live-feed.

Demo

  • Refresh the browser window at the /login route

  • Register a new user

  • Go to the "Device List" tab and create a device with a serial of "bravo"

  • Go to the "Live Feed" tab and add device "bravo"

  • Use the slider below the graph to adjust the data displayed

  • Feel free to change to different types of graphs (bar, line, area, etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment