Page 9 of 37

Re: ClimateDataCalculation

Posted: Thu Apr 09, 2015 6:47 pm
by Mastiff
That worked perfectly, thans! :mrgreen: Takes around 20 seconds to upload the file, which is no problem since it doesn't lock up anything. One thing I don't get is the way it prints time:

Code: Select all

20:44:59      1428605099.37
Any idea why it does that?

Oh, btw to upload more than one file, is it only the last part that needs to be repeated? This part:

Code: Select all

fname = 'inne.html'

transferCommandThreadEvent = Event()
transferCommandThread = Thread(
    target=fileTransfer,
    args=(transferCommandThreadEvent, fname)
)
transferCommandThread.start()

Re: ClimateDataCalculation

Posted: Thu Apr 09, 2015 6:59 pm
by Mastiff
I tried to create a report for the temperature outside as well, but I got an error on that one:

Code: Select all

20:56:55      Error in Action: "ClimateDataCalculation: CombinedReport: (u'Ute under hytta',)"
20:56:55      Traceback (most recent call last) (1691):
20:56:55        File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
20:56:55          return self(*args)
20:56:55        File "C:\Program Files (x86)\EventGhost\plugins\ClimaDataCalculation\__init__.py", line 1856, in __call__
20:56:55          3
20:56:55        File "C:\Program Files (x86)\EventGhost\plugins\ClimaDataCalculation\CreateComboHtml.py", line 277, in CreateComboHtml
20:56:55          logstr = MakeChart(rows_1, pos_1, 'Temperature', ' degrees C')
20:56:55        File "C:\Program Files (x86)\EventGhost\plugins\ClimaDataCalculation\CreateComboHtml.py", line 237, in MakeChart
20:56:55          logstr += "<p><small>Selected period: "+selectedPeriod+"</small></p>"+'\n\r'
20:56:55      UnboundLocalError: local variable 'selectedPeriod' referenced before assignment
Can this be because I have a multi word name on the sensor? I have another one, Utetemperatur ved d├©ra, which I thought was the problem because of the Norwegian ├©, but it turned out to give the error without that as well.

Re: ClimateDataCalculation

Posted: Fri Apr 10, 2015 5:58 am
by krambriw
The error was due to another 'not so well covered situation'.....exception handling is the most time consuming part of software design :oops:
New version of CreateComboHtml.py is now available.

The time is printed in seconds since the epoch (in UNIX this is Jan 1st 1970). If you want something more fancy you can format it differently or you can save the values to variables and subtract at the end, you will get the seconds elapsed. For this script, it was only interesting initially so I think we do not need the time at all.

To upload more files, yes you are correct if all files are in the same path.

Re: ClimateDataCalculation

Posted: Fri Apr 10, 2015 9:20 am
by Mastiff
Thanks! I agree, the date/time isn't really necessary. I'll just edit those lines and put in "Starting" and "Done" or something instead. So if exceptions are a problem I'm sure you're glad you have an exceptional alpha/beta tester! :lol: But seriously, I still have problems with the one with the ├© in it:

Code: Select all

11:04:31      Error in Action: "ClimateDataCalculation: CombinedReport: (u'Ute under hytta', u'Utetemperatur ved d\xf8ra')"
11:04:31      Traceback (most recent call last) (1691):
11:04:31        File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
11:04:31          return self(*args)
11:04:31        File "C:\Program Files (x86)\EventGhost\plugins\ClimaDataCalculation\__init__.py", line 1856, in __call__
11:04:31          3
11:04:31        File "C:\Program Files (x86)\EventGhost\plugins\ClimaDataCalculation\CreateComboHtml.py", line 283, in CreateComboHtml
11:04:31          logstr = MakeChart(rows_1, pos_1, 'Temperature', ' degrees C')
11:04:31        File "C:\Program Files (x86)\EventGhost\plugins\ClimaDataCalculation\CreateComboHtml.py", line 235, in MakeChart
11:04:31          series['name'] = str(tableId)
11:04:31      UnicodeEncodeError: 'ascii' codec can't encode character u'\xf8' in position 19: ordinal not in range(128)
Is that somethign that can't be done, so I have to delete that database and start anew, can it be fixed in the script or can I change the database in any way?

