Skip to content

Commit

Permalink
Fix: Peanut widget v2 api compatibility (#2526)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandawg93 authored Dec 27, 2023
1 parent 32f28d3 commit ccad62b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/widgets/peanut/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down

0 comments on commit ccad62b

Please sign in to comment.