UNPKG

@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) 747 B
import { useState as c, useEffect as m } from "react"; import "lodash"; import "../../utils/light/index.js"; import "../useLocale/locales/index.js"; import { u as p } from "../../../index-DnHwXFlq.js"; import "../../HassConnect/HassContext.js"; import "@iconify/react"; import "use-debounce"; import "deep-object-diff"; import "home-assistant-js-websocket"; const _ = (t) => { const [i, s] = c(null), { useStore: r } = p(), e = r((o) => o.connection); return m(() => { (async () => { if (!e) return; const n = await e.sendMessagePromise({ type: "config/entity_registry/get", entity_id: t }); s(n); })(); }, [e, t]), i; }; export { _ as useDevice }; //# sourceMappingURL=index.js.map