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.
Post Reply
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Got it working! So far only in the local machine, I'm a bit confused as to how I should do to get this into the EGWebserver. Do I have to put the package in it's directory? AlsoI'm afraid I didn't manage to find out how to zoom and pan, but it's a very good start! :mrgreen: Thankz!
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

I'm a bit confused as to how I should do to get this into the EGWebserver. Do I have to put the package in it's directory?
Yes, you have to do that. To make it simple you can then set the HighCharts folder as your 'Html documents root'. In addition you need to make a small mod of the web server plugin to handle the special characters we have.

Find the line nbr 913 (in version 3.3) and change it to

Code: Select all

            path = join(path, word.decode('utf-8'))


To zoom somewhere in the chart: Press down left mouse button and drag to left or right. Release button.
To drag: do the same but also keep shift button on keyboard pressed down

Merry Xmas
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

I made some further experimental stuff with Highcharts. Attached is a template for the combo report that you could exploit a bit. I think it is not that bad after all
CreateComboHtml.py
(6.86 KiB) Downloaded 97 times
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

I like it, thanks! :mrgreen: One small gripe, though: I get a chaos of letters (I suppose it's times and dates) underneath. And I mean a chaos. Check this out (this is zoomed, if I don't zoom it's a lot worse):
chart.jpeg
Also I haven't been able to do the mod to the Webserver plug-in. I have no idea what to search for, and counting lines isn't good when I don't know if I should consider the comments as lines. Could you please tell me what line that should be before this mod?
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

@Mastiff

I think you should download & start to use a decent editor, you need it :mrgreen:

I suggest Notepad++
http://notepad-plus-plus.org/

It will show you the line numbers and others, it is very useful when editing python scripts and modifying existing python files.
I get a chaos of letters
The key to this is the parameter 'tickInterval' for the x-axis. I have tried to make this dynamically adjusted depending on the number of data readings presented in the graph. So in the attached version I have modified it further
CreateComboHtml.py
(6.86 KiB) Downloaded 95 times
The line (number 94) was looking like this

Code: Select all

            divisor = len(xaxis) * 0.1
but is now

Code: Select all

            divisor = len(xaxis) * 0.02
This gives a better look I think and is working ok for my database for temperature & humidity logging (every 10 minutes)
Also I haven't been able to do the mod to the Webserver plug-in. I have no idea what to search for, and counting lines isn't good when I don't know if I should consider the comments as lines. Could you please tell me what line that should be before this mod?
Well, with Notepad++ you will manage easily. Anyway, the code section where this line is located (and modified) looks like this:

Code: Select all

        for word in words:
            drive, word = splitdrive(word)
            head, word = split(word)
            if word in (curdir, pardir):
                continue
            path = join(path, word.decode('utf-8'))
        return path
#===============================================================================

class WsSendMessage(eg.ActionBase):

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

Re: ClimateDataCalculation

Post by Mastiff »

Back in the cabin, trying out the new stuff! :) Yeah, I'm using Notepad++ now. :) Pretty good, but it did mess up the plug-in file for the registry plugin when I tried to edit in the lines to allow a string in it. Doing exactly the same process (simple cut and paste) in my regular notepad didn't mess up anything... But it was pretty good last weekend when I was working on the new temperature control system! So thanks a lot for that tip! :D And for the new version, even though I am not sure if it changes that much. Look at the flow of numbers under the graph (which seems to be only minutes, not hours). Here's the week I'm using:
Climate combined report unzoomed.jpg
And here it is zoomed a lot:
Climate combined report unzoomed.jpg
Also I'm still stumped on that webserver plugin change. In my init.py file under the webserver plug-in directory there are no lines remotely like what you have written. Is it another file you mean? :oops:
Attachments
Climate combined report zoomed.jpg
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Hi, Krambriw! Could you please look at this?

Also, I think I may have messed up a bit with how to do the HTML pages. I have that set to happen on every sensorreading of one of the sensors in the combined report, and it locks up EG while it's done. It happens far too often. How are you doing this? Maybe with a timer that fires it every 15 minutes or so?
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

Maybe with a timer that fires it every 15 minutes or so?
Yes, that is more than enough. I do it today with a minute event (from SunTracker the current weather event) but that is also not really needed. Regarding the scale, I have not really figured all that out myself. I tried to make an automatic calculation depending on the length of the data series but is not working very well, still get too many ticks. Anyway, what is controlling this is the variable minTick (you find it in several places in CreateComboHtml.py). Eventually you can put in a fixed value to try like minTick = 100.0 and see what you think.

Also, once you have generated a page, you can edit this value directly in the html (there you have to change tickInterval for the x-axis), save, refresh and see the result
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Thanks! I will try that, then.
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

I'm fighting to get something that works for me here. But the weird thing is that I have to adjust the tick count in the webpage. No matter what I change in the python file it doesn't change at all. Any idea why that can be? I am changing the combo report file.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

I have to adjust the tick count in the webpage
When you do that, does it look good then?
What is the tick count that gives good result?

If you change in the python file, you have to restart EG after each change, otherwise the change is currently not incorporated (it is doable by inserting an 'import CreateComboHtml' statement also in the CombinedReport action _call_ )
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Aha, that explains why it didn't seem to change anything! Thanks!

Well, not good yet...and I think that's something about how highcharts chooses to display dates, hours and minutes. It just shows the first date (but that seems to be simply a start date) and then it shows minutes without hours or dates for the rest of the two weeks. I just wish I could find out how to show only dates or dates and hours. If I know where the date changes that would be a lot better than these random minute numbers. But maybe I should keep experimenting with numbers until I find something that shows whole hours or something. :mrgreen: Are those ticks seconds, minutes,or what?
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: ClimateDataCalculation

