[OBSOLETE] Power Meter Logging SmartApps (PlotWatt, ThingSpeak, SmartEnergyGroups)

I’ve put together a few SmartApps, mostly based on other contributions on this forum, that will log power meter data (watts and sometimes kwh) to various power monitoring services/graphing services - ThingSpeak, SmartEnergyGroups (SEG), PlottWatt. I’m using these with my Aeon HEMv1, but they would likely work with any device that reports it’s capability as being a power meter.

I’m still having accuracy issues with SEG but have given up on resolving for now. They supposedly accept data in “Wh” not “kWh”; so I’ve tried multiplying kWh by 1000 before posting, but that makes their cost calculation widgets highly inaccurate. I really wanted SEG to work because they have the best widgets, but alas, I’m tired of debugging the problem with no help.

ThingSpeak and PlottWatt appear to be pretty accurate. PlotWatt takes watt usage and calculates cost based on your location, so if you’ve looking for accurate cost calculations, I’d start here. ThingSpeak is good for graphs, but you have to do lots of manual work to get accurate cost calculations (daily script to pull the data, calculate, then write back to another channel). PlottWatt is by far the easiest to setup; I haven’t been running it long enough to know the accuracy.

GitHub - bdwilson/PlotWatt-SmartThings-Logger: SmartThings SmartApp Energy Logger for PlotWatt (Examples: https://dl.dropbox.com/u/853747/Jing/2015-02-07_0740.png, https://dl.dropbox.com/u/853747/Jing/2015-02-07_0741.png)

GitHub - bdwilson/ThingSpeak-Energy-Logger: SmartThings SmartApp Energy Logger for ThingSpeak (Example: http://bubba.org/things/ - some of these like daily/monthly calculations require some backend scripts to process the data daily, but you get the idea)

GitHub - bdwilson/SEG-Logger: SmartThings SmartApp Energy Logger for SmartEnergyGroup (SEG) (Examples: https://smartenergygroups.com/widgets/c4c0818037f5c2be2fbadf21f9c0a79b288ce05c)

If you have issues/questions, it’s best to bug me on twitter.

17 Likes

Hi Brian,

How often do you have the data updating for your PlotWatt account?

Is that something I need to change in HEMv2 device properties?

The SmartApp subscribes to HEM updates, so an update is posted each time your HEM checks in. PlotWatt does not do a good job of updating their graphs in real time, but if you hover over the real time usage you can tell the last time data was received.

1 Like

Are you just running one whole house sensor or have more then one?

I’ve wondered the same thing – I have a HEM v1, but it doesn’t seem to update any faster than once every 5minutes in both PlotWatt and GroveStreams. Even when I update the preferences from my ST developer login, it still only seems to update once every 5 minutes. Is that a deficiency with v1 vs v2 of the Aeon HEM by chance?

Tks - Derek

I have two of these (I have 2 different meters) and I get updates every 30 seconds from each of them. I have 2 different instances of them installed (one for each meter).

I’m using a device type based on SANdood (https://github.com/SANdood/Aeon-HEM-v2) and here is the version that I’m currently using:https://gist.github.com/bdwilson/0843da30fb6bcda97752. If you look at the bottom, you’ll see where it configures the delay to be 30 seconds.

Also, if you have multiple meters with PlotWatt, you’ll need to contact their support folks and have them “do magic” to your account in order to properly set them up to combine the information of the two meters. I’ve given up on SmartEngeryGroups since I could never get accurate data there, and they never responded to my forum posts or emails, so I’m using strictly PlotWatt and ThingSpeak. PlotWatt is the easiest and there is no manual configuration after the initial setup and it’s shockingly accurate compared to my bills (I think it was about 80kWh one month).

1 Like

Thanks for those links – will try giving your version of the code and see if I can get the 30 second updates to work for my HEM v1.

Thanks again - Derek

1 Like

I’m still just getting a question mark (?) mark with no gear icon when looking at my “Things”. I’m using HEM v1 hardware. Any ideas? Thanks - Derek

80kWH holy cow, are you smelting steel? Save some coal for me. Just kidding that is crazy-low. You must be Mr.solar-double-meter

Thanks Brian I was able to start this rolling today. FYI the API-key is upper and lower case and lowercase “L” looks exactly like “1” and a lot like SansSerif uppercase “eye” - OMG my little fists were waving in tiny fury.

Is there any place to detail “gas” waterheater and “gas” furnace, or do they just statistically figure out that they’re not electric? hmm better delete the water heater oops.

Also anybody else without a live mac or unix box, I was able to send the curl instruction from my android phone or tablet by using a sketchy app in chinese.

FYI I originally put all KW/KWH meters (which include Aeon smart plugs) in the smartapp and the daily totals looked low, so like plotwatt assumes some of those are negative/solar/generator meters. So I deleted all except the main power meter - now the power looks correct. I remember now that the curl instructions generates the number of meters you want, of course I specified one. If I requested 6-7 then I’m guessing there is some way to indicate which are submeters in the plotwatt website.

1 Like

@brianwilson Thanks for making this for the community. I just implemented it today. You’ve made the world a better place! :wink:

1 Like

I got this set up with PlotWatt this morning, got one update on PlotWatt, but now can no longer see a current reading on there, in fact… nothing shows up on the PlotWatt page! I’m not sure where to check next. On PlotWatt Settings > Connected Gateways, I see the PlotWatt API that I set up this morning, but it just says that the current status is “no_connection”.

Check the app console and make sure that the data is getting posted to Plotwatt.

“no connection” is typical when you use the … uhh “API” gateway? (“PlotWatt API”). Mine always updates with “no connection”.

Looking at the log, I’m seeing lots of recurring errors that possibly look related to the Aeon Home Energy Monitor v2 device type from https://github.com/constjs/SmartThings-Devices/blob/master/aeon_hemv1_v2.device.groovy . If I’m looking at the right source, that line 113 is this:

statusTextmsg = “Home is currently using ${device.currentState(‘powerDisp’).value}.\nMin was ${device.currentState(‘powerOne’).value}.\nMax was ${device.currentState(‘powerTwo’).value}.”

and line 130 is this:

BigDecimal costDecimal = newValue * ( kWhCost as BigDecimal)

I’m not sure how to see logs from the SmartApp… I’m looking at the Live Logging screen right now, but that looks like it only contains devices, not apps?

I suppose it would help if I pasted the log messages that were referencing me to those lines. Both appear to be for the device, still not sure how to check on the PlotWatt posting SmartApp itself (unless it’s just not logging anything!)

9:09:36 AM: error groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.math.BigDecimal#multiply.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.lang.Character]
[class java.lang.Number] @ line 130
9:09:35 AM: error java.lang.NullPointerException: Cannot get property 'value' on null object @ line 113

I did some debugging this morning, and figured out my issues! Turns out “powerOne” was not being updated, due to some bad state that the variables were in. After hitting the reset button in the HEM panel, everything popped right up, the errors went away in the log, and PlotWatt started updating again!

Just thought I’d mention trying a reset, if anybody else is having similar issues!

Am I reading/interpreting this correctly, that I need to create a new device in smartthngs, and not just select my HEM and enter the API key and Home_ID listed at https://plotwatt.com/docs/api ?

3) Next you’ll need to create a meter using the API. If you have more than 1 meter, you’ll adjust this number. Use a UNIX or Mac system with curl:

no, you will be using your existing ST-defined HEM. Assuming it is currently reading correctly in ST. If not then fix it in ST first.

The PlotWattLogger is a ST smartapp, not a new custom device.

1 Like

Okay, I installed the app and HEM is reading fine in ST. Just that #3 in the instructions on Guthub said to create a new device in API using the code. I just put my Plotwatt API ( being very conscious of the upper/lower case letters) and my Home ID in the app where it asked for Panel ID . So far it hasn’t sent anything to Plotwatt. So I was wondering .

I did have to monkey around with which smartapp field took the API key, house ID, and and what was the meter number. They didn’t use exactly the same terms and it was confusing. If PlotWatt doesn’t show you are receiving values after 5 minutes and you know your meter updates every minute, 3 minutes, whatever, then you have a bad ID number in there. You can see the updates in IDE live log I think.

You know that “Panel ID” in smartapp is not the “House ID” in PlotWatt API, right? I THINK Panel-ID is returned by the curl instruction output. Don’t feel like re-reading the directions just now.

One issue that I didn’t notice at first, not sure if it’s a showstopper, the curl instruction default meter quantity was 2 (TWO), when I only wanted 1 - don’t just copy/paste 2 in the instruction.