Graphing from Smartsense Multi

Thanks so much for posting this. I am new to Smart & have been working with this example. I keep thinking I must be missing a manual somewhere, is there somewhere with basic documentation on the language in use here? For example, how to get the current date/time, syntax for the logging functions, etc? Are there loops?

Specifically on this code you use it.toString in the temperature event handler, but I can’t figure out where that object came from. It doesn’t seem to have been passed to the event handler, so I’m thinking it must be built it somewhere, but I can’t figure it out.

I’d like to convert this code to send temperature data periodically using the schedule function, but I keep reaching for a manual I don’t seem to have.

Sorry if this is a stupid question, any pointers appreciated.


The language is called groovy. See here The ‘it’ is an implicit variable. See here


Sorry, total newb here. I’m trying to figure out if SmartThings has any “built in” functionality to save historical data such as for temperature, humidity, and motion before I buy the smart hub. Looking for time graphs similar to the OP question. Or will I need to code things like this? I’d prefer something out of the box pre-built since I don’t have time to code, debug, etc. I see IFTTT integration and would think I could build a graph and capture data on that, but would be better if something “prettier” and more seamless already existed.

@florianz I have been using your code since getting ST setup, I recently modified it to log if the HVAC was running or not using thermostatOperatingState, however since both the temperature and thermostatOperatingState come from the same named device “Thermostat” the logging for temperature and state get mixed up between the two separate graphs. Any idea how this could be fixed?

This may help:

Thanks @gecko I noticed that one when I was hunting around for a fix. I didn’t want to start the logging all over but I decided to. I now have my temperature sensors all logging to Xively.

@mattjfrank, sounds like you were able to resolve your issue. My app assumes that each device has exactly one channel, you could fix that by passing some variable suffix to the logField method, e.g:

private logField(evt, suffix, Closure c)

Then use this line to create the device name for looking up the ThingSpeak field:

def deviceName = evt.displayName.trim() + suffix

You could then log fields like this:

logField(evt, "_temperature") { ... }


logField(evt, "_operatingState") { ... }

Your ThingSpeak fields would have to be named appropriately (e.g. “Thermostat_temperature”, etc.)

Having said that, I don’t use ThingSpeak anymore. The service has just been too unreliable for me. You can use Xively, like @geko mentioned, or try to write an app for another IoT logging service. There are quite a few, now. For example, SparkFun just added a cool looking one.

@florianz I’m using Xively I modified an app to log what I wanted logged and it’s working as I’d hoped. I like Xively graphs better anyway.


Is there any way to add this to the mobile Dashboard? I would love to see a “Monitors” or “Reports” section that had a way of displaying e.g. Temperatures in a table/list (current status) or chart/graph (historical) and allowing grouping/add/remove of select Multi or other Temperature sensors. (Probably similar with Humidity, Ambient Light and other value-monitoring sensors.)
The ability to set up Alerts e.g. for too cold/too hot is great, but sometimes it’s just as important to see a quick overview of status (just like the Open/Closed sensor view). Similarly, although timelines might show certain values, a graphical representation that aggregates just specific types of data is important to show historical trending.
Where in the forum would be a good place to discuss that as a future project/wishlist?

1 Like

[quote=“florianz, post:2, topic:930”]

  • ThingSpeak Logger

I’ve tried this code and used my WriteAPIKey and ChannelID# from thingspeak but I’m not seeing any data getting published to my channel. Does Thingspeak still work with Smartthings? Is there a different set of code I should be using? Can anybody help me get Thingspeak working with my sensors?
Thank you.

If you’re still interested, I just installed this app and it worked for me. Make sure that your field names in ThinkSpeak are typed in exactly the same as your sensor names. Then watch the Live Logging page in case there are errors.

Does anyone have the latest copy of this code for thinkspeak? I tried the link above but when I end it pasting it in to the code window for a new app. But I get Metadata definition not found when I try to save.

Anyone have any ideas?


This worked for me.


Hmm so you can only graph 8 devices?

I run multiple instances to cover all my variables. Then some html file I found somewhere to locally display graphs.

1 Like

You are welcome to try this one out:

It is a simple one that logs to 3 fields on a TS channel

Is this app still working ThingSpeak Logger II?
I have added it and I show 11:42:30 PM: debug ThingSpeak data retrieval successful, status = 200 in the logs however I get no data populated on ThingSpeak? The device names are exactly the ones used in Smartthings.

You might need to change the url to https. I’m trying it now but my sensors seem to be slow to send events. I’ve only gotten on so far so not sure how often the event is fired. If it doesn’t do it often I might see if I can write a sleep loop or some such to get it to poll the data instead of using a push.

So what does it mean when it says “Device ‘XXX’ has no field”? I guess I didnt set it up right…