Skip to content
Permalink
Browse files

01.23.52

  • Loading branch information...
ToninoTarsi committed Feb 2, 2016
1 parent 54f994c commit 8231a0f3a9901acbeaab29fd3b6fa0a42fa01fb0
Showing with 116 additions and 64 deletions.
  1. +41 −0 TTLib.py
  2. +1 −1 VERSION
  3. +15 −3 config.py
  4. +0 −57 plugins/1minuteLogger.py
  5. +2 −1 swpi.py
  6. +13 −1 swpi_webconfig.py
  7. +44 −1 template.html
@@ -666,6 +666,47 @@ def logData(serverfile,SMSPwd):
# log( "Error connecting to server : " + serverfile )
# pass


def sentToWindFinder(WindFinder_ID,WindFinder_password):

if ( globalvars.meteo_data.last_measure_time == None):
return

delay = (datetime.datetime.now() - globalvars.meteo_data.last_measure_time)
delay_seconds = int(delay.total_seconds())

if ( delay_seconds > 200 ):
return

url = "http://www.windfinder.com/wind-cgi/httpload.pl?"
url+= "sender_id=" + WindFinder_ID
url+= "&password=" + WindFinder_password
url+= "&date=" + globalvars.meteo_data.last_measure_time.strftime("%d.%m.%Y")
url+= "time=" + globalvars.meteo_data.last_measure_time.strftime("%H:%M")
if ( globalvars.meteo_data.wind_ave ) != None :
url+= "&windspeed=" + str( float(globalvars.meteo_data.wind_ave)* 0.539957 )
if ( globalvars.meteo_data.wind_gust ) != None :
url+= "&gust==" + str( float(globalvars.meteo_data.wind_gust)* 0.539957 )
if ( globalvars.meteo_data.wind_dir ) != None :
url+= "&winddir==" + str(globalvars.meteo_data.wind_dir)
if ( globalvars.meteo_data.temp_out ) != None :
url+= "&airtemp==" + str(globalvars.meteo_data.temp_out)
if ( globalvars.meteo_data.rel_pressure ) != None :
url+= "&pressure==" + str(globalvars.meteo_data.rel_pressure )


#print parameters
try:
r = requests.get(url,timeout=10)
msg = r.text.splitlines()
#print r.text
if ( "OK" in r.text.upper() ):
log("Log to WindFinder : OK" )
else:
log("Log to WindFinder ERROR " + r.text)
except:
log( "Error Logging to WindFinder : " )

def UploadData(cfg):

if ( globalvars.meteo_data.last_measure_time == None):
@@ -1 +1 @@
01.23.39
01.23.52
@@ -270,6 +270,11 @@ def readCfg(self,verbose=False):
self.CWOP_ID = config.get('CWOP', 'CWOP_ID',"EW0000")
self.CWOP_password = config.get('CWOP', 'CWOP_password',"-1")

#[WindFinder]
self.WindFinder_logdata = config.getboolean('WindFinder', 'WindFinder_logdata',False)
self.WindFinder_ID = config.get('WindFinder', 'WindFinder_ID',"XXXXXX")
self.WindFinder_password = config.get('WindFinder', 'WindFinder_password',"******")

#[PWS]
self.PWS_logdata = config.getboolean('PWS', 'PWS_logdata',False)
self.PWS_ID = config.get('PWS', 'PWS_ID',"KCASANFR5")
@@ -308,9 +313,10 @@ def readCfg(self,verbose=False):
self.LayColorBBC = config.get('LayOut', 'LayColorBBC',"FF99FF")
self.LayColorBTC = config.get('LayOut', 'LayColorBTC',"0000FF")

if ( not os.path.isfile(self.cfgName) ):
f = open(self.cfgName,"w")
config.write(f)
# if ( not os.path.isfile(self.cfgName) ):
f = open(self.cfgName,"w")
config.write(f)
f.close()


def writeCfg(self):
@@ -467,6 +473,12 @@ def writeCfg(self):
config.setboolean('CWOP', 'CWOP_logdata',self.CWOP_logdata)
config.setstr('CWOP', 'CWOP_ID',self.CWOP_ID)
config.setstr('CWOP', 'CWOP_password',self.CWOP_password)

#[WindFinder]
config.setboolean('WindFinder', 'WindFinder_logdata',self.WindFinder_logdata)
config.setstr('WindFinder', 'WindFinder_ID',self.WindFinder_ID)
config.setstr('WindFinder', 'WindFinder_password',self.WindFinder_password)


