From ccad62b5c2a7fd343b7ef30b1b54a61893959039 Mon Sep 17 00:00:00 2001 From: Brandon McFarlin <6525520+Brandawg93@users.noreply.github.com> Date: Wed, 27 Dec 2023 10:29:27 -0500 Subject: [PATCH] Fix: Peanut widget v2 api compatibility (#2526) --- src/widgets/peanut/component.jsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/widgets/peanut/component.jsx b/src/widgets/peanut/component.jsx index b61ecacff..aa6f31b33 100644 --- a/src/widgets/peanut/component.jsx +++ b/src/widgets/peanut/component.jsx @@ -24,6 +24,17 @@ export default function Component({ service }) { ); } + // backwards compatibility with peanut v1 + if ("battery.charge" in upsData) { + upsData.battery_charge = upsData["battery.charge"]; + } + if ("ups.load" in upsData) { + upsData.ups_load = upsData["ups.load"]; + } + if ("ups.status" in upsData) { + upsData.ups_status = upsData["ups.status"]; + } + let status; switch (upsData.ups_status) { case "OL":