From 97ead1761870481f2671dbedbb3e5dfd736e4517 Mon Sep 17 00:00:00 2001 From: gjr80 Date: Thu, 12 Aug 2021 23:34:11 +1000 Subject: [PATCH] add Totals panel to Seasons skin --- bin/weecfg/__init__.py | 2 +- skins/Seasons/current.inc | 10 ------- skins/Seasons/hilo.inc | 23 --------------- skins/Seasons/index.html.tmpl | 13 +++++++++ skins/Seasons/seasons.css | 13 +++++++++ skins/Seasons/seasons.js | 2 ++ skins/Seasons/skin.conf | 37 +++++++++++++++++++++++ skins/Seasons/totals.inc | 55 +++++++++++++++++++++++++++++++++++ 8 files changed, 121 insertions(+), 34 deletions(-) create mode 100755 skins/Seasons/totals.inc diff --git a/bin/weecfg/__init__.py b/bin/weecfg/__init__.py index 15e5b99c..7af1fb82 100644 --- a/bin/weecfg/__init__.py +++ b/bin/weecfg/__init__.py @@ -2018,7 +2018,7 @@ DEFAULTS = UNIT_DEFAULTS + """ [[[[Generic]]]] barometer = Barometer dewpoint = Dew Point - ET = ET + ET = Evapotranspiration heatindex = Heat Index inHumidity = Inside Humidity inTemp = Inside Temperature diff --git a/skins/Seasons/current.inc b/skins/Seasons/current.inc index 51e991ef..f4b73bed 100644 --- a/skins/Seasons/current.inc +++ b/skins/Seasons/current.inc @@ -46,22 +46,12 @@ $obs.label.rainRate $current.rainRate - - $gettext["Rain today"] - $day.rain.sum - #if $day.UV.has_data $obs.label.UV $current.UV #end if -#if $day.ET.has_data and $day.ET.sum.raw is not None and $day.ET.sum.raw > 0.0 - - $obs.label.ET - $current.ET - -#end if #if $day.radiation.has_data $obs.label.radiation diff --git a/skins/Seasons/hilo.inc b/skins/Seasons/hilo.inc index bc0765c8..c357ec01 100644 --- a/skins/Seasons/hilo.inc +++ b/skins/Seasons/hilo.inc @@ -98,14 +98,6 @@ #end for $unit.label.barometer - - $obs.label.rain - #for $archive in $archive_data - - $archive[1].rain.sum.format(add_label=False) - #end for - $unit.label.rain - $obs.label.rainRate #for $archive in $archive_data @@ -179,21 +171,6 @@ #end if - #if $day.ET.has_data and $day.ET.sum.raw > 0.0 - - $obs.label.ET - #for $archive in $archive_data - - - $archive[1].ET.max.format(add_label=False)
- - $archive[1].ET.min.format(add_label=False) - - #end for - $unit.label.ET - - #end if - #if $day.radiation.has_data $obs.label.radiation diff --git a/skins/Seasons/index.html.tmpl b/skins/Seasons/index.html.tmpl index 74d8334d..5677809f 100644 --- a/skins/Seasons/index.html.tmpl +++ b/skins/Seasons/index.html.tmpl @@ -23,6 +23,7 @@
#include "current.inc" #include "sunmoon.inc" + #include "totals.inc" #include "hilo.inc" #include "sensors.inc" #include "about.inc" @@ -67,6 +68,9 @@ #if $day.extraTemp1.has_data or $day.extraTemp2.has_data or $day.extraTemp3.has_data $obs.label.extraTemp1 #end if + #if $day.ET.has_data + $obs.label.ET + #end if #if $day.rxCheckPercent.has_data $obs.label.rxCheckPercent #end if @@ -95,6 +99,9 @@ #if $week.extraTemp1.has_data or $week.extraTemp2.has_data or $week.extraTemp3.has_data $obs.label.extraTemp1 #end if + #if $week.ET.has_data + $obs.label.ET + #end if #if $week.rxCheckPercent.has_data $obs.label.rxCheckPercent #end if @@ -123,6 +130,9 @@ #if $month.extraTemp1.has_data or $month.extraTemp2.has_data or $month.extraTemp3.has_data $obs.label.extraTemp1 #end if + #if $month.ET.has_data + $obs.label.ET + #end if #if $month.rxCheckPercent.has_data $obs.label.rxCheckPercent #end if @@ -151,6 +161,9 @@ #if $year.extraTemp1.has_data or $year.extraTemp2.has_data or $year.extraTemp3.has_data $obs.label.extraTemp1 #end if + #if $year.ET.has_data + $obs.label.ET + #end if #if $year.rxCheckPercent.has_data $obs.label.rxCheckPercent #end if diff --git a/skins/Seasons/seasons.css b/skins/Seasons/seasons.css index 5d9fe007..d29fab87 100644 --- a/skins/Seasons/seasons.css +++ b/skins/Seasons/seasons.css @@ -253,6 +253,19 @@ a:hover { padding-left: 10px; } +#totals_widget table th { + font-size: 80%; + text-align: right; + border-bottom: none; +} + +#totals_widget .data { + font-weight: bold; + font-size: 80%; + text-align: right; + padding-left: 10px; +} + #sensors_widget table th { padding-top: 10px; } diff --git a/skins/Seasons/seasons.js b/skins/Seasons/seasons.js index bed20caf..f35bfd1a 100644 --- a/skins/Seasons/seasons.js +++ b/skins/Seasons/seasons.js @@ -36,12 +36,14 @@ function setup(widgets) { function choose_history(id) { choose_div('history', id, ['day', 'week', 'month', 'year']); choose_col('hilo', id, ['week', 'month', 'year', 'rainyear']); + choose_col('totals', id, ['week', 'month', 'year', 'rainyear']); choose_rainyear(id); } function choose_rainyear(id) { if (id === 'year') { choose_col('hilo', year_type, ['year', 'rainyear']); + choose_col('totals', year_type, ['year', 'rainyear']); } } diff --git a/skins/Seasons/skin.conf b/skins/Seasons/skin.conf index 2c77c597..3981fe5e 100644 --- a/skins/Seasons/skin.conf +++ b/skins/Seasons/skin.conf @@ -284,6 +284,16 @@ [[[[supplyVoltage]]]] [[[[referenceVoltage]]]] + # This is how to generate a plot of hourly ET for the day: +# [[[dayET]]] +# # Make sure the y-axis increment is at least 0.02 for the ET plot +# yscale = None, None, 0.02 +# plot_type = bar +# [[[[ET]]]] +# aggregate_type = sum +# aggregate_interval = hour +# label = Evapotranspiration (hourly total) + [[week_images]] x_label_format = %d bottom_label_format = %x %X @@ -358,6 +368,15 @@ [[[[supplyVoltage]]]] [[[[referenceVoltage]]]] + # This is how to generate a plot of daily ET for the week: +# [[[weekET]]] +# yscale = None, None, 0.02 +# plot_type = bar +# [[[[ET]]]] +# aggregate_type = sum +# aggregate_interval = day +# label = Evapotranspiration (daily total) + [[month_images]] x_label_format = %d bottom_label_format = %x %X @@ -433,6 +452,15 @@ [[[[supplyVoltage]]]] [[[[referenceVoltage]]]] + # This is how to generate a plot of daily ET for the month: +# [[[monthET]]] +# yscale = None, None, 0.02 +# plot_type = bar +# [[[[ET]]]] +# aggregate_type = sum +# aggregate_interval = day +# label = Evapotranspiration (daily total) + [[year_images]] x_label_format = %m/%d bottom_label_format = %x %X @@ -508,6 +536,15 @@ [[[[supplyVoltage]]]] [[[[referenceVoltage]]]] + # This is how to generate a plot of weekly ET for the year: +# [[[yearET]]] +# yscale = None, None, 0.02 +# plot_type = bar +# [[[[ET]]]] +# aggregate_type = sum +# aggregate_interval = week +# label = Evapotranspiration (weekly total) + # This is how to generate a plot of high/low temperatures for the year: # [[[yearhilow]]] # [[[[hi]]]] diff --git a/skins/Seasons/totals.inc b/skins/Seasons/totals.inc new file mode 100755 index 00000000..b0e2d7ab --- /dev/null +++ b/skins/Seasons/totals.inc @@ -0,0 +1,55 @@ +## totals module for weewx skins +## Copyright Tom Keffer, Matthew Wall +## See LICENSE.txt for your rights +#errorCatcher Echo +#encoding UTF-8 + +#set $archive_data = [('day', $day), ('week', $week), ('month', $month), ('year', $year), ('rainyear', $rainyear)] + +
+
+ Totals + +
+ +
+ + + + + + + + + + + + + + #for $archive in $archive_data + + #end for + + + + #if $day.ET.has_data and $day.ET.sum.raw > 0.0 + + + #for $archive in $archive_data + + #end for + + + #end if + + +
 
Today
 
Week
 
Month
+         
Year
+
+ Rain
Year
+
$obs.label.rain + $archive[1].rain.sum.format(add_label=False)$unit.label.rain
$obs.label.ET + $archive[1].ET.sum.format(add_label=False)$unit.label.ET
+
+