Since I built my own IR-based pulse meter to monitor my whole-house power usage, I started looking around for a cloud-based solution for storing and analyzing the data. I specifically wanted something with disaggregation, so that it can identify my appliances and devices. A friend of mine uses Bidgely, but that looked like it was going to be difficult to integrate with Vera. Then I stumbled across PlotWatt. It’s free for residential users, is based around their disaggregation algorithms, and offers a straightforward API.
So, here’s the script that I’m using to upload to PlotWatt. I don’t know how to write plugins, so it isn’t one. Also, a lot of credit goes to guessed for his SEG code, on which this is very heavily based.
I haven’t tested this with multiple meters, but it should work.
[size=14pt]The Directions[/size]
[ul][li]Register for an account at PlotWatt[/li]
[li]After registering, it should ask you to add a meter. Select the “PlotWatt API” option[/li]
[li]Their next instructions will take you to the PlotWatt API documentation. The documentation will have your new API key listed at the top[/li]
[li]SSH into your Vera or another Linux box. Run the command from the API for adding meters, but change the number_of_new_meters to 1:[/li][/ul]
curl -X POST -d "number_of_new_meters=1" http://YOUR_API_KEY:@plotwatt.com/api/v2/new_meters
[ul][li]Record the generated Meter ID[/li]
[li]Download the attached PlotWatt.lua[/li]
[li]Edit the file, entering your PlotWatt API key, Meter ID, and the Vera Device ID for your whole-house meter device[/li]
[li]In the Vera UI, go to Apps → Develop Apps → Luup Files[/li]
[li]On the right, click “Choose File”. Browse to and select your edited PlotWatt.lua file, and click “Go”[/li]
[li]On the left, click “Edit Startup Lua”[/li]
[li]Add the following line:[/li][/ul]
require("PlotWatt.lua")
[ul][li]Click “Go”[/li]
[li]Click “Save”[/li]
[li]Enjoy your data flowing to PlotWatt[/li][/ul]
[size=14pt]The Details[/size]
PlotWatt can handle data resolution of up to one read per second. They can accept data in batches, and don’t want data to be uploaded any more frequently than once per minute. This script keeps track of each value from the Vera meter device every time it changes, and only uploads all of the values and times to PlotWatt if it’s been more than 60 seconds since the last upload.