mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 01:26:01 -08:00
Added homeassistant widget
This commit is contained in:
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>;
|
||||
}
|
||||
Reference in New Issue
Block a user