UNPKG

@hakit/core

Version:

A collection of React hooks and helpers for Home Assistant to easily communicate with the Home Assistant WebSocket API.

31 lines (30 loc) 739 B
import { useCallback as n } from "react"; import "lodash"; import "../../utils/light/index.js"; import { u as e, l as u } from "../../../index-DnHwXFlq.js"; import "../../HassConnect/HassContext.js"; import "@iconify/react"; import "use-debounce"; import "deep-object-diff"; import "home-assistant-js-websocket"; import "../useLocale/locales/index.js"; function k(t) { const { useStore: i } = e(), r = i((o) => o.entities[t]); return n( (o) => { if (t === "unknown") return null; if (!r) { if (o) return null; throw new Error(`${u("entity_not_found")} - "${t}"`); } return r; }, [r, t] ); } export { k as useSubscribeEntity }; //# sourceMappingURL=index.js.map