@hakit/core
Version:
A collection of React hooks and helpers for Home Assistant to easily communicate with the Home Assistant WebSocket API.
29 lines (28 loc) • 735 B
JavaScript
import { useState as s, useEffect as c } from "react";
import "lodash";
import "../../utils/light/index.js";
import "../useLocale/locales/index.js";
import "../../../index-BfdcdUoC.js";
import "../../HassConnect/HassContext.js";
import "@iconify/react";
import { useStore as m } from "../useStore/index.js";
import "use-debounce";
import "home-assistant-js-websocket";
const S = (t) => {
const [i, r] = s(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
});
r(n);
})();
}, [e, t]), i;
};
export {
S as useDevice
};
//# sourceMappingURL=index.js.map