mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-18 02:29:49 +00:00
Added homeassistant widget
This commit is contained in:
parent
dacb038126
commit
59448b7277
6 changed files with 118 additions and 0 deletions
16
src/widgets/homeassistant/component.jsx
Normal file
16
src/widgets/homeassistant/component.jsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import Container from "components/services/widget/container";
|
||||
import Block from "components/services/widget/block";
|
||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { widget } = service;
|
||||
|
||||
const { data, error } = useWidgetAPI(widget, "", { refreshInterval: 60000 });
|
||||
if (error) {
|
||||
return <Container error={error} />;
|
||||
}
|
||||
const panels = [];
|
||||
data?.forEach(d => panels.push(<Block label={d.label} value={d.value} />));
|
||||
|
||||
return <Container service={service}>{panels}</Container>;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue