## sensors module for weewx skins ## Copyright Tom Keffer, Matthew Wall ## See LICENSE.txt for your rights ## modified for operation with the GW1000 driver #errorCatcher Echo #encoding UTF-8 ## ## this is a conditional display of sensor data, including connectivity, ## battery status, and various voltages. if there are no data available, ## then this degenerates to nothing displayed. ## ## To include GW1000 sensor battery state information in the Seasons skin ## Sensor Panel list the sensor battery states to display in the ## $sensor_batt_data list. Sensors will be displayed in the order listed. Each ## entry is in the format: ## (WeeWX sensor battery state field name, decode function name) ## where 'WeeWX sensor battery state field name' is the WeeWX field holding the ## battery state data and 'decode function name' is set as follows depending on ## the sensor type: ## WH24: 'get_binary_battery_status' ## WH25: 'get_binary_battery_status' ## WH26: 'get_binary_battery_status' ## WH31: 'get_binary_battery_status' ## WH40: 'get_binary_battery_status' ## WH41: 'get_multi_battery_status' ## WH51: 'get_binary_battery_status' ## WH55: 'get_multi_battery_status' ## WH57: 'get_multi_battery_status' ## WH65: 'get_binary_battery_status' ## #set $sensor_batt_data = [('wh31_ch1_batt', 'get_binary_battery_status'), ('wh31_ch2_batt', 'get_binary_battery_status'), ('wh31_ch3_batt', 'get_binary_battery_status'), ('wh65_batt', 'get_binary_battery_status'), ('wh41_ch1_batt', 'get_multi_battery_status'), ('wh51_ch1_batt', 'get_binary_battery_status'), ('wh51_ch2_batt', 'get_binary_battery_status'), ('wh51_ch3_batt', 'get_binary_battery_status'), ('wh57_batt', 'get_multi_battery_status') ] ## #def get_binary_battery_status($x) #if $x == 0 #else #end if #end def ## #def get_multi_battery_status($x) #if $x <= 1 LOW #elif $x <= 5 OK #elif $x == 6 DC #end if #end def ## ## first see what sensor data are available ## #set $have_conn = 0 #for $x in [$day.rxCheckPercent] #if $x.has_data #set $have_conn = 1 #end if #end for ## #set $have_battery_status = 0 #for $x in $sensor_batt_data #try #if getattr($current, $x[0]).has_data #set $have_battery_status = 1 #end if #except (AttributeError, TypeError) ## there is no battery state data for that sensor #pass #end try #end for ## #set $have_voltage = 0 #for $x in [$day.consBatteryVoltage, $day.heatingVoltage, $day.supplyVoltage, $day.referenceVoltage] #if $x.has_data #set $have_voltage = 1 #end if #end for ## ## now display the available data only ## #if $have_conn or $have_battery_status or $have_voltage
## #if $have_conn #if $day.rxCheckPercent.has_data #end if #end if ## #if $have_battery_status #for $battery in $sensor_batt_data #try #if getattr($current, $battery[0]).has_data #set $state = getattr(self, $battery[1])(getattr($current, $battery[0]).raw) #end if #except (AttributeError, TypeError) ## there is no battery state data for that sensor #pass #end try #end for #end if ## #if $have_voltage #if $day.consBatteryVoltage.has_data #end if #if $day.heatingVoltage.has_data #end if #if $day.supplyVoltage.has_data #end if #if $day.referenceVoltage.has_data #end if #end if
Connectivity
$obs.label.rxCheckPercent $current.rxCheckPercent
Battery Status
$obs.label[$battery[0]] $state
Voltage
$obs.label.consBatteryVoltage $current.consBatteryVoltage
$obs.label.heatingVoltage $current.heatingVoltage
$obs.label.supplyVoltage $current.supplyVoltage
$obs.label.referenceVoltage $current.referenceVoltage
##
#end if