Post by Mastiff »

Testing more I see that if the number falls on 00 it will show that hour, not just the minute. It's very much hit and miss if I hit an hour or not. I could of course ask at the Highcharts forum, if I understood a bit more about how it actually works. So if you tell me what the tick count actually is,maybe I could post the contains of the html to the Highcharts forum and ask what has to be changed to show midnight for each day, or maybe even midnight and noon.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

See the generated 'categories' for the x-axis. Ticks are for each day, each new hour and in minutes in between. If you open 'view-source' in the web browser, you can see it in the created html file

Like in this example:

Code: Select all

    xAxis: {
    tickInterval: 9,
    categories: ['2015-03-31', '09', '10', '11', '12', '13', '13', '15', '16', '17', '18', '19', '20', '20', '22', '23', '24', '25', '25', '27', '28', '29', '30', '31', '31', '32', '34', '35', '36', '38', '39', '39', '41', '42', '43', '44', '45', '48', '49', '50', '50', '52', '53', '54', '55', '56', '57', '57', '58', '16:00', '01', '02', '03', '04', '04', '05', '07', '07', '09', '10', '11', '12', '12', '13', '15', '16', '17', '17', '18', '20', '21', '22', '23', '24', '26', '27', '28', '29', '29', '30', '33', '35', '36', '37', '38', '39', '39', '41', '42', '43', '44', '45', '46', '46', '47', '49', '50', '51', '52', '53', '53', '54', '56', '57', '58', '59', '17:00', '00', '01', '03', '04', '05', '06', '07', '07', '09', '10', '11', '12', '13', '13', '14', '16', '17', '18', '19', '19', '20', '22', '23', '24', '25', '26', '26', '27', '29', '30', '31', '32', '32', '33', '35', '36', '37', '38', '39', '40', '42', '43', '44', '45', '46', '47', '49', '50', '51', '52', '52', '53', '55', '56', '57', '58', '59', '59', '18:00', '01', '03', '04', '05', '05', '06', '07', '08', '10', '11', '12', '12', '13', '14', '16', '17', '18', '19', '19', '20', '22', '23', '24', '25', '26', '26', '27', '29', '30', '31', '31', '32', '33', '35', '36', '37', '38', '38', '39', '41', '41', '43', '44', '45', '46', '46', '47', '48', '49', '51', '52', '53', '54', '54', '55', '56', '58', '59', '19:00', '00', '01', '02', '03', '05', '06', '07', '08', '08', '09', '10', '11', '13', '14', '15', '15', '16', '18', '19', '20', '22', '23', '24', '25', '25', '26', '27', '29', '30', '31', '32', '34', '35', '35', '36', '37', '39', '40', '41', '42', '42', '43', '44', '46', '47', '48', '48', '49', '50', '51', '53', '54', '55', '55', '56', '57', '59', '20:00', '01', '02', '02', '03', '04', '06', '07', '08', '08', '09', '10', '12', '13', '14', '14', '15', '16', '18', '19', '20', '20', '21', '22', '23', '25', '26', '27', '29', '30', '31', '31', '32', '33', '34', '36', '37', '37', '38', '39', '40', '42', '43', '43', '44', '45', '46', '48', '49', '49', '50', '51', '53', '54', '55', '55', '56', '57', '58', '21:00', '01', '02', '02', '03', '04', '06', '07', '07', '08', '09', '10', '12', '13', '14', '15', '17', '18', '19', '19', '20', '21', '22', '24', '25', '26', '26', '28', '30', '30', '31', '32', '33', '35', '35', '36', '37', '38', '40', '41', '42', '43', '44', '45', '47', '48', '48', '49', '50', '52', '53', '53', '54', '55', '56', '57', '58', '22:00', '01', '01', '02', '03', '04', '05', '06', '08', '08', '09', '10', '11', '12', '14', '14', '15', '16', '17', '19', '20', '20', '21', '22', '24', '25', '26', '26', '27', '28', '29', '30', '31', '33', '34', '34', '35', '36', '37', '39', '40', '40', '41', '42', '43', '44', '45', '46', '49', '50', '52', '53', '53', '54', '55', '56', '57', '58', '23:00', '00', '01', '02', '03', '05', '05', '06', '07', '08', '09', '11', '11', '12', '13', '14', '15', '16', '18', '18', '19', '20', '21', '23', '23', '24', '25', '26', '27', '29', '29', '30', '31', '32', '33', '34', '36', '36', '37', '38', '39', '40', '42', '42', '43', '44', '45', '46', '48', '48', '49', '50', '51', '52', '53', '55', '55', '57', '58', '59', '2015-04-01', '02', '03', '04', '05', '07', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '31', '31', '32', '33', '34', '35', '36', '38', '38', '39', '40', '41', '43', '43', '44', '45', '46', '47', '48', '50', '50', '51', '52', '53', '54', '56', '56', '57', '58', '59', '01:00', '02', '02', '03', '04', '05', '07', '07', '08', '09', '10', '11', '12', '13',
A problem is we need a tick for each value to be displayed, otherwise I could have lived with less ticks for the x-axis
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: ClimateDataCalculation

Post by krambriw »

Also to be noticed is that the parameter 'tickInterval' is defining the density of those to be presented along the x-axis but I have not figured out how to control which ones (I think this is decided by HighCharts)

A higher value for sure gives less but if we for instance are only interested of those representing a new hour, I do not know how to control that
Post Reply