Skip to content

Commit

Permalink
Make weathercloud upload of internal data optional
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Aug 30, 2018
1 parent 56ec5a2 commit 8830155
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '18.8.0'
_release = '1611'
_commit = 'b8d4f8e'
_release = '1613'
_commit = '56ec5a2'
17 changes: 11 additions & 6 deletions src/pywws/service/weathercloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
[weathercloud]
deviceid = XXXXXXXXXXXX
devicekey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
internal = True
[logged]
services = ['weathercloud', 'metoffice']
Expand Down Expand Up @@ -52,24 +53,21 @@

class ToService(pywws.service.LiveDataService):
config = {
'deviceid' : ('', True, 'wid'),
'devicekey': ('', True, 'key'),
'deviceid' : ('', True, 'wid'),
'devicekey': ('', True, 'key'),
'internal' : ('False', True, None),
}
fixed_data = {'ver': pywws.__version__, 'type': '481'}
interval = timedelta(seconds=600)
logger = logger
service_name = service_name
template = """
#live#
#temp_in "'tempin' : '%.1f',"#
#temp_out "'temp' : '%.1f',"#
#calc "wind_chill(data['temp_out'], data['wind_ave'])" "'chill' : '%.1f',"#
#calc "dew_point(data['temp_in'], data['hum_in'])" "'dewin' : '%.1f',"#
#calc "dew_point(data['temp_out'], data['hum_out'])" "'dew' : '%.1f',"#
#calc "usaheatindex(data['temp_in'], data['hum_in'], dew_point(data['temp_in'], data['hum_in']))" "'heatin' : '%.1f',"#
#calc "usaheatindex(data['temp_out'], data['hum_out'], dew_point(data['temp_out'], data['hum_out']))" "'heat' : '%.1f',"#
#calc "(usaheatindex(data['temp_out'], data['hum_out'], dew_point(data['temp_out'], data['hum_out'])) - (1.072 * wind_mph(data['wind_ave']))) " "'thw' : '%.1f',"#
#hum_in "'humin' : '%.d',"#
#hum_out "'hum' : '%.d',"#
#wind_ave "'wspdavg' : '%.1f',"#
#wind_gust "'wspdhi' : '%.1f',"#
Expand All @@ -87,6 +85,13 @@ def __init__(self, context, check_params=True):
self.template += """
#calc "data['illuminance']" "'solarrad' : '%.1f'," "" "illuminance_wm2(x)"#
#calc "data['uv']" "'uvi' : '%.1f',"#
"""
if eval(self.params['internal']):
self.template += """
#temp_in "'tempin': '%.1f',"#
#hum_in "'humin' : '%.d',"#
#calc "dew_point(data['temp_in'], data['hum_in'])" "'dewin' : '%.1f',"#
#calc "usaheatindex(data['temp_in'], data['hum_in'], dew_point(data['temp_in'], data['hum_in']))" "'heatin' : '%.1f',"#
"""

@contextmanager
Expand Down

0 comments on commit 8830155

Please sign in to comment.