pywws.service.weathercloud¶
Upload data to WeatherCloud.
Create account: https://weathercloud.net/
Additional dependency: http://docs.python-requests.org/
Example
weather.ini
configuration:[weathercloud] deviceid = XXXXXXXXXXXX devicekey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX internal = True [logged] services = ['weathercloud', 'metoffice']
Classes
ToService (context[, check_params]) |
-
class
pywws.service.weathercloud.
ToService
(context, check_params=True)[source]¶ Bases:
pywws.service.LiveDataService
-
config
= {'deviceid': ('', True, 'wid'), 'devicekey': ('', True, 'key'), 'internal': ('False', True, None)}¶
-
fixed_data
= {'type': '481', 'ver': '21.4.0'}¶
-
interval
= datetime.timedelta(seconds=600)¶
-
logger
= <Logger pywws.service.weathercloud (WARNING)>¶
-
service_name
= 'weathercloud'¶
-
template
= '\n#live#\n#temp_out\n "\'temp\' : \'%.0f\'," "" "scale(x, 10.0)"#\n#calc "wind_chill(data[\'temp_out\'], data[\'wind_ave\'])"\n "\'chill\' : \'%.0f\'," "" "scale(x, 10.0)"#\n#calc "dew_point(data[\'temp_out\'], data[\'hum_out\'])"\n "\'dew\' : \'%.0f\'," "" "scale(x, 10.0)"#\n#calc "usaheatindex(data[\'temp_out\'], data[\'hum_out\'])"\n "\'heat\' : \'%.0f\'," "" "scale(x, 10.0)"#\n#hum_out\n "\'hum\' : \'%.d\',"#\n#wind_ave\n "\'wspdavg\' : \'%.0f\'," "" "scale(x, 10.0)"#\n#wind_ave\n "\'wspd\' : \'%.0f\'," "" "scale(x, 10.0)"#\n#wind_gust\n "\'wspdhi\' : \'%.0f\'," "" "scale(x, 10.0)"#\n#wind_dir\n "\'wdiravg\' : \'%.0f\'," "" "winddir_degrees(x)"#\n#wind_dir\n "\'wdir\' : \'%.0f\'," "" "winddir_degrees(x)"#\n#rel_pressure\n "\'bar\' : \'%.0f\'," "" "scale(x, 10.0)"#\n#calc "rain_day(data)"\n "\'rain\' : \'%.0f\'," "" "scale(x, 10.0)"#\n#calc "rain_hour(data)"\n "\'rainrate\' : \'%.0f\'," "" "scale(x, 10.0)"#\n#idx\n "\'time\' : \'%Y%m%d %H%M%S\',"#\n'¶
-
session
()[source]¶ Context manager factory function for a batch of one or more uploads.
This makes it easy to ensure any resources such as an internet connection are properly closed after a batch of uploads. Use the
contextlib.contextmanager()
decorator when you implement this method.For a typical example, see the source code of the
pywws.service.openweathermap
module. If your upload can’t benefit from a session object yieldNone
, as inpywws.service.copy
.
-
Comments or questions? Please subscribe to the pywws mailing list http://groups.google.com/group/pywws and let us know.