graph and trends...
-
- Senior Member
- Posts: 111
- Joined: Wed Aug 11, 2004 6:52 pm
- Location: Sweden
graph and trends...
i would like to do a plot/graph of the change of a property over time (for example the last 24 hours outside temperature).
any plugins or plans for a control like this.. (or have i lost that page in the manual ...)
i could see two different aproaches to this:
realtime - just plot the change locally in the software remote.
historical - retreve historical data from central DB.
pls advice if any job done or planned development of this.
regs
any plugins or plans for a control like this.. (or have i lost that page in the manual ...)
i could see two different aproaches to this:
realtime - just plot the change locally in the software remote.
historical - retreve historical data from central DB.
pls advice if any job done or planned development of this.
regs
If you just wanted to log the property changes, you could do this now. However, if you wanted to show a nice graph of the data on a Software Remote, that's a bit more difficult.
To store Property Value changes to a log file:
To store Property Value changes to a log file:
- Create a new Log file [File / New / Log...].
- Specify the output to a file and give it a name.
- Navigate to the Property to log in the tree view.
- Select the Log changes to User Log checkbox and select the log that you just created.
- Create a Task that has a condition that will cause it to execute whenever the Property Value has changed.
- Have an action in the Task to execute a Script Device.
- The Script Device can pull the current value of the property and do whatever it wants with it. It can save it to a DB or write it to a file.
Scott
-
- Senior Member
- Posts: 111
- Joined: Wed Aug 11, 2004 6:52 pm
- Location: Sweden
graph on remote...
I see the log part... do you have any hint on ´how to get it on the screen of a remote?
tnx
tnx
Re: graph on remote...
The only way you can get it on the screen is to use a dynamic image on the Theme.do you have any hint on ´how to get it on the screen of a remote?
The trick is how to create the image/graph from the data. I though that I could find some simple freeware app that takes a data file as input and will generate a JPEG or BMP file as output. However, nothing surfaced in my quick search. If you could find such a program, then you can run it after new data is collected and update the image.
Scott
One option would be to use RRDTool http://people.ee.ethz.ch/~oetiker/webto ... index.html
It is a very well supported open source database specifically designed for logging time series data. It is often used by Linux users but they also have a pre-compiled Windows version.
You can check out all the clients written for it here http://people.ee.ethz.ch/~oetiker/webto ... /rrdworld/
It probably would not be very hard to write a script that generated a image file on a timed bases for HouseBot to use.
It is a very well supported open source database specifically designed for logging time series data. It is often used by Linux users but they also have a pre-compiled Windows version.
You can check out all the clients written for it here http://people.ee.ethz.ch/~oetiker/webto ... /rrdworld/
It probably would not be very hard to write a script that generated a image file on a timed bases for HouseBot to use.
-
- Member
- Posts: 83
- Joined: Sat Oct 30, 2004 4:16 pm
Hi all -
I thought I'd chime in and add to this dusty thread. I found what I think is a perfect companion to Housebot for plotting data trends. It is "gnuplot" and you can find it here:
http://www.gnuplot.info/
It is freeware and it has a GUI and a command line interface. The GUI is perfect for testing and debugging the plot files. Once the plot files are good to go, Housebot will happily execute the command line version and you can load the resulting plots into Housebot as PNG images (dynamic images). It does all kinds of plots, 3-D plots, polar, etc. It will also let you specify the output image sizes and will even rotate text along the bottom axis by 90 degrees! It's a plotter's wet dream come true.
A couple of Caveats:
1) gnuplot is kinda hard to use - once you've practiced using the sample plot files and reading the manual (over and over), it will come together. The hardest part for me was trying to get my date and time formats to be read in from a file. It was kinda tricky.
2) gnuplot claims to support "GIF" but not really, they're really PNG images with a "GIF" extension. Very misleading - fortunately, HB understands PNG just fine - just make sure you use the "PNG" extension when specifying the output filename.
3) I had to use a custom VB script to create the plot files. Housebot's logging didn't cut it for me because it added too much data. For example, I wanted to plot a temperature trend, but the log file saves it as "Temperature Property Has Changed to [30]" or something like that (along with a time and date - still useful). gnuplot doesn't understand that format very well, it wants a file with numbers pretty much. I'm sure with enough blood and sweat, gnuplot can be configured to understand Housebot log data files directly. However, in order to put multiple plots onto one plot, the data still has to be in one file (I think). For Housebot to put multiple property values into a single log file would require some kind of composite property value to be created and then decomposed later by gnuplot. Too much work!!
So, my VB script, which was invoked at regular intervals, would append to a temperature log file containing the date, time, temperature, a high temperature, and a low temperature (I've got another script that keeps track of that stuff). Anyway, it works very well. I'm still testing it out and not sure how well the dynamic image is loading - I've had to use a trick that I found elsewhere in this forum to have a task wake up and refresh the filename of the dynamic image property to force it to update to all the SWRemotes.
I thought I'd chime in and add to this dusty thread. I found what I think is a perfect companion to Housebot for plotting data trends. It is "gnuplot" and you can find it here:
http://www.gnuplot.info/
It is freeware and it has a GUI and a command line interface. The GUI is perfect for testing and debugging the plot files. Once the plot files are good to go, Housebot will happily execute the command line version and you can load the resulting plots into Housebot as PNG images (dynamic images). It does all kinds of plots, 3-D plots, polar, etc. It will also let you specify the output image sizes and will even rotate text along the bottom axis by 90 degrees! It's a plotter's wet dream come true.
A couple of Caveats:
1) gnuplot is kinda hard to use - once you've practiced using the sample plot files and reading the manual (over and over), it will come together. The hardest part for me was trying to get my date and time formats to be read in from a file. It was kinda tricky.
2) gnuplot claims to support "GIF" but not really, they're really PNG images with a "GIF" extension. Very misleading - fortunately, HB understands PNG just fine - just make sure you use the "PNG" extension when specifying the output filename.
3) I had to use a custom VB script to create the plot files. Housebot's logging didn't cut it for me because it added too much data. For example, I wanted to plot a temperature trend, but the log file saves it as "Temperature Property Has Changed to [30]" or something like that (along with a time and date - still useful). gnuplot doesn't understand that format very well, it wants a file with numbers pretty much. I'm sure with enough blood and sweat, gnuplot can be configured to understand Housebot log data files directly. However, in order to put multiple plots onto one plot, the data still has to be in one file (I think). For Housebot to put multiple property values into a single log file would require some kind of composite property value to be created and then decomposed later by gnuplot. Too much work!!
So, my VB script, which was invoked at regular intervals, would append to a temperature log file containing the date, time, temperature, a high temperature, and a low temperature (I've got another script that keeps track of that stuff). Anyway, it works very well. I'm still testing it out and not sure how well the dynamic image is loading - I've had to use a trick that I found elsewhere in this forum to have a task wake up and refresh the filename of the dynamic image property to force it to update to all the SWRemotes.
Gnuplot, background set-up
GNUPLOT is really very adapted for the generation of dynamic graph integrated into "remotes", I did not find the option allowing to change the background of my graphs.
Could anybody say to me if it is possible, and with which command?
Thank you in advance.
Ethan.
Could anybody say to me if it is possible, and with which command?
Thank you in advance.
Ethan.
-
- Member
- Posts: 83
- Joined: Sat Oct 30, 2004 4:16 pm
I use the GIF (really, PNG) format for my plots that are to be displayed in my SW remotes and you can specify a transparent background so that the background in the SW remote can be seen (and its color). If you look in the gnuplot documentaiton, there are qualifiers to use for the GIF format (size, colors, background etc).
My plot file contains this directive:
Which gives me a small GIF image with a transparent background and is 220x180 pixels in size (height x width)
My plot file contains this directive:
Code: Select all
set terminal gif transparent small size 220,180
Gnuplot, background set-up
Perfect, it works perfectly.
Thank you for your help.
Thank you for your help.
-
- Senior Member
- Posts: 111
- Joined: Wed Aug 11, 2004 6:52 pm
- Location: Sweden
hello guys . great to see activity in this tread. Your way looks as the best solution so far to the trending/plotting issue. Could you elaborate a bit more about your solution and maybe post some examples.
I have about 20 different temperature properties that i would like to plot on my swremotes.
Do you do a log file per day,week or year? whats your samplerate? do you log changes or at a fixed samplerate?
regs
I have about 20 different temperature properties that i would like to plot on my swremotes.
Do you do a log file per day,week or year? whats your samplerate? do you log changes or at a fixed samplerate?
regs
-
- Member
- Posts: 83
- Joined: Sat Oct 30, 2004 4:16 pm
Hi -
Sorry for the late reply.
My log file is actually created by a custom VB script. I have a USB Templinc which I wrote a VB script to query and process its temperature data. Because I'm a nerd, I have the script tracking the highest and lowest temperature recorded for the last three days (actually it can be any number of days, I just have it set to three).
After it takes the reading, the last thing the script does is write the date and time and temperature to a file along with the current highest and lowest temperature. When I plot this, I get a temperature swing between the high and low plots (they appear as stairstep lines when the high and lows change over time). Like I said earlier, HB's built in logging capabilities doesn't meet my needs, it adds too much data for gnuplot to use. I found it quite easy to write a VB script to open/append a file, write the data, and close it.
As for my logging rate (also the sampling rate), I update it once every 7 minutes. Why 7? I figured having an odd number would keep it from interfering with any other tasks that might be running at even intervals (like every 5 minutes, every hour, or half hour).
The only thing I haven't solved yet is how to prune my temperature log file that gnuplot uses to plot the data from. I just haven't gotten around to it. What I'd like to do is to prune the oldest data and add the new data so the plot looks like it's moving from right to left as time progresses.
I suppose I could make it work by logging only changes which would definitely be more efficient - why write data if its unchanged. I would think that gnuplot would not produce pretty plots if there were huge gaps in times where the temperature remained unchanged. Hmm. Have to try that. Could work.
Sorry for the late reply.
My log file is actually created by a custom VB script. I have a USB Templinc which I wrote a VB script to query and process its temperature data. Because I'm a nerd, I have the script tracking the highest and lowest temperature recorded for the last three days (actually it can be any number of days, I just have it set to three).
After it takes the reading, the last thing the script does is write the date and time and temperature to a file along with the current highest and lowest temperature. When I plot this, I get a temperature swing between the high and low plots (they appear as stairstep lines when the high and lows change over time). Like I said earlier, HB's built in logging capabilities doesn't meet my needs, it adds too much data for gnuplot to use. I found it quite easy to write a VB script to open/append a file, write the data, and close it.
As for my logging rate (also the sampling rate), I update it once every 7 minutes. Why 7? I figured having an odd number would keep it from interfering with any other tasks that might be running at even intervals (like every 5 minutes, every hour, or half hour).
The only thing I haven't solved yet is how to prune my temperature log file that gnuplot uses to plot the data from. I just haven't gotten around to it. What I'd like to do is to prune the oldest data and add the new data so the plot looks like it's moving from right to left as time progresses.
I suppose I could make it work by logging only changes which would definitely be more efficient - why write data if its unchanged. I would think that gnuplot would not produce pretty plots if there were huge gaps in times where the temperature remained unchanged. Hmm. Have to try that. Could work.
-
- Senior Member
- Posts: 141
- Joined: Tue Jul 07, 2009 12:55 pm
- Location: NC
Re: graph and trends...
Hi,
Could you guys share the logging script? i am looking to set this up but i am not very good at scripting.
Thanks
Raptor
Could you guys share the logging script? i am looking to set this up but i am not very good at scripting.
Thanks
Raptor