Re: ClimateDataCalculation

Posted: Fri Apr 10, 2015 9:39 am
by krambriw
Must be possible to solve

What happens if you change line 235 to

Code: Select all

series['name'] = tableId

Re: ClimateDataCalculation

Posted: Fri Apr 10, 2015 9:48 am
by Mastiff
Then I get no errors! But the graph is empty. I do have a data series, though:

Code: Select all

series: [{data: [6.7999999999999998, 6.7999999999999998, 6.7999999999999998, 6.7999999999999998, 6.7999999999999998, 6.7999999999999998, 6.7999999999999998, 6.7999999999999998, 6.7999999999999998, 6.9000000000000004, 6.9000000000000004, 6.9000000000000004, 7.0, 7.0, 7.0, 7.0, 7.0999999999999996, 7.0999999999999996, 7.0999999999999996, 7.0999999999999996, 7.0999999999999996, 7.2000000000000002, 7.2000000000000002, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0], name: u'Utetemperatur ved d\xf8ra'}]
It's much longer, but it seems 119 810 characters is a bit much for a post here! :mrgreen:

Re: ClimateDataCalculation

Posted: Fri Apr 10, 2015 10:07 am
by Mastiff
I have another problem I just discovered: When trying to get a report for one of my sensors (a Viking that runs on the Tellstick Duo setup with NetHomeServer) there's no data. But there is a lot of data in the database. I printed it, and it locked up EG for a while, but there is lots there. Here's an example:

Code: Select all

12:04:55      (u'2015-02-04 13:15:01', 1423052101, u'Ute under hytta', 0.10000000000000001, u'', 5.0, 5.0, 0.040000000000000001)
12:04:55      (u'2015-02-04 13:16:37', 1423052197, u'Ute under hytta', 0.10000000000000001, u'', 5.0, 5.0, 0.059999999999999998)
12:04:55      (u'2015-02-04 13:18:12', 1423052293, u'Ute under hytta', 0.20000000000000001, u'', 5.0, 5.0, 0.10000000000000001)
12:04:55      (u'2015-02-04 13:19:49', 1423052389, u'Ute under hytta', 0.20000000000000001, u'', 5.0, 5.0, 0.14000000000000001)
12:04:55      (u'2015-02-04 13:21:25', 1423052485, u'Ute under hytta', 0.20000000000000001, u'', 5.0, 5.0, 0.16)
12:04:55      (u'2015-02-04 13:23:00', 1423052581, u'Ute under hytta', 0.20000000000000001, u'', 5.0, 5.0, 0.17999999999999999)
12:04:55      (u'2015-02-04 13:24:37', 1423052677, u'Ute under hytta', 0.29999999999999999, u'', 5.0, 5.0, 0.22)
12:04:55      (u'2015-02-04 13:27:01', 1423052822, u'Ute under hytta', 0.29999999999999999, u'', 5.0, 5.0, 0.23999999999999999)
12:04:55      (u'2015-02-04 13:28:36', 1423052917, u'Ute under hytta', 0.29999999999999999, u'', 5.0, 5.0, 0.26000000000000001)
12:04:55      (u'2015-02-04 13:30:13', 1423053013, u'Ute under hytta', 0.29999999999999999, u'', 5.0, 5.0, 0.28000000000000003)
12:04:55      (u'2015-02-04 13:31:48', 1423053109, u'Ute under hytta', 0.29999999999999999, u'', 5.0, 5.0, 0.29999999999999999)
12:04:55      (u'2015-02-04 13:34:12', 1423053253, u'Ute under hytta', 0.29999999999999999, u'', 5.0, 5.0, 0.29999999999999999)
12:04:55      (u'2015-02-04 13:35:48', 1423053349, u'Ute under hytta', 0.29999999999999999, u'', 5.0, 5.0, 0.29999999999999999)
12:04:55      (u'2015-02-04 13:38:12', 1423053493, u'Ute under hytta', 0.40000000000000002, u'', 5.0, 5.0, 0.32000000000000001)
12:04:55      (u'2015-02-04 13:39:48', 1423053589, u'Ute under hytta', 0.40000000000000002, u'', 5.0, 5.0, 0.34000000000000002)
12:04:55      (u'2015-02-04 13:41:25', 1423053685, u'Ute under hytta', 0.40000000000000002, u'', 5.0, 5.0, 0.35999999999999999)
12:04:55      (u'2015-02-04 13:43:01', 1423053781, u'Ute under hytta', 0.40000000000000002, u'', 5.0, 5.0, 0.38)
12:04:55      (u'2015-02-04 13:44:36', 1423053877, u'Ute under hytta', 0.40000000000000002, u'', 5.0, 5.0, 0.40000000000000002)
12:04:55      (u'2015-02-04 13:46:12', 1423053973, u'Ute under hytta', 0.40000000000000002, u'', 5.0, 5.0, 0.40000000000000002)
12:04:55      (u'2015-02-04 13:47:49', 1423054069, u'Ute under hytta', 0.5, u'', 5.0, 5.0, 0.41999999999999998)
12:04:55      (u'2015-02-04 13:49:24', 1423054165, u'Ute under hytta', 0.5, u'', 5.0, 5.0, 0.44)
If I knew anything about this, I'd say that the problem is that it's not formatted in a way that the report can read. Would that be right? :mrgreen:

