SmartThings Community

Graphing from Smartsense Multi

smartapp_misc
logging

(Chris L) #8

Thanks!


(atothek) #9

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.


(Matt) #10

@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?


(Geko) #11

This may help:


(Matt) #12

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.


(Florian Z) #13

@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") { ... }

or

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.


(Matt) #14

@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.

Thanks


(John Chapman) #15

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?
Thanks,
John


(thehotrod) #16

[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.


#17

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.


(Matthew) #18

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?

Thanks,


(Michael Hess) #19

This worked for me.


SmartThings + Numerous = Awesome! (Update: Numerous is out of business)
(Matthew) #20

Hmm so you can only graph 8 devices?


(Michael Hess) #21

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


#22

You are welcome to try this one out:

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


(Danny C) #23

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.


#24

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.


#25

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


#26

How many fields do you have setup for your channel? Do you have enough for each device? I have 5 devices so 5 fields.


(codersaur) #27

I used ThingSpeak for a while, but I got fed up with its clunkiness so switched to hosting my own InfluxDB+Grafana instance instead. I wrote a guide here: SmartThings Data Visualisation using InfluxDB and Grafana