Power Meter Logging SmartApps (PlotWatt, ThingSpeak, SmartEnergyGroups)

That must be my problem, I don’t have a mac, so never did the create a new device api curl … blah blah blah in step 3, that’s what I was asking about. I just used the ST built in Aeon HEM device type installed the app and put the api and group/home ID from Plotwatt in those two spots .

come on man it’s not optional.

The curl instruction “creates a new standard meter in PlotWatt”,
is how I would phrase it. The new PlotWatt-meter-ID is how you link your existing HEM, with ST smartapp using the PW-meter-ID to feed PW.

Watch the ST Live log in IDE to see the updates are successful or not.

That was what I asked. It said to create a new device in the API using the ID from Plotwatt API. So I asked if that was in the ST API

I give up, I have no clue where I am supposed to create this new device or whether I am supposed to add it to ST or PW. Doesn’t make any sense to me why I need a mac to add a device. In PW I can add up to 50 gateways but when I click meters there is no way to add any. ( Must be because I am on Windows computer, hence why I need a Mac to add a meter)
Guess I’ll just stick with ST and recent activity

So to add a curl code to create a new device…you need a mac???

You don’t need a Mac. You need to be able to run the curl command. It’s a command line program that comes standard on most Linux/UNIX based OSes. The API page on plotwatt tells you what to type in the curl command. When you type that command, it tells plotwatt to create a new “meter” for you and it will reply to that comand with a meter ID number. You need that as one of your Inputs in the logger app.

Plotwatt is intended to be used with a compatible energy meter that would do all of this for you. Since using this app is “rolling our own” we have to use the API directly and be own own meter.

If you have Windows, try some Google-fu to figure out how to get curl on your machine. I can’t help you there.

I posted code i wrote to allow bulk uploading after a set number of events instead of every event. PlotWatt recommends uploading after 50 events.

1 Like

cool man!

I tried it and got error:
12:56:43 PM: error groovyx.net.http.HttpResponseException: Unauthorized @ line 69

I attempted to re-use an API key for an existing API meter - seems like that should work, my original non-queuing updater used the same key and meter# ok. I’m guessing that I’ll make another API key AND a new API meter# for this uploader.

EDIT MUCH LATER, the above issue was caused by ST back-end update. Unrelated to bigpunk6’s program except that the update requires a different authorization method.

I’m getting an unauthorized message too, since ~11:30am EDT today… using bdwilson’s plotwatt uploader

Same unauthorized error here. Also started at 9:30am Mountain today.

Still getting the error via ST, but opening a shell to my Ubuntu server, I can copy/paste the curl example for posting data from the plotwatt docs ( https://plotwatt.com/docs/api ):

curl -X POST -d "${channelKey},1.5,1310172167" http://${channelId}:@plotwatt.com/api/v2/push_readings

plug in the values for my channelId and channelKey, and curl returned “ok”. I went to the plotwatt dashboard, and sure enough, it registered that new data had posted. Still getting errors from ST though!

Makes me think that maybe the issue is between ST and PlotWatt, possibly IP related? Or ST broke http posting during the upgrade? The weird part was, it briefly worked for a few hours this morning after ST came back up after the outage.

Same issues here. I have a contact at PlotWatt that has helped me out in the past; I’ll ping them and see if there are any known issues or blocks happening with posts from SmartThings devices.

Brian

Its probably the problem that when the smart app runs in the Amazon EC3 cloud and all requests appear to come from the same IP address.

Hey Guys,
This is Mandar from plotwatt.
what user-agent should I be looking for see there?
Can you point to a few house ids that have this problem?

regards,

  • Mandar

M: error groovyx.net.http.HttpResponseException: Unauthorized @ line 77

Meter ID: 11907103

private logField(evt, field, Closure c) {
def value = c(evt.value)
float watts = value.toFloat()
def kwatts = watts/1000
def now = Calendar.instance
def date = now.time
def millis = date.time
def secs = millis/1000
secs = secs.toInteger()
def body = "${channelKey},${kwatts},${secs}"

def uri = "http://${channelId}:@plotwatt.com/api/v2/push_readings"  
   def params = [
    uri: uri,
    body: body
] 
log.debug "Posting Body: ${body} to ${uri}"

httpPost(params) {response -> parseHttpResponse(response)}  (LINE 77)

}

My house ID is: 14167

Last report was: 10/20 @ 11:33 am.

House ID - 16036
Last updat was on 10/20 at 1PM

I got the same error with the GrooveStreams smartapp also. I think they changed something during the last maintenance “enhancement”.

I’m getting the same error with plot watt. I don’t think it’s on the smart things side because if I try to manually post values with Curl from the command line, I get 403 Forbidden. I think plott watt has a server issue.

I’m getting the same error, and saw in another post that ST updated backend code. @Vader reported that he had a fix, but I’m not sure how to implement it.