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.
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
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: ClimateDataCalculation
New version uploaded
- Added action to create Wind Rose reports using captured direction and average strength data
- Added regular updates (re-read) of table names
Support for wind in the ComboReport is using the captured gust data
As example of the wind rose below (my neighbor must have a problem with his wind sensor since it is always just showing 'N'...)
- Added action to create Wind Rose reports using captured direction and average strength data
- Added regular updates (re-read) of table names
Support for wind in the ComboReport is using the captured gust data
As example of the wind rose below (my neighbor must have a problem with his wind sensor since it is always just showing 'N'...)
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: ClimateDataCalculation
So a wildcard upload isn't possible? Well, it works like this, first defining the list:
And then running the upload:
I'm pretty proud of me, even if that only uploads the first file (which for some reason is 2.html)! Maybe you can tell mye how to get it looping?
I'm pretty sure that's not correct, but it's an attempt...
Was the attempt good enough for me to give me the code?
Btw, I can't get any data from the wind sensor file. I use this code:
At it says that:
From what I gather that means that it's empty. But it isn't, the file is 277 kb so far. My lightData is 0, so is my humData, so do you know what can be the problem?
Code: Select all
eg.globals.FTPliste = {
"1":"1",
"2":"2"}Code: Select all
import time
from threading import Thread, Event
def fileTransfer(transferCommandThreadEvent, fname):
from ftplib import FTP
ftp = FTP('ftp.hobsyssel.no')
ftp.login('hobsyssel.no', '0bel1xG@ller')
f = open("D:\\EventGhost\\Webserver for EventGhost\\Rom\\"+fname+".html", 'r')
ftp.cwd('/EG')
try:
ftp.delete(fname)
except:
pass
ftp.storlines('STOR '+fname+".html", f)
ftp.quit()
f.close()
transferCommandThreadEvent.set()
rows = eg.globals.FTPliste
for row in rows:
transferCommandThreadEvent = Event()
transferCommandThread = Thread(
target=fileTransfer,
args=(transferCommandThreadEvent, row)
)
transferCommandThread.start()I'm pretty sure that's not correct, but it's an attempt...
Btw, I can't get any data from the wind sensor file. I use this code:
Code: Select all
import sqlite3
def GetAllData(
dbName,
dbTableId
):
dbName = str(dbName)
conn = sqlite3.connect(dbName)
c = conn.cursor()
t = ((dbTableId),)
try:
c.execute('SELECT * FROM '+dbName.split('.')[0]+' WHERE tableId=?', t)
coll = c.fetchall()
conn.close()
return coll
except:
conn.close()
return None
rows = GetAllData('windData.db', 'Vindmåler')
for row in rows:
print rowCode: Select all
09:14:19 Traceback (most recent call last):
09:14:19 Python script "63", line 22, in <module>
09:14:19 for row in rows:
09:14:19 TypeError: 'NoneType' object is not iterableRe: ClimateDataCalculation
Sorry, didn't see your second message. Here's my wind rose (which works even though I can get no data from the database with the code over). Very nice!
But I have one thing (of course): Is it possible to replace the English directions with Norwegian? Or is that hardcoded in the graph?
But I have one thing (of course): Is it possible to replace the English directions with Norwegian? Or is that hardcoded in the graph?
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: ClimateDataCalculation
Nice wind rose!!!
This script works with my dataBtw, I can't get any data from the wind sensor file. I use this code:
Code: Select all
import sqlite3
try:
conn = sqlite3.connect('windData.db')
dbTableId = 'WindSensor on roof'
t = ((dbTableId),)
c = conn.cursor()
q = 'SELECT * FROM windData WHERE tableId=?'
p = c.execute(q, t)
coll = c.fetchall()
for item in coll:
print item
del coll
except sqlite3.Error, e:
conn.rollback()
print "Error %s:" % e.args[0]
finally:
if conn:
conn.close()
I think something like this ( not tested):I'm pretty sure that's not correct, but it's an attempt...
Code: Select all
import time
from threading import Thread, Event
def fileTransfer(transferCommandThreadEvent, rows):
from ftplib import FTP
ftp = FTP('ftp.hobsyssel.no')
ftp.login('hobsyssel.no', '0bel1xG@ller')
ftp.cwd('/EG')
for fname in rows:
f = open("D:\\EventGhost\\Webserver for EventGhost\\Rom\\"+fname+".html", 'r')
try:
ftp.delete(fname+".html")
except:
pass
ftp.storlines('STOR '+fname+".html", f)
f.close()
ftp.quit()
transferCommandThreadEvent.set()
#rows = eg.globals.FTPliste
rows = [
"1",
"2"
]
transferCommandThreadEvent = Event()
transferCommandThread = Thread(
target=fileTransfer,
args=(transferCommandThreadEvent, rows)
)
transferCommandThread.start()
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: ClimateDataCalculation
Currently hardcoded in CreateWindRoseHtml.py but I could make a list in that file that you can translate into Norwegian. Format like belowIs it possible to replace the English directions with Norwegian?
Code: Select all
directions = [
'N',
'NNE',
'NE',
'ENE',
'E',
'ESE',
'SE',
'SSE',
'S',
'SSW',
'SW',
'WSW',
'W',
'WNW',
'NW',
'NNW'
]
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: ClimateDataCalculation
Uploaded a new version of Currently CreateWindRoseHtml.py
Go to line 46, there is this list, translate to Norwegian and you are done (please always keep a copy of your translation to re-use for coming versions if needed):
Go to line 46, there is this list, translate to Norwegian and you are done (please always keep a copy of your translation to re-use for coming versions if needed):
Code: Select all
directions = [
'N',
'NNE',
'NE',
'ENE',
'E',
'ESE',
'SE',
'SSE',
'S',
'SSW',
'SW',
'WSW',
'W',
'WNW',
'NW',
'NNW'
]
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: ClimateDataCalculation
Thanks! I'll check out that FTP code later today. As for the wind, would it be possible to have the script call rose.txt if it excists and then parse the list from there? That way there's no need to change for new versions.
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: ClimateDataCalculation
I put the list in a separate file rose.py that you can translateAs for the wind, would it be possible to have the script call rose.txt
Files updated and uploaded
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: ClimateDataCalculation
Brilliant, thank you! 
Re: ClimateDataCalculation
Oops... crashed and burned badly. East is ├ÿ/├©st in Norwegian, and it didn't like the ├©!
Didn't like the Swedish Ö either...
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: ClimateDataCalculation
Put your translated list here as ode and I will try to fix the utf-8 stuff
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: ClimateDataCalculation
Thanks! I saved it as UTF-8 and was able to start EG (which gave me only errors when it was saved as ANSI), but I'm still not able to do that report. Here it is:
Code: Select all
directions = [
'N',
'NN├ÿ',
'N├ÿ',
'├ÿN├ÿ',
'├ÿ',
'├ÿS├ÿ',
'S├ÿ',
'SS├ÿ',
'S',
'SSV',
'SV',
'VSV',
'V',
'VNV',
'NV',
'NNV'
]
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: ClimateDataCalculation
Finally...new version uploaded (CreateWindRoseHtml.py and rose.py)
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: ClimateDataCalculation
Great, thanks! Btw I wonder if there is a problem with my sensor, or if there's no northwesterne at my cabin! 
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: ClimateDataCalculation
Hard to sayBtw I wonder if there is a problem with my sensor, or if there's no northwesterne at my cabin!
1) Could be you had no wind in that direction
2) Check the database and see if you find any entry
3) Could be a bug in the RFXtrx plugin (I hope not...)
4) Could be a bug in RFXtrx firmware...
You have seen that I only get N from my neighbor so something must be wrong somewhere...
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM