I semi-regularly check on my power and water consumption (by looking at the meters as I don't have an automated way). It gives me insight about the way I consume (expensive) resources.
After a few years of plotting them in a spreadsheet, I've made the leap to Elasticsearch (for storage and query) and Kibana (for visualization).
I've also added weather data from Wunderground.
You need a Ruby executable (version 2.x should work, I use 2.1.2), a few gems (including Bundler).
gem install bundler
bundle install
The .env gem is used to pass environment variables to the script, like the Wunderground API key of the Elasticsearch host you want to use.
There is .env.example
that you need to rename to .env
and adapt.
You have to provide date to the script :
FROM=2014-08-27 TO=2014-08-28 bundle exec ruby download_wunderground.rb
or
DATE=2014-08-28 bundle exec ruby download_wunderground.rb
My own data is in the data/home_data.csv
file (numbers are the derivative value since the previous one).
bundle exec ruby home_stats_importer.rb
You can rebuild the entire index structure like this :
REBUILD=1 bundle exec ruby home_stats_importer.rb
It will destroy the index and recreate it using the Elasticsearch mapping (configured in home_stats_mapping.rb
).
You need to install Kibana and load the home_stats.json
schema.