Fix: Peanut widget v2 api compatibility (#2526)

pull/2528/head
Brandon McFarlin 1 year ago committed by GitHub
parent 32f28d32dd
commit ccad62b5c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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":

Loading…
Cancel
Save