#[DNS Exit]
config.setboolean('DNSExit', 'use_DNSExit',self.use_DNSExit)

This file was deleted.

@@ -1116,7 +1116,8 @@ def answer_call(modem, message):
log("Logging data to PWS ...")
logDataToPWS(cfg.PWS_ID,cfg.PWS_password,cfg.wind_speed_units)


if ( cfg.WindFinder_logdata and globalvars.meteo_data.last_measure_time != None and globalvars.meteo_data.status == 0 ) :
sentToWindFinder(cfg.WindFinder_ID,cfg.WindFinder_password)

thenewIP = getPublicIP()
if ( thenewIP != None and publicIP != thenewIP ):
@@ -164,6 +164,12 @@ def outputPage(cfg):
d.update(CWOP_logdata=cfg.CWOP_logdata)
d.update(CWOP_ID=cfg.CWOP_ID)
d.update(CWOP_password=cfg.CWOP_password)

#[WindFinder]
d.update(WindFinder_logdata=cfg.WindFinder_logdata)
d.update(WindFinder_ID=cfg.WindFinder_ID)
d.update(WindFinder_password=cfg.WindFinder_password)


#[PWS]
d.update(PWS_logdata=cfg.PWS_logdata)
@@ -356,7 +362,13 @@ def outputPage(cfg):
#[CWOP]
cfg.CWOP_logdata = request['CWOP_logdata'][0]
cfg.CWOP_ID = request['CWOP_ID'][0]
cfg.CWOP_password = request['CWOP_password'][0]
cfg.CWOP_password = request['CWOP_password'][0]


#[WindFinder]
cfg.WindFinder_logdata = request['WindFinder_logdata'][0]
cfg.WindFinder_ID = request['WindFinder_ID'][0]
cfg.WindFinder_password = request['WindFinder_password'][0]

#[PWS]
cfg.PWS_logdata = request['PWS_logdata'][0]
@@ -567,6 +567,14 @@
}
}
dd = document.getElementById('WindFinder_logdata');
for (var i = 0; i < dd.options.length; i++) {
if (dd.options[i].text == '$WindFinder_logdata') {
dd.selectedIndex = i;
break;
}
}
dd = document.getElementById('use_DNSExit');
for (var i = 0; i < dd.options.length; i++) {
@@ -1753,6 +1761,41 @@
value=$CWOP_password style="width: 100%" /></td>
</tr>
</table>

<br />

<table bgcolor=$LayColorTBC border="1" frame="box" width="830px">
<tr>
<td class="style7" colspan="2" style="font-size: large; color:$LayColorTTC;">
Wind Finder</td>
</tr>
<tr>
<td class="style8" bgcolor="$LayColorBBC">
<font color=$LayColorBTC>Log data to Wind Finder (WindFinder_logdata)</font></td>
<td class="style20" bgcolor="$LayColorBBC">
<select id="WindFinder_logdata" type="text" name="WindFinder_logdata"
style="width: 100%" >
<option value=True >True</option>
<option value=False >False</option>
</select></td>
</tr>
<tr>
<td class="style8" bgcolor="$LayColorBBC">
<font color=$LayColorBTC>Wind Finder&nbsp; station ID (<b>WindFinder_ID</b>)</font></td>
<td class="style19" bgcolor="$LayColorBBC">
<input id="WindFinder_ID" type="text" name="WindFinder_ID"
value=$WindFinder_ID style="width: 100%" /></td>
</tr>
<tr>
<td class="style8" bgcolor="$LayColorBBC">
<font color=$LayColorBTC>Wind Finder&nbsp; password (WindFinder_password)</font></td>
<td class="style19" bgcolor="$LayColorBBC">
<input id="Text4" type="text" name="WindFinder_password"
value=$WindFinder_password style="width: 100%" /></td>
</tr>
</table>


<br />

<table bgcolor=$LayColorTBC border="1" frame="box" width="830px">
@@ -1779,7 +1822,7 @@
</tr>
<tr>
<td class="style8" bgcolor="$LayColorBBC">
<font color=$LayColorBTC>CWOP&nbsp; password (PWS_password)</font></td>
<font color=$LayColorBTC>PWS&nbsp; password (PWS_password)</font></td>
<td class="style19" bgcolor="$LayColorBBC">
<input id="PWS_password" type="text" name="PWS_password"
value=$PWS_password style="width: 100%" /></td>

0 comments on commit 8231a0f

Please sign in to comment.
You can’t perform that action at this time.