PDA

View Full Version : Can I make a temperature graph in webserver?



Mastiff
January 16th, 2014, 05:12 AM
For now I'm using my RFXtrx433 with a bunch of temp sensors and heating control with EventGhost because it's a lot easier to do the RF stuff in there, and I'm actually not sure if it works in Girder yet. The advanced functions are done by sending the sensors' readings to Girder with Event.exe. Works perfectly, not a glitch in more than a year. But I would like to have another, fun function: A graph that shows the temperature in a zone the last 24 hours, the last week and the last month. Is that possible with the Girder webserver in any way? Or should I try to do it in HTML, with Girder just writing values to a CSV or similar file?

KRO74
April 17th, 2014, 03:58 PM
.....in case you are still looking for a solution.......

I have been using FLOT, http://www.flotcharts.org/

If you have any questions I might be able to help, just let me know and I will share my implementation

Regards

Mastiff
April 18th, 2014, 09:50 AM
Hi! That does seem interesting. I have connected my Teldus RemoteStick to a service, but this seems like it can be more flexible. Do you do everything in LUA?

KRO74
April 18th, 2014, 03:53 PM
Hi,

The data collection side of it is done in LUA like this,


if fifoc < 48 then
fifoc = fifoc + 1
--table.insert(fifo_temp, 1, weatherdata.Temp_Ext)
table.insert(fifo_temp, 1, {})
table.insert(fifo_temp[1], 1, os.time()*1000)
table.insert(fifo_temp[1], 2, weatherdata.Temp_Ext)

else
table.remove(fifo_temp, 48)
--table.insert(fifo_temp, 1, weatherdata.Temp_Ext)
table.insert(fifo_temp, 1, {})
table.insert(fifo_temp[1], 1, os.time()*1000)
table.insert(fifo_temp[1], 2, weatherdata.Temp_Ext)

end

On the web server side it is javascript, something like this,


$(document).ready(function() { setTimeout('checkGIRDER()',5000); });

function test(arMyValues) {
try {
$.plot($("#placeholder"), [ {
data: arMyValues,
xaxis: { mode: "time" },
color: "rgb(255, 64, 64)",
threshold: { below: "0", color: "rgb(0, 178, 238)" }
} ])

}
catch(err){
alert(err.message)
}

}


$('#temp_trend').live('pageshow', function () { test(arMyValues); });

You can check out my example, pic taken from an iphone, a bit down in this thread

http://www.promixis.com/forums/showthread.php?21339-Home

Regards

Mastiff
April 21st, 2014, 07:23 AM
Thanks! I'll have a look at that setup one day I have the time (which probably means in a couple of weeks at the rate things are going right now)! :)