add Totals panel to Seasons skin

This commit is contained in:
gjr80
2021-08-12 23:34:11 +10:00
parent a88ee5dd64
commit 97ead17618
8 changed files with 121 additions and 34 deletions

View File

@@ -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

View File

@@ -46,22 +46,12 @@
<td class="label">$obs.label.rainRate</td>
<td class="data">$current.rainRate</td>
</tr>
<tr>
<td class="label">$gettext["Rain today"]</td>
<td class="data">$day.rain.sum</td>
</tr>
#if $day.UV.has_data
<tr>
<td class="label">$obs.label.UV</td>
<td class="data">$current.UV</td>
</tr>
#end if
#if $day.ET.has_data and $day.ET.sum.raw is not None and $day.ET.sum.raw > 0.0
<tr>
<td class="label">$obs.label.ET</td>
<td class="data">$current.ET</td>
</tr>
#end if
#if $day.radiation.has_data
<tr>
<td class="label">$obs.label.radiation</td>

View File

@@ -98,14 +98,6 @@
#end for
<td class="units">$unit.label.barometer</td>
</tr>
<tr>
<td class="label">$obs.label.rain</td>
#for $archive in $archive_data
<td class="data new_row hilo_$archive[0]">
$archive[1].rain.sum.format(add_label=False)</td>
#end for
<td class="units">$unit.label.rain</td>
</tr>
<tr>
<td class="label">$obs.label.rainRate</td>
#for $archive in $archive_data
@@ -179,21 +171,6 @@
</tr>
#end if
#if $day.ET.has_data and $day.ET.sum.raw > 0.0
<tr>
<td class="label">$obs.label.ET</td>
#for $archive in $archive_data
<td class="data new_row hilo_$archive[0]">
<span title="$archive[1].ET.maxtime">
$archive[1].ET.max.format(add_label=False)</span><br/>
<span title="$archive[1].ET.mintime">
$archive[1].ET.min.format(add_label=False)</span>
</td>
#end for
<td class="units">$unit.label.ET</td>
</tr>
#end if
#if $day.radiation.has_data
<tr>
<td class="label">$obs.label.radiation</td>

View File

@@ -23,6 +23,7 @@
<div id="widget_group">
#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
<img src="daytemp.png" alt="$obs.label.extraTemp1" />
#end if
#if $day.ET.has_data
<img src="dayET.png" alt="$obs.label.ET"/>
#end if
#if $day.rxCheckPercent.has_data
<img src="dayrx.png" alt="$obs.label.rxCheckPercent"/>
#end if
@@ -95,6 +99,9 @@
#if $week.extraTemp1.has_data or $week.extraTemp2.has_data or $week.extraTemp3.has_data
<img src="weektemp.png" alt="$obs.label.extraTemp1" />
#end if
#if $week.ET.has_data
<img src="weekET.png" alt="$obs.label.ET"/>
#end if
#if $week.rxCheckPercent.has_data
<img src="weekrx.png" alt="$obs.label.rxCheckPercent"/>
#end if
@@ -123,6 +130,9 @@
#if $month.extraTemp1.has_data or $month.extraTemp2.has_data or $month.extraTemp3.has_data
<img src="monthtemp.png" alt="$obs.label.extraTemp1" />
#end if
#if $month.ET.has_data
<img src="monthET.png" alt="$obs.label.ET"/>
#end if
#if $month.rxCheckPercent.has_data
<img src="monthrx.png" alt="$obs.label.rxCheckPercent"/>
#end if
@@ -151,6 +161,9 @@
#if $year.extraTemp1.has_data or $year.extraTemp2.has_data or $year.extraTemp3.has_data
<img src="yeartemp.png" alt="$obs.label.extraTemp1" />
#end if
#if $year.ET.has_data
<img src="yearET.png" alt="$obs.label.ET"/>
#end if
#if $year.rxCheckPercent.has_data
<img src="yearrx.png" alt="$obs.label.rxCheckPercent"/>
#end if

View File

@@ -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;
}

View File

@@ -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']);
}
}

View File

@@ -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]]]]

55
skins/Seasons/totals.inc Executable file
View File

@@ -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)]
<div id='totals_widget' class="widget">
<div class="widget_title">
<a href="statistics.html">Totals</a>
<a class="widget_control"
onclick="toggle_widget('totals')">&diams;</a>
</div>
<div class="widget_contents">
<table>
<tbody>
<tr>
<td></td>
<th>&nbsp;<br/>Today</th>
<th class="totals_week">&nbsp;<br/>Week</th>
<th class="totals_month">&nbsp;<br/>Month</th>
<th class="totals_year">
<a onclick="toggle_rainyear()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>Year</a>
</th>
<th class="totals_rainyear">
<a onclick="toggle_rainyear()">Rain<br/>Year</a>
</th>
<td></td>
</tr>
<tr>
<td class="label">$obs.label.rain</td>
#for $archive in $archive_data
<td class="data new_row totals_$archive[0]">
$archive[1].rain.sum.format(add_label=False)</td>
#end for
<td class="units">$unit.label.rain</td>
</tr>
#if $day.ET.has_data and $day.ET.sum.raw > 0.0
<tr>
<td class="label">$obs.label.ET</td>
#for $archive in $archive_data
<td class="data new_row totals_$archive[0]">
$archive[1].ET.sum.format(add_label=False)</td>
#end for
<td class="units">$unit.label.ET</td>
</tr>
#end if
</tbody>
</table>
</div>
</div>