Skip to content

Commit

Permalink
WeeWX v5 compatibility, related to weewx/weewx#849. Updated tests to …
Browse files Browse the repository at this point in the history
…use WeeWX v5.0.2.
  • Loading branch information
Daveiano committed Feb 19, 2024
1 parent d393290 commit f27a285
Show file tree
Hide file tree
Showing 71 changed files with 143 additions and 303 deletions.
2 changes: 1 addition & 1 deletion bin/user/weewx_wdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2759,7 +2759,7 @@ def get_table_rows(self, start_ts, end_ts, context, table_obs=None):
carbon_values.append(
{
"time": cs_time_dt.isoformat(),
observation: table_data_rounded,
observation: table_data_rounded if table_data_rounded is not None else "-",
"id": table_start_ts,
}
)
Expand Down
13 changes: 0 additions & 13 deletions skins/weewx-wdc/computer-monitor.html.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!--prettier-ignore-->
#errorCatcher Echo
#encoding UTF-8
#from datetime import datetime, timedelta
Expand All @@ -15,7 +14,6 @@
#set $computer_monitor_diagram_observations = $to_list($DisplayOptions.get('computer_monitor_diagram_observations', ['cpu_user', 'cpu_system', 'cpu_temp', 'load1', 'mem_used', 'proc_active', 'net_eth0_rbytes', 'net_eth0_tbytes', 'net_wlan0_rbytes', 'net_wlan0_tbytes']))
#set $computer_monitor_diagram_period = $DisplayOptions.get('computer_monitor_diagram_period', 'week')

<!--prettier-ignore-->
#def diagrams($context, $diagrams_config, $diagram_obs)
#set $diagram_index = 0
#if "combined_observations" in $diagrams_config
Expand Down Expand Up @@ -80,9 +78,7 @@
</header>
</div>

<!--prettier-ignore-->
#if $layout == 'classic'
<!--prettier-ignore-->
<div class="bx--row">
<div
class="bx--col-sm-4 bx--col-md-8 bx--col-lg-6 bx--col-xlg-4 bx--col-max-4 layout-col"
Expand All @@ -99,17 +95,14 @@
</div>
</div>
<div class="bx--row">
<!-- prettier-ignore -->
#if 'computer_monitor_table_observations' in $DisplayOptions
<div class="bx--row">
<!-- prettier-ignore -->
#set global $table_obs = $DisplayOptions.get('computer_monitor_table_observations')
#include "includes/data-table-tile.inc"
</div>
#end if
</div>
#else
<!--prettier-ignore-->
#set global $context = 'day'

<div class="bx--row">
Expand All @@ -125,27 +118,21 @@
#end for
</div>

<!--prettier-ignore-->
#set global $context = $computer_monitor_diagram_period

<!--prettier-ignore-->
<div class="bx--row">
#include "includes/section-heading.inc"
</div>

<!-- prettier-ignore -->
<div class="bx--row">
$diagrams($context, $diagrams_config, $computer_monitor_diagram_observations)
</div>

<!-- prettier-ignore -->
#if 'computer_monitor_table_observations' in $DisplayOptions
<div class="bx--row">
<!-- prettier-ignore -->
#set global $table_obs = $DisplayOptions.get('computer_monitor_table_observations')
#include "includes/data-table-tile.inc"
</div>
<!--prettier-ignore-->
#end if
#end if
</div>
Expand Down
9 changes: 6 additions & 3 deletions skins/weewx-wdc/src/js/diagrams/d3/line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ export const D3LineDiagram: FunctionComponent<LineDiagramBaseProps> = (
svgElement
.append("g")
.selectAll("dot")
.data(dataSet.data)
.data(dataSet.data.filter((d: any) => d.y !== null))
.enter()
.append("circle")
.attr("cx", (d: any) => {
Expand All @@ -456,7 +456,7 @@ export const D3LineDiagram: FunctionComponent<LineDiagramBaseProps> = (
if (observationProps.enableArea) {
svgElement
.append("path")
.datum(dataSet.data as any)
.datum(dataSet.data.filter((d: any) => d.y !== null) as any)
.attr("fill", colors[index])
.attr(
"fill-opacity",
Expand Down Expand Up @@ -490,7 +490,10 @@ export const D3LineDiagram: FunctionComponent<LineDiagramBaseProps> = (
"stroke-width",
observationProps.lineWidth ? observationProps.lineWidth : 2
)
.attr("d", lineGenerator(dataSet.data as any));
.attr(
"d",
lineGenerator(dataSet.data.filter((d: any) => d.y !== null) as any)
);
});

// Markers.
Expand Down
2 changes: 2 additions & 0 deletions skins/weewx-wdc/src/js/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ diagrams.forEach((diagram) => {
observation: diagramObservations[index],
id: `${labels[index]} ${aggregate_types[index]}`,
data: (window as any)[serie]
.filter((item: number[] | null[]) => item[2] !== null)
.map((item: number[]) => {
return {
x: item[0],
Expand All @@ -153,6 +154,7 @@ diagrams.forEach((diagram) => {
observation: diagramObservations[0],
id: diagramObservations[0],
data: (window as any)[diagram.dataset.value]
.filter((item: number[] | null[]) => item[2] !== null)
.map((item: number[]) => {
return {
x: item[0],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/* prettier-ignore */
var cpu_tempSeries0 = [[1685577300, 1685584500, 46.9], [1685584500, 1685591700, 45.6], [1685591700, 1685598900, 45.3], [1685598900, 1685606100, 45.0], [1685613300, 1685620500, 44.5], [1685620500, 1685627700, 46.1], [1685627700, 1685634900, 46.9], [1685634900, 1685642100, 47.1], [1685642100, 1685649300, 46.5], [1685649300, 1685656500, 46.1], [1685656500, 1685663700, 46.3], [1685663700, 1685670900, 46.4], [1685670900, 1685678100, 45.8], [1685678100, 1685685300, 45.2]];
var cpu_tempSeries0 = [[1685512500, 1685519700, null], [1685519700, 1685526900, null], [1685526900, 1685534100, null], [1685534100, 1685541300, null], [1685541300, 1685548500, null], [1685548500, 1685555700, null], [1685555700, 1685562900, null], [1685562900, 1685570100, null], [1685570100, 1685577300, null], [1685577300, 1685584500, 46.9], [1685584500, 1685591700, 45.6], [1685591700, 1685598900, 45.3], [1685598900, 1685606100, 45.0], [1685606100, 1685613300, null], [1685613300, 1685620500, 44.5], [1685620500, 1685627700, 46.1], [1685627700, 1685634900, 46.9], [1685634900, 1685642100, 47.1], [1685642100, 1685649300, 46.5], [1685649300, 1685656500, 46.1], [1685656500, 1685663700, 46.3], [1685663700, 1685670900, 46.4], [1685670900, 1685678100, 45.8], [1685678100, 1685685300, 45.2]];

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/* prettier-ignore */
var net_eth0_tpacketsSeries53 = [[1685512500, 1685519700, 86], [1685555700, 1685562900, 210], [1685562900, 1685570100, 265], [1685570100, 1685577300, 275], [1685577300, 1685584500, 286], [1685584500, 1685591700, 281], [1685591700, 1685598900, 270], [1685598900, 1685606100, 96], [1685613300, 1685620500, 405], [1685620500, 1685627700, 247], [1685627700, 1685634900, 282], [1685634900, 1685642100, 287], [1685642100, 1685649300, 264], [1685649300, 1685656500, 278], [1685656500, 1685663700, 264], [1685663700, 1685670900, 296], [1685670900, 1685678100, 272], [1685678100, 1685685300, 295]];
var net_eth0_tpacketsSeries53 = [[1685512500, 1685519700, 86], [1685519700, 1685526900, null], [1685526900, 1685534100, null], [1685534100, 1685541300, null], [1685541300, 1685548500, null], [1685548500, 1685555700, null], [1685555700, 1685562900, 210], [1685562900, 1685570100, 265], [1685570100, 1685577300, 275], [1685577300, 1685584500, 286], [1685584500, 1685591700, 281], [1685591700, 1685598900, 270], [1685598900, 1685606100, 96], [1685606100, 1685613300, null], [1685613300, 1685620500, 405], [1685620500, 1685627700, 247], [1685627700, 1685634900, 282], [1685634900, 1685642100, 287], [1685642100, 1685649300, 264], [1685649300, 1685656500, 278], [1685656500, 1685663700, 264], [1685663700, 1685670900, 296], [1685670900, 1685678100, 272], [1685678100, 1685685300, 295]];

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*prettier-ignore*/
var tableRows = [{'time': '2023-05-31T13:55:00', 'cpu_user': 1915, 'id': 1685512500, 'cpu_system': 246, 'load1': 0.0, 'load5': 0.05, 'load15': 0.07, 'mem_used': 929480, 'mem_free': 964280, 'net_eth0_rbytes': 11562, 'net_eth0_rpackets': 71.0, 'net_eth0_tbytes': 23570, 'net_eth0_tpackets': 86.0, 'proc_active': 3.0, 'proc_total': 200.0}, {'time': '2023-06-01T01:55:00', 'cpu_user': 2186, 'id': 1685555700, 'cpu_system': 311, 'load1': 0.05, 'load5': 0.06, 'load15': 0.07, 'mem_used': 652915, 'mem_free': 1240844, 'net_eth0_rbytes': 432001, 'net_eth0_rpackets': 362.2, 'net_eth0_tbytes': 36018, 'net_eth0_tpackets': 254.6, 'proc_active': 2.6, 'proc_total': 205.6}, {'time': '2023-06-01T07:55:00', 'cpu_user': 2085, 'id': 1685577300, 'cpu_system': 262, 'cpu_temp': 45.8, 'load1': 0.03, 'load5': 0.05, 'load15': 0.06, 'mem_used': 771494, 'mem_free': 1552124, 'net_eth0_rbytes': 478132, 'net_eth0_rpackets': 393.3, 'net_eth0_tbytes': 38111, 'net_eth0_tpackets': 279.3, 'proc_active': 2.5, 'proc_total': 205.8}, {'time': '2023-06-01T13:55:00', 'cpu_user': 2083, 'id': 1685598900, 'cpu_system': 254, 'cpu_temp': 44.6, 'load1': 0.03, 'load5': 0.06, 'load15': 0.07, 'mem_used': 683149, 'mem_free': 1633541, 'net_eth0_rbytes': 611781, 'net_eth0_rpackets': 486.4, 'net_eth0_tbytes': 43518, 'net_eth0_tpackets': 337.1, 'proc_active': 2.7, 'proc_total': 203.6}, {'time': '2023-06-01T19:55:00', 'cpu_user': 2117, 'id': 1685620500, 'cpu_system': 261, 'cpu_temp': 46.7, 'load1': 0.04, 'load5': 0.05, 'load15': 0.06, 'mem_used': 667783, 'mem_free': 1630764, 'net_eth0_rbytes': 464226, 'net_eth0_rpackets': 383.6, 'net_eth0_tbytes': 38357, 'net_eth0_tpackets': 272.5, 'proc_active': 2.6, 'proc_total': 203.7}, {'time': '2023-06-02T01:55:00', 'cpu_user': 2169, 'id': 1685642100, 'cpu_system': 265, 'cpu_temp': 46.3, 'load1': 0.05, 'load5': 0.05, 'load15': 0.05, 'mem_used': 722105, 'mem_free': 1628265, 'net_eth0_rbytes': 461290, 'net_eth0_rpackets': 382.8, 'net_eth0_tbytes': 37480, 'net_eth0_tpackets': 269.2, 'proc_active': 2.6, 'proc_total': 204.1}, {'time': '2023-06-02T07:55:00', 'cpu_user': 2134, 'id': 1685663700, 'cpu_system': 258, 'cpu_temp': 45.8, 'load1': 0.05, 'load5': 0.05, 'load15': 0.06, 'mem_used': 746694, 'mem_free': 1625452, 'net_eth0_rbytes': 458445, 'net_eth0_rpackets': 380.5, 'net_eth0_tbytes': 39010, 'net_eth0_tpackets': 288.3, 'proc_active': 2.5, 'proc_total': 205.6}];
var tableRows = [{'time': '2023-05-31T13:55:00', 'cpu_user': 1915, 'id': 1685512500, 'cpu_system': 246, 'cpu_temp': '-', 'load1': 0.0, 'load5': 0.05, 'load15': 0.07, 'mem_used': 929480, 'mem_free': 964280, 'net_eth0_rbytes': 11562, 'net_eth0_rpackets': 71.0, 'net_eth0_tbytes': 23570, 'net_eth0_tpackets': 86.0, 'proc_active': 3.0, 'proc_total': 200.0}, {'time': '2023-05-31T19:55:00', 'cpu_user': '-', 'id': 1685534100, 'cpu_system': '-', 'cpu_temp': '-', 'load1': '-', 'load5': '-', 'load15': '-', 'mem_used': '-', 'mem_free': '-', 'net_eth0_rbytes': '-', 'net_eth0_rpackets': '-', 'net_eth0_tbytes': '-', 'net_eth0_tpackets': '-', 'proc_active': '-', 'proc_total': '-'}, {'time': '2023-06-01T01:55:00', 'cpu_user': 2186, 'id': 1685555700, 'cpu_system': 311, 'cpu_temp': '-', 'load1': 0.05, 'load5': 0.06, 'load15': 0.07, 'mem_used': 652915, 'mem_free': 1240844, 'net_eth0_rbytes': 432001, 'net_eth0_rpackets': 362.2, 'net_eth0_tbytes': 36018, 'net_eth0_tpackets': 254.6, 'proc_active': 2.6, 'proc_total': 205.6}, {'time': '2023-06-01T07:55:00', 'cpu_user': 2085, 'id': 1685577300, 'cpu_system': 262, 'cpu_temp': 45.8, 'load1': 0.03, 'load5': 0.05, 'load15': 0.06, 'mem_used': 771494, 'mem_free': 1552124, 'net_eth0_rbytes': 478132, 'net_eth0_rpackets': 393.3, 'net_eth0_tbytes': 38111, 'net_eth0_tpackets': 279.3, 'proc_active': 2.5, 'proc_total': 205.8}, {'time': '2023-06-01T13:55:00', 'cpu_user': 2083, 'id': 1685598900, 'cpu_system': 254, 'cpu_temp': 44.6, 'load1': 0.03, 'load5': 0.06, 'load15': 0.07, 'mem_used': 683149, 'mem_free': 1633541, 'net_eth0_rbytes': 611781, 'net_eth0_rpackets': 486.4, 'net_eth0_tbytes': 43518, 'net_eth0_tpackets': 337.1, 'proc_active': 2.7, 'proc_total': 203.6}, {'time': '2023-06-01T19:55:00', 'cpu_user': 2117, 'id': 1685620500, 'cpu_system': 261, 'cpu_temp': 46.7, 'load1': 0.04, 'load5': 0.05, 'load15': 0.06, 'mem_used': 667783, 'mem_free': 1630764, 'net_eth0_rbytes': 464226, 'net_eth0_rpackets': 383.6, 'net_eth0_tbytes': 38357, 'net_eth0_tpackets': 272.5, 'proc_active': 2.6, 'proc_total': 203.7}, {'time': '2023-06-02T01:55:00', 'cpu_user': 2169, 'id': 1685642100, 'cpu_system': 265, 'cpu_temp': 46.3, 'load1': 0.05, 'load5': 0.05, 'load15': 0.05, 'mem_used': 722105, 'mem_free': 1628265, 'net_eth0_rbytes': 461290, 'net_eth0_rpackets': 382.8, 'net_eth0_tbytes': 37480, 'net_eth0_tpackets': 269.2, 'proc_active': 2.6, 'proc_total': 204.1}, {'time': '2023-06-02T07:55:00', 'cpu_user': 2134, 'id': 1685663700, 'cpu_system': 258, 'cpu_temp': 45.8, 'load1': 0.05, 'load5': 0.05, 'load15': 0.06, 'mem_used': 746694, 'mem_free': 1625452, 'net_eth0_rbytes': 458445, 'net_eth0_rpackets': 380.5, 'net_eth0_tbytes': 39010, 'net_eth0_tpackets': 288.3, 'proc_active': 2.5, 'proc_total': 205.6}];
var tableHeaders = [{"title": "Time", "id": "time", "sortCycle": "tri-states-from-ascending"}, {"title": "CPU User", "small": "in %", "id": "cpu_user", "sortCycle": "tri-states-from-ascending"}, {"title": "CPU System", "small": "in %", "id": "cpu_system", "sortCycle": "tri-states-from-ascending"}, {"title": "CPU Temperature", "small": "in \u00b0C", "id": "cpu_temp", "sortCycle": "tri-states-from-ascending"}, {"title": "Load1", "small": "in ", "id": "load1", "sortCycle": "tri-states-from-ascending"}, {"title": "Load5", "small": "in ", "id": "load5", "sortCycle": "tri-states-from-ascending"}, {"title": "Load15", "small": "in ", "id": "load15", "sortCycle": "tri-states-from-ascending"}, {"title": "Memory Used", "small": "in B", "id": "mem_used", "sortCycle": "tri-states-from-ascending"}, {"title": "Memory Free", "small": "in B", "id": "mem_free", "sortCycle": "tri-states-from-ascending"}, {"title": "Network (eth0) Receive Bytes", "small": "in B", "id": "net_eth0_rbytes", "sortCycle": "tri-states-from-ascending"}, {"title": "Network (eth0) Receive Packets", "small": "in ", "id": "net_eth0_rpackets", "sortCycle": "tri-states-from-ascending"}, {"title": "Network (eth0) Transmit Bytes", "small": "in B", "id": "net_eth0_tbytes", "sortCycle": "tri-states-from-ascending"}, {"title": "Network (eth0) Transmit Packets", "small": "in ", "id": "net_eth0_tpackets", "sortCycle": "tri-states-from-ascending"}, {"title": "Processes Active", "small": "in ", "id": "proc_active", "sortCycle": "tri-states-from-ascending"}, {"title": "Processes Total", "small": "in ", "id": "proc_total", "sortCycle": "tri-states-from-ascending"}];

var tableTitle = 'All data';
Expand Down

This file was deleted.

Loading

0 comments on commit f27a285

Please sign in to comment.