@hakit/core
Version:
A collection of React hooks and helpers for Home Assistant to easily communicate with the Home Assistant WebSocket API.
27 lines (26 loc) • 647 B
JavaScript
import { useState as r, useEffect as c } from "react";
import "lodash";
import { X as m } from "../../../index-BDZyTvOW.js";
import "../useLocale/locales/index.js";
import "home-assistant-js-websocket";
import "../../utils/date.js";
import "@iconify/react";
import "use-debounce";
const d = (t) => {
const [i, s] = r(null), e = m((o) => o.connection);
return c(() => {
(async () => {
if (!e)
return;
const n = await e.sendMessagePromise({
type: "config/entity_registry/get",
entity_id: t
});
s(n);
})();
}, [e, t]), i;
};
export {
d as useDevice
};
//# sourceMappingURL=index.js.map