Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

ClimateDataCalculation

Questions and comments specific to a particular plugin should go here.
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

No, the last part I think I can already do with the code you gave me a few pages back. I just didn't explain it properly. :) I want the graph to be basically how it is now, but I want the starting point of the graph to be 0, not whatever the total value of the sensor shows when it starts. So instead of it now starting (for today) on 167 mm and ending on 172, I want it to start on 0 and end on 5 mm. Was that a bit clearer? :lol: Also, if possible, I would like the graph picture to show the numbers as numbers.

Btw would it be possible to integrate this stuff in Highcharts, which templigt uses? They are free for Non-commercial use and pretty advanced:

http://www.highcharts.com/products/high ... commercial

I really like the way it's shown on my account with Templight, I just want it to be on my own system. Here's a temperature graph on the outside of my house:

http://www.templight.se/scenario_extern ... 87IPAE1RQE

And soon I'll be singing "Baby, It's Cold Outside"... Hate winter! :evil:
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

There are millions of possibilities and variants, it is just about data manipulation and putting the result into charts. Google Charts is one.
https://developers.google.com/chart/int ... docs/index

I have attached a new file for generating the html page that I hope is presenting the result close to what you expected. See picture below from my simulated rain events.
Image3.jpg
Btw would it be possible to integrate this stuff in Highcharts
Anything is possible but sorry, I do not have the time,energy or interest to do it. You have a plugin that is collecting the data and storing it in a database, you have samples of code how to read the data and how to generate a html page. It is also not too hard to modify the layout and content continuing using Google Chart. To take it further it would require some calories, still achievable, but you or someone helping you must master javascript, html and some python. That is what it's all about.

BR
CreateHtml.py
(2.89 KiB) Downloaded 119 times
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Thanks! I'll try this one. As for mastering anything more than BASIC, I'm afraid I'm out on my depth... Hey, you don't know about any of those systems that do run on BASIC? Or maybe DOS batch files? :mrgreen:
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

Hey, you don't know about any of those systems that do run on BASIC? Or maybe DOS batch files?
Sure I do, Visual Basic, Quick Basic (if you remember...) but I left that behind and moved on a couple of years ago
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Well, actually I thought about the 1964 version... :lol: Visual Basic is a bit too new and fancy for me. After all it came in the 90's!
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

I have made a further enhancement of the plugin with new report formatting templates, specifically for temperature and humidity sensor data capturing and reporting. Unfortunately the database structure for temperatures and humidity has changed so they need to be reset or deleted for this version to work (rain database is unchanged).

Generating a html report for humidity and temperature now also include lines for upper and lower limits (setpoint +/- hysteresis/2) and the calculated moving average. See examples below.

New version can be downloaded from here:
http://sto.hopto.org/Under%20constructi ... 20version/
Image2.jpg
Image1.jpg
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Thanks! No worries, I haven't started capturing those yet. But I will start now! :mrgreen:

But I'm a bit confused about this rain graph. Is it supposed to look like this:
Rain graph.png
I must say that I would prefer something with a line, like the other two you showed above. If possible. :)

OK, tried to capture temp now, but it doesn't seem to work:

Code: Select all

19:56:31   TellStickDuo.fineoffset.temperature.146.Temperature '4.8'
19:56:31      Ute Viking1
19:56:31         Python Script
19:56:31         ClimateDataCalculation: TempDataCapture: Under hytta
19:56:31            Error in Action: "ClimateDataCalculation: TempDataCapture: Under hytta"
19:56:31            Traceback (most recent call last) (1669):
19:56:31              File "C:\Programfiler\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
19:56:31                return self(*args)
19:56:31              File "C:\Programfiler\EventGhost\plugins\ClimaDataCalculation\__init__.py", line 1139, in __call__
19:56:31                temperature,
19:56:31            UnboundLocalError: local variable 'temperature' referenced before assignment
19:56:31   TellStickDuo.fineoffset.temperature.146.Temperature '4.8'
19:56:31      Ute Viking1
19:56:31         Python Script
19:56:31         ClimateDataCalculation: TempDataCapture: Under hytta
19:56:31            Error in Action: "ClimateDataCalculation: TempDataCapture: Under hytta"
19:56:31            Traceback (most recent call last) (1669):
19:56:31              File "C:\Programfiler\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
19:56:31                return self(*args)
19:56:31              File "C:\Programfiler\EventGhost\plugins\ClimaDataCalculation\__init__.py", line 1139, in __call__
19:56:31                temperature,
19:56:31            UnboundLocalError: local variable 'temperature' referenced before assignment
I have no idea why I'm getting two of the same event, though.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

The plugin action was not perfectly supporting viking sensors (fineoffset) event message format (Fixed in the new version). When you configure the TempDataCapture action for your Viking device, the device ID shall be 146.

Attached is a sample picture for the rain report. Is this better looking? I have used a smooth line graph. The available variants of graphs can be found here:
https://developers.google.com/chart/int ... cs/gallery
Image1.jpg
There is however something strange with your rain data, it should not be all zeros below the x-axis and the total rain accumulated does not match with the values in the chart. Compare with my chart, this is the way it should look like.