Re: ClimateDataCalculation

Posted: Fri Apr 10, 2015 10:26 am
by krambriw
You can zip and email me your database, it makes it easier for me to find the problem. It could be a unicode or another problem

I'll pm you my email

Re: ClimateDataCalculation

Posted: Fri Apr 10, 2015 10:35 am
by Mastiff
OK, will do. :)

Re: ClimateDataCalculation

Posted: Sat Apr 11, 2015 8:48 am
by krambriw
OK, I think I have fixed it. It was an issue with character encoding and it looks ok now. Please try the latest version

Best regards

Re: ClimateDataCalculation

Posted: Sat Apr 11, 2015 8:56 am
by Mastiff
Good morning, sir! :mrgreen: Yep, that fixed the one with the ├©, thanks a lot! :) But I do not see anything for the other one (the one called "Ute under hytta"), which is captured via NetHomeServer.

Re: ClimateDataCalculation

Posted: Sat Apr 11, 2015 9:06 am
by Mastiff
Btw, would it be possible to have a custom heading, so instead of "EventGhost Climate Data Report Graph" I could have for instance "Innetemperaturer"?

Re: ClimateDataCalculation

Posted: Sat Apr 11, 2015 11:27 am
by krambriw
"Ute under hytta"
You mean this one? As you see, the latest data is from Feb 4 so you need to set number of days to cover from today and backward (I put in 70 days just for testing purpose)
Skärmklipp.PNG
custom heading
Is doable, just need to add a field for that in the report creation action(s)

Re: ClimateDataCalculation

Posted: Sat Apr 11, 2015 12:31 pm
by Mastiff
Yep, that's the one. Only it's capturing data. At least it should do that. Is there a possibility that it's not capturing because something happens when the reading comes from NHS?

Code: Select all

2015-04-11 14:29:02     MACRO: Ute Viking1
2015-04-11 14:29:02        ACTION: Python Script
2015-04-11 14:29:02        ACTION: ClimateDataCalculation: TempDataCapture: Ute under hytta
Edit: I discovered yesterday that it had the wrong Device ID because NHS reports the device ID 37376 as 1170. So I corrected that and thought it was capturing as it should. But I just now did a printout of the database, and it hasn't captured antyhing shince the 4th of Feb. So it seems the capture doesn't work with the Viking through NHS.

And that extra filed would be nice! Maybe even one for the page name that shows on browser (so I can use the same name for everything that's connected to the cabin) and one for the heading in the webpage. I could of course edit it in the Python file, but then it would have to be done every time there's a new version. :mrgreen:

Re: ClimateDataCalculation

Posted: Sat Apr 11, 2015 1:40 pm
by krambriw
So it seems the capture doesn't work with the Viking through NHS
Correct, currently capturing is only working with RFXtrx and TellStickDuo directly. The idea I had was to add other sources. If you provide the NHS event here for the Viking sensor, I will add it