From 2a9d10bd92b25d1f4776a777c5479324a5048e29 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Mon, 4 Jul 2011 00:23:58 +0000 Subject: [PATCH 1/2] Applied patch from Dan Haller, which adds UV and radiation for Weather Underground reporting. --- bin/weewx/restful.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/weewx/restful.py b/bin/weewx/restful.py index fd02b7de..b83b2899 100644 --- a/bin/weewx/restful.py +++ b/bin/weewx/restful.py @@ -38,7 +38,7 @@ class REST(object): # The types to be retrieved from the arhive database: archive_types = ('dateTime', 'usUnits', 'barometer', 'outTemp', 'outHumidity', - 'windSpeed', 'windDir', 'windGust', 'dewpoint', 'radiation') + 'windSpeed', 'windDir', 'windGust', 'dewpoint', 'radiation', 'UV') # A SQL statement to do the retrieval: sql_select = "SELECT " + ", ".join(archive_types) + " FROM archive WHERE dateTime=?" @@ -111,7 +111,9 @@ class Ambient(REST): 'windGust' : 'windgustmph=%03.0f', 'dewpoint' : 'dewptf=%.1f', 'rain' : 'rainin=%.2f', - 'dailyrain' : 'dailyrainin=%.2f'} + 'dailyrain' : 'dailyrainin=%.2f', + 'radiation' : 'solarradiation=%.2f', + 'UV' : 'UV=%.2f'} def __init__(self, site, **kwargs): From 379cbe941ccc3132a6672133a453a69de76d4444 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Mon, 4 Jul 2011 01:15:46 +0000 Subject: [PATCH 2/2] Added patch from user Marijn Vriens, which allows a fallback to the version of pysqlite that comes with many versions of Python. --- bin/weeutil/dbutil.py | 5 ++++- bin/weewx/archive.py | 5 ++++- bin/weewx/stats.py | 5 ++++- setup.py | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bin/weeutil/dbutil.py b/bin/weeutil/dbutil.py index ab285ae5..18a90285 100644 --- a/bin/weeutil/dbutil.py +++ b/bin/weeutil/dbutil.py @@ -13,7 +13,10 @@ from __future__ import with_statement import re -from pysqlite2 import dbapi2 as sqlite3 +try: + from pysqlite2 import dbapi2 as sqlite3 +except ImportError: + from sqlite3 import dbapi2 as sqlite3 # Regular expression that matches everything within the set # of parenthesis which marks the column definition: diff --git a/bin/weewx/archive.py b/bin/weewx/archive.py index 86a14ccc..919feb0e 100644 --- a/bin/weewx/archive.py +++ b/bin/weewx/archive.py @@ -12,7 +12,10 @@ from __future__ import with_statement import syslog import os.path import math -from pysqlite2 import dbapi2 as sqlite3 +try: + from pysqlite2 import dbapi2 as sqlite3 +except ImportError: + from sqlite3 import dbapi2 as sqlite3 import weewx.units import weeutil.weeutil diff --git a/bin/weewx/stats.py b/bin/weewx/stats.py index dae13229..073ba861 100644 --- a/bin/weewx/stats.py +++ b/bin/weewx/stats.py @@ -39,7 +39,10 @@ """ from __future__ import with_statement -from pysqlite2 import dbapi2 as sqlite3 +try: + from pysqlite2 import dbapi2 as sqlite3 +except ImportError: + from sqlite3 import dbapi2 as sqlite3 import math import os.path import syslog diff --git a/setup.py b/setup.py index 57c767b7..d132193f 100755 --- a/setup.py +++ b/setup.py @@ -362,7 +362,7 @@ setup(name='weewx', 'skins/Standard/weewx.css', 'skins/Standard/year.html.tmpl']), ('start_scripts/Debian', ['start_scripts/Debian/weewx']), ('start_scripts/SuSE', ['start_scripts/SuSE/weewx'])], - requires = ['configobj(>=4.5)', 'serial(>=2.3)', 'Cheetah(>=2.0)', 'pysqlite2(>=2.5)', 'PIL(>=1.1.6)'], + requires = ['configobj(>=4.5)', 'serial(>=2.3)', 'Cheetah(>=2.0)', 'sqlite3(>=2.5)', 'PIL(>=1.1.6)'], cmdclass = {"install_data" : My_install_data, "install_lib" : My_install_lib, "sdist" : My_sdist}