Can you run the script you received earlier and present the resulting lines here (or zip into a txt file)

Best regards
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Sorry, but that didn't fix my Viking. Those pesky vikings are always a bother, just ask English and Scottish nuns... :lol:

Code: Select all

09:10:57      Ute Viking1
09:10:57         Python Script
09:10:57         ClimateDataCalculation: TempDataCapture: Underhytta
09:10:57            Error in Action: "ClimateDataCalculation: TempDataCapture: Underhytta"
09:10:57            Traceback (most recent call last) (1669):
09:10:57              File "C:\Programfiler\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
09:10:57                return self(*args)
09:10:57              File "C:\Programfiler\EventGhost\plugins\ClimaDataCalculation\__init__.py", line 1149, in __call__
09:10:57                rule
09:10:57              File "C:\Programfiler\EventGhost\plugins\ClimaDataCalculation\__init__.py", line 397, in SaveTempData
09:10:57                c.execute(ss,lst)
09:10:57            OperationalError: table tempData has 5 columns but 8 values were supplied
09:10:57   TellStickDuo.fineoffset.temperature.146.Temperature '5.5'
09:10:57      Ute Viking1
09:10:57         Python Script
09:10:57         ClimateDataCalculation: TempDataCapture: Underhytta
09:10:57            Error in Action: "ClimateDataCalculation: TempDataCapture: Underhytta"
09:10:57            Traceback (most recent call last) (1669):
09:10:57              File "C:\Programfiler\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
09:10:57                return self(*args)
09:10:57              File "C:\Programfiler\EventGhost\plugins\ClimaDataCalculation\__init__.py", line 1149, in __call__
09:10:57                rule
09:10:57              File "C:\Programfiler\EventGhost\plugins\ClimaDataCalculation\__init__.py", line 397, in SaveTempData
09:10:57                c.execute(ss,lst)
09:10:57            OperationalError: table tempData has 5 columns but 8 values were supplied
As for the database, here you go. I had to try twice, the first time EG just locked up, probably because of the amount of data.
Attachments
database rain.txt
(159.81 KiB) Downloaded 93 times
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

Thanks, it looks like your tempData.db still has the old structure (5 columns) but the new has to be 8 columns. Try to reset the template or simply delete the tempData.db file in the EG folder (exit EG first, delete file, start EG).

The rain database looks ok I think. A report on that data should show very little rain (2 mm total)
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Thanks, that works! :) No more funny stuff on the temp. Another thing: Is there a way to avoid "target value" for temperature? I really don't need that for outside sensors, I think it's kind of hard to affect the Norwegian weather, so even if I set a target value of 22 today, I'm afraid it will still be 3 degrees... :lol:

I have 6 mm on my chart, but that's the last two days. And I still have that same type of charts, did you change it?

Finally, for some completely different (a Norwegian blue, and it's dead...): Is it possible to have more than one temperature shown in the same graph? It would be nice to be able to see for instance the living room, bathroom and home office on the same graph.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

Perfect, very good
Another thing: Is there a way to avoid "target value" for temperature? I really don't need that for outside sensors
Is it just to avoid it in the graph or are you using the events when the moving average of temperature is crossing target value +/- hysteresis to control something, like a heater or so?
And I still have that same type of charts, did you change it?
Yes I did, I updated the CreateHtml.py file. Please note that you have to restart EG when you replace a .py file otherwise the old one will still be loaded and in use.
CreateHtml.py
(2.92 KiB) Downloaded 103 times
Is it possible to have more than one temperature shown in the same graph?
Yes it is possible but I need to create a new action where you can select multiple temperatures into a single graph. Also a new html.py template is needed for this. I will look into this.
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

I always kill what I'm upgrading. And still I don't see the correct line graph. I have the one I showed earlier. I know I've fired the event for report too. :shock:

As for the target I mean in the graph. It would be nice to have that optional, so I can use it on the temps that I want it for, but drop it for the temps where it doesn't make any sense.

And thanks, I'd very much like a graph with more temperatures! Perhaps even as may as I like? And even with the rain and wind and humitidy all mixed in. Then we have a full on Oregon Pro on stereoids! :mrgreen:
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

A new version is available with a new action , 'CombinedReport' (and corresponding template 'CreateComboHtml.py') where you can select which data sources that shall be included in the chart. See settings dialog below. The result of my test report looks like below (picture is much zoomed in and ugly but it gives you an idea).

Initially, I targeted to bring all types of the same kind into a single graph but that will not work very well since you might have various sampling rates for the sources. Also the smoothing function provided by Google Chart is not so good I think so I skipped that.

Best regards,
Image1.jpg
Image2.jpg
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Thanks! I was hoping for one chart with a bunch of lines, but if it's not practical it's not. Sample rates are no problem, I take a new reading for every trigger of the sensor, and I have put the values to one minute. I have it up and running now, so I'm waiting to see what it will look like when there are more readings. :)

But I have one problem: I still have my rain graph looking like this:
Another rain graph.png


What am I doing wrong?
Post Reply