Qball's Weblog
YouLess: Get grips on your energy usage.
What is YouLess
YouLess is a cheap and small energy meter you attach to your the energy-meter you get from your electricity company. It is a small device that you can attach (using Ethernet cable) to your network. For more information see the
The device has a few downsides; a) it has limited storage space, b) it has little visualization, c) you cannot do any analysis.
a,b,c can be solved by automatically uploading the data to bidgely, but personally this is something I do not want.
So, as usual, I wrote I small tool that can get you some more insight in the energy usage.
#
#
EnergyPoint: A small tool to get insight
Getting the data
Because of the limited storage, it can only store 1 minute resolution data for the last hour, we need to store the data in a local db.
To get the data from the YouLess i use a cronjob that downloads data the past 30minutes every half hour. You can get the data in json format.
I use:
wget "http://192.150.0.40/V?f=j&h=1" -O `date +%Y-%m-%d-%H%M-1.json` wget "http://192.150.0.40/V?f=j&h=2" -O `date +%Y-%m-%d-%H%M-2.json`
This downloads data from the past hour every 20 minutes, this makes sure I do not loose data points if the cronjob is late or missed.
EnergyPoint imports this data into a custom sqlite database and will make sure no duplicate data is stored.
Importing data is as simple as:
ep import data/*.json
Analyzing the data
The following analyze are possible (I am looking to build more, ideas are welcome):
- day: Shows the average power consumption for each hour of the day.
- weekdays: Shows the average power consumption for each day of the week.
- weeks: Shows the energy consumption for each week of the year.
- months: Shows the energy consumption for each month of the year.
- days: Shows the energy consumption for each days of the year.
- pattern
: Show the intervals (in the form of a histogram) where spikes between low-high occurs.
You can limit the the range these work on by specifying a range on the command-line:
- range
So if you want to see the energy consumed on average per weekday over the past 2 weeks you can do: (numbers are dummy numbers)
$ ep statistics weekdays range 4/16/2012 4/30/2012 Range: 16/04/2012 - 00:00 --> 30/04/2012 - 00:00 Average power: 470.30 W Energy consumed: 158.02 kWh ========== Week days ========== Day: Average: Total: 1 857.49 W 10.58 kWh 2 766.46 W 8.40 kWh 3 665.26 W 10.97 kWh 4 779.53 W 11.71 kWh 5 898.13 W 11.56 kWh 6 1037.53 W 14.90 kWh 7 870.62 W 10.89 kWh =============================== Total: 79.10 kWh
Visualizing the data
Beside printing data out, it can also plot graphs:
- points: Plot all the data points. (use in combination with range, or it will be slow)
- dayhours: Shows the average power consumption for each hour of the day.
- weekdays: Shows the average power consumption for each day of the week.
- weeks: Shows the energy consumption for each week of the year.
- days: Shows the energy consumption for each day of the year.
- months: Shows the energy consumption for each month of the year.
And extra options for each command:
- range
Limit the evaluated data to a certain range. - svg
Outputs the graph to an SVG file. - average Plot an average line.
- width
The width of the output. - height
The height of the output. - remove-avg: Tries to remove the ‘base’ usage and show just the ‘spikes’. Only works for points plot.
- filter low high Only shows points that are between low and high. Only works with remove-avg in points plot.
So if you want a plot over the past day:
./ep plot points range 4/27/2012 4/28/2012 average svg plot1.svg
##
Todo
There is still many things left todo in the tool, like cleanups, fix tooltips, etc. Help is (again) welcome.
It was written mostly on the train traveling from/to work. So do not be scared.
The code is written in: Vala, GTK 3, cairo, json-glib.
Download
You can get it from github: here