Skip to content

Commit

Permalink
Fixes mid-day resets via MQTT. GH-224
Browse files Browse the repository at this point in the history
  • Loading branch information
Daveiano committed Nov 20, 2023
1 parent a0157e7 commit 04336c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions skins/weewx-wdc/src/js/live-updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down

0 comments on commit 04336c8

Please sign in to comment.