Logging Thermostat Status to Xively

I do, and I’m seeing PUT feeds every 15 minutes, but they seem to be throwing the error above and not logging anything. Do I need to deploy the device?

No, you don’t… I just created another device

The API key is the long string in the 2nd column, under API key and the Feed ID is up at the top as Feed ID.

What error do you get in the logs? on Xively?

@pstuart I’m pretty sure I’ve input the feed id and api key properly. I just deleted the device and tried again. I’m simply making a new device in the Develop console of Xively, which is activated but not deployed. I didn’t create any channels or anything else. I’m grabbing the API key for the device and the feed id and putting them in the SmartApp.

In ST, I see no errors in the logs.

In Xively, I see a 422 response to the PUT in the request log. From what I understand, that means the request was valid, but unprocessable by Xively. The contents of the request seem to have all the variables I selected in the app, with valid data. For example:

{
“id”: “Garage_Sensor_battery”,
“current_value”: “88.0”
},

OK, I take it back. Maybe I was putting in too many things? I cut it back to a dozen items, mostly temps and some batteries, and now it’s storing data.

Initially, I was having the same issue as @bmoffett and was getting a 422 response in the request log on Xively. Now, I am not even getting that. When I run the SmartApp, I don’t see anything on Xively but this is what I see in in the ST logs:

c88c6101-df5f-4321-b178-902f169f830b 8:22:22 AM: error groovyx.net.http.HttpResponseException: @ line 358
c88c6101-df5f-4321-b178-902f169f830b 8:22:21 AM: debug {“version”:“1.0.0”,“datastreams”:[{“id”:“Z-Wave_Thermostat_temperature”,“current_value”:“71.0”},{“id”:“Andy’s_Room_temperature”,“current_value”:“68.3”} ]}
c88c6101-df5f-4321-b178-902f169f830b 8:22:21 AM: debug {“id”:“Z-Wave_Thermostat_temperature”,“current_value”:“71.0”},{“id”:“Andy’s_Room_temperature”,“current_value”:“68.3”}
c88c6101-df5f-4321-b178-902f169f830b 8:22:21 AM: debug [[Z-Wave Thermostat, temperature, 71.0], [Andy’s Room, temperature, 68.3]]
c88c6101-df5f-4321-b178-902f169f830b 8:22:21 AM: debug appTouch: touch

It’s capturing the temperature data I asked for but it doesn’t seem to be going anywhere.

A couple other questions for @pstuart

  • You mentioned Pollster. Is this just used for polling the device or do I need to tie it to the Xively Logger in some way.
  • Is the Xively Logger supposed to upload data automatically? The only way it seems to run is if I tap the Smartapp.

I signed up for Xively just for this (i.e. I have no experience with it) so I fully expect this to be user error :frowning:

Afraid I really can’t offer a ton of support on this. Maybe this weekend I can add some debugs to track the response back to check for people who can’t enter their API / user key info correctly…

My guess is its something stupid simple like the fact that you have a single quote in your room names, why its rejecting it…

Also, yes, this smartapp will not log data at predefined intervals, instead, use the Pollster app to configure how often you want it to poll.

I may add polling options in the future, but I just don’t have time to support end users.

@pstuart

You get a big gold star for the day. I took the apostrophe out of “Andy’s Room” and now everything is working great.

Now my next project is to get it to recognize energy usage from my two metering devices.

Can you please tell me ho to increase from polling after 10 or 20 minutes?
the code here:

schedule(“0 */15 * * * ?”, “checkSensors”)
has to change to what?I mean can you explain me the logic?

thx

The docs are your friend…

http://docs.smartthings.com/en/latest/smartapp-developers-guide/scheduling.html?highlight=schedule

look under cron expressions for exactly how to do it the way you want.

I made a version based on kernelhack’s version

Changes:

  • support multiple thermostats (uses device name to distinguish feeds)
  • polls every 10 min for current data in addition to responding to device events for temp/operating mode

Device names should not have any special chars (only _ supported, and code removes spaces for you)

Sample graphs