Better locations
This commit is contained in:
parent
95af086efa
commit
a9c72e4ebc
@ -27,13 +27,18 @@ const HomeAssistant = ({ hassUrl, token }: { hassUrl: string, token: string }) =
|
|||||||
const vicki = await fetchState("person.vicki")
|
const vicki = await fetchState("person.vicki")
|
||||||
const nextbikes = await fetchState("sensor.nextbikes")
|
const nextbikes = await fetchState("sensor.nextbikes")
|
||||||
|
|
||||||
|
const location = (l: string|undefined) => { switch (l) {
|
||||||
|
case "home": return "Zuhause";
|
||||||
|
case "not_home": return "Unterwegs";
|
||||||
|
case undefined:
|
||||||
|
case "unknown": return "Unbekannt";
|
||||||
|
default: return l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log(daniel);
|
|
||||||
console.log(vicki);
|
|
||||||
console.log(nextbikes);
|
|
||||||
setStates({
|
setStates({
|
||||||
daniel: daniel?.state === "home" ? "Zuhause" : "Unterwegs",
|
daniel: location(daniel?.state),
|
||||||
vicki: vicki?.state === "home" ? "Zuhause" : "Unterwegs",
|
vicki: location(vicki?.state),
|
||||||
nextbikes: nextbikes?.state
|
nextbikes: nextbikes?.state
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user