From 04336c8057f022ff797f566ffd9537091ac3e886 Mon Sep 17 00:00:00 2001 From: David Baetge Date: Mon, 20 Nov 2023 14:05:29 +0100 Subject: [PATCH] Fixes mid-day resets via MQTT. GH-224 --- changelog.md | 1 + skins/weewx-wdc/src/js/live-updates.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/changelog.md b/changelog.md index e58d9d8..baaa9cf 100644 --- a/changelog.md +++ b/changelog.md @@ -751,3 +751,4 @@ See https://github.com/Daveiano/weewx-wdc/compare/v3.3.0...580071ca175a03fe4924b - Bugfix: Fixed "ValueError: could not convert string to float" in forecast, introduced in GH-191 - Bugfixed Added missing `nl.conf` in `install.py` GH-221 - Bugfix: Fixed Gauge tiles daily reset (via MQTT) +- Bugfix: Max Rain Rate Does Not Reset GH-224 diff --git a/skins/weewx-wdc/src/js/live-updates.ts b/skins/weewx-wdc/src/js/live-updates.ts index e1207a4..8793f6c 100644 --- a/skins/weewx-wdc/src/js/live-updates.ts +++ b/skins/weewx-wdc/src/js/live-updates.ts @@ -479,6 +479,11 @@ const onMessageArrived = (message: Message) => { `Last update was ${dayjs.unix(payLoad.dateTime).format("HH:mm:ss")}` ); + const lastGenerated_ts = (window as any).weewxWdcConfig.time, + lastGenerated_formatted = dayjs + .unix(parseInt(lastGenerated_ts)) + .format("YYYY-MM-DD"); + for (const key in payLoad) { if (["dateTime", "usUnits", "interval"].includes(key)) continue; @@ -497,6 +502,8 @@ const onMessageArrived = (message: Message) => { // Day changed, reset min/max/sum. if ( lastUpdate_ts && + lastGenerated_formatted !== + dayjs.unix(payLoad.dateTime).format("YYYY-MM-DD") && lastUpdate_formatted !== dayjs.unix(payLoad.dateTime).format("YYYY-MM-DD") ) { dayChange = true;