@digital-alchemy/hass 25.8.12-beta.0 → 25.10.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/services.d.mts +1 -1
- package/dist/helpers/device.d.mts +1 -1
- package/dist/helpers/entity-state.d.mts +6 -6
- package/dist/helpers/fetch/calendar.d.mts +2 -2
- package/dist/helpers/fetch/configuration.d.mts +1 -1
- package/dist/helpers/fetch/service-list.d.mts +3 -3
- package/dist/helpers/fetch.d.mts +2 -2
- package/dist/helpers/fetch.mjs.map +1 -1
- package/dist/helpers/id-by.d.mts +1 -1
- package/dist/helpers/interfaces.d.mts +13 -12
- package/dist/helpers/interfaces.mjs.map +1 -1
- package/dist/helpers/registry.d.mts +1 -1
- package/dist/helpers/utility.d.mts +5 -5
- package/dist/helpers/utility.mjs.map +1 -1
- package/dist/helpers/websocket.d.mts +9 -8
- package/dist/merge.d.mts +1 -1
- package/dist/mock_assistant/helpers/fixtures.d.mts +2 -2
- package/dist/mock_assistant/main.mjs.map +1 -1
- package/dist/mock_assistant/services/area.service.d.mts +2 -2
- package/dist/mock_assistant/services/config.service.d.mts +2 -2
- package/dist/mock_assistant/services/config.service.mjs.map +1 -1
- package/dist/mock_assistant/services/device.service.d.mts +2 -2
- package/dist/mock_assistant/services/device.service.mjs.map +1 -1
- package/dist/mock_assistant/services/entity-registry.service.d.mts +3 -3
- package/dist/mock_assistant/services/entity.service.d.mts +3 -3
- package/dist/mock_assistant/services/entity.service.mjs.map +1 -1
- package/dist/mock_assistant/services/events.service.d.mts +3 -3
- package/dist/mock_assistant/services/events.service.mjs.map +1 -1
- package/dist/mock_assistant/services/fixtures.service.d.mts +4 -4
- package/dist/mock_assistant/services/fixtures.service.mjs.map +1 -1
- package/dist/mock_assistant/services/floor.service.d.mts +2 -2
- package/dist/mock_assistant/services/label.service.d.mts +2 -2
- package/dist/mock_assistant/services/services.service.d.mts +2 -2
- package/dist/mock_assistant/services/websocket-api.service.d.mts +4 -4
- package/dist/mock_assistant/services/websocket-api.service.mjs.map +1 -1
- package/dist/mock_assistant/services/zone.service.d.mts +2 -2
- package/dist/quickboot.module.d.mts +1 -1
- package/dist/quickboot.module.mjs.map +1 -1
- package/dist/services/area.service.d.mts +2 -2
- package/dist/services/area.service.mjs +1 -1
- package/dist/services/area.service.mjs.map +1 -1
- package/dist/services/backup.service.d.mts +2 -2
- package/dist/services/backup.service.mjs.map +1 -1
- package/dist/services/call-proxy.service.d.mts +2 -2
- package/dist/services/call-proxy.service.mjs +1 -1
- package/dist/services/call-proxy.service.mjs.map +1 -1
- package/dist/services/config.service.d.mts +2 -2
- package/dist/services/config.service.mjs +1 -2
- package/dist/services/config.service.mjs.map +1 -1
- package/dist/services/conversation.service.d.mts +2 -2
- package/dist/services/conversation.service.mjs +1 -1
- package/dist/services/conversation.service.mjs.map +1 -1
- package/dist/services/device.service.d.mts +2 -2
- package/dist/services/device.service.mjs +1 -1
- package/dist/services/device.service.mjs.map +1 -1
- package/dist/services/diagnostics.service.d.mts +1 -1
- package/dist/services/entity.service.d.mts +2 -2
- package/dist/services/entity.service.mjs +2 -2
- package/dist/services/entity.service.mjs.map +1 -1
- package/dist/services/events.service.d.mts +2 -2
- package/dist/services/events.service.mjs.map +1 -1
- package/dist/services/fetch-api.service.d.mts +5 -5
- package/dist/services/fetch-api.service.mjs +1 -1
- package/dist/services/fetch-api.service.mjs.map +1 -1
- package/dist/services/floor.service.d.mts +2 -2
- package/dist/services/floor.service.mjs +1 -1
- package/dist/services/floor.service.mjs.map +1 -1
- package/dist/services/id-by.service.d.mts +2 -2
- package/dist/services/id-by.service.mjs.map +1 -1
- package/dist/services/internal.service.d.mts +2 -2
- package/dist/services/internal.service.mjs +1 -1
- package/dist/services/internal.service.mjs.map +1 -1
- package/dist/services/label.service.d.mts +2 -2
- package/dist/services/label.service.mjs +1 -1
- package/dist/services/label.service.mjs.map +1 -1
- package/dist/services/reference.service.d.mts +2 -2
- package/dist/services/reference.service.mjs +1 -1
- package/dist/services/reference.service.mjs.map +1 -1
- package/dist/services/registry.service.d.mts +2 -2
- package/dist/services/websocket-api.service.d.mts +2 -2
- package/dist/services/websocket-api.service.mjs +2 -2
- package/dist/services/websocket-api.service.mjs.map +1 -1
- package/dist/services/zone.service.d.mts +2 -2
- package/dist/services/zone.service.mjs +1 -1
- package/dist/services/zone.service.mjs.map +1 -1
- package/dist/testing/area.spec.mjs.map +1 -1
- package/dist/testing/floor.spec.mjs.map +1 -1
- package/dist/testing/label.spec.mjs.map +1 -1
- package/dist/testing/zone.spec.mjs.map +1 -1
- package/package.json +29 -29
- package/src/dev/services.mts +1 -1
- package/src/helpers/device.mts +1 -1
- package/src/helpers/entity-state.mts +6 -6
- package/src/helpers/fetch/calendar.mts +2 -2
- package/src/helpers/fetch/configuration.mts +1 -1
- package/src/helpers/fetch/service-list.mts +3 -3
- package/src/helpers/fetch.mts +3 -2
- package/src/helpers/id-by.mts +1 -1
- package/src/helpers/interfaces.mts +14 -13
- package/src/helpers/registry.mts +1 -1
- package/src/helpers/utility.mts +6 -5
- package/src/helpers/websocket.mts +12 -8
- package/src/merge.mts +1 -1
- package/src/mock_assistant/helpers/fixtures.mts +2 -2
- package/src/mock_assistant/main.mts +3 -2
- package/src/mock_assistant/services/area.service.mts +3 -3
- package/src/mock_assistant/services/config.service.mts +3 -2
- package/src/mock_assistant/services/device.service.mts +4 -3
- package/src/mock_assistant/services/entity-registry.service.mts +3 -3
- package/src/mock_assistant/services/entity.service.mts +4 -3
- package/src/mock_assistant/services/events.service.mts +4 -3
- package/src/mock_assistant/services/fixtures.service.mts +5 -4
- package/src/mock_assistant/services/floor.service.mts +3 -3
- package/src/mock_assistant/services/label.service.mts +3 -3
- package/src/mock_assistant/services/services.service.mts +2 -2
- package/src/mock_assistant/services/websocket-api.service.mts +5 -4
- package/src/mock_assistant/services/zone.service.mts +3 -3
- package/src/quickboot.module.mts +2 -1
- package/src/services/area.service.mts +5 -11
- package/src/services/backup.service.mts +3 -2
- package/src/services/call-proxy.service.mts +4 -4
- package/src/services/config.service.mts +5 -8
- package/src/services/conversation.service.mts +3 -7
- package/src/services/device.service.mts +4 -8
- package/src/services/diagnostics.service.mts +1 -1
- package/src/services/entity.service.mts +7 -15
- package/src/services/events.service.mts +2 -3
- package/src/services/fetch-api.service.mts +8 -7
- package/src/services/floor.service.mts +5 -10
- package/src/services/id-by.service.mts +5 -3
- package/src/services/internal.service.mts +4 -4
- package/src/services/label.service.mts +5 -10
- package/src/services/reference.service.mts +8 -7
- package/src/services/registry.service.mts +2 -2
- package/src/services/websocket-api.service.mts +10 -15
- package/src/services/zone.service.mts +4 -10
- package/src/testing/area.spec.mts +3 -2
- package/src/testing/backup.spec.mts +1 -1
- package/src/testing/config.spec.mts +1 -1
- package/src/testing/device.spec.mts +1 -1
- package/src/testing/entity.spec.mts +2 -2
- package/src/testing/fetch-api.spec.mts +2 -2
- package/src/testing/floor.spec.mts +3 -2
- package/src/testing/id-by.spec.mts +1 -1
- package/src/testing/label.spec.mts +3 -2
- package/src/testing/ref-by.spec.mts +2 -2
- package/src/testing/zone.spec.mts +2 -1
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { debounce, eachSeries, InternalError } from "@digital-alchemy/core";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
AreaDetails,
|
|
7
|
-
EARLY_ON_READY,
|
|
8
|
-
ENTITY_REGISTRY_UPDATED,
|
|
9
|
-
HassAreaService,
|
|
10
|
-
perf,
|
|
11
|
-
} from "../index.mts";
|
|
12
|
-
import { ANY_ENTITY, TAreaId } from "../user.mts";
|
|
4
|
+
import type { AreaCreate, AreaDetails, HassAreaService } from "../index.mts";
|
|
5
|
+
import { AREA_REGISTRY_UPDATED, EARLY_ON_READY, ENTITY_REGISTRY_UPDATED, perf } from "../index.mts";
|
|
6
|
+
import type { ANY_ENTITY, TAreaId } from "../user.mts";
|
|
13
7
|
|
|
14
8
|
export function Area({
|
|
15
9
|
hass,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { SECOND, sleep } from "@digital-alchemy/core";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import type {
|
|
4
5
|
BackupResponse,
|
|
5
6
|
HassBackupService,
|
|
6
7
|
HomeAssistantBackup,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { TServiceParams } from "@digital-alchemy/core";
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
4
|
ALL_SERVICE_DOMAINS,
|
|
5
|
-
perf,
|
|
6
5
|
PICK_SERVICE,
|
|
7
6
|
PICK_SERVICE_PARAMETERS,
|
|
8
7
|
} from "../helpers/index.mts";
|
|
9
|
-
import {
|
|
8
|
+
import { perf } from "../helpers/index.mts";
|
|
9
|
+
import type { iCallService } from "../user.mts";
|
|
10
10
|
|
|
11
11
|
export function CallProxy({
|
|
12
12
|
logger,
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
-
import {
|
|
2
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
3
|
+
import { asyncNoop, INCREMENT, SECOND, sleep, START } from "@digital-alchemy/core";
|
|
3
4
|
import { env } from "process";
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
HassServiceDTO,
|
|
9
|
-
PostConfigPriorities,
|
|
10
|
-
} from "../helpers/index.mts";
|
|
11
|
-
import { iCallService } from "../user.mts";
|
|
6
|
+
import type { ALL_SERVICE_DOMAINS, HassConfigService, HassServiceDTO } from "../helpers/index.mts";
|
|
7
|
+
import { PostConfigPriorities } from "../helpers/index.mts";
|
|
8
|
+
import type { iCallService } from "../user.mts";
|
|
12
9
|
|
|
13
10
|
const MAX_ATTEMPTS = 50;
|
|
14
11
|
const FAILED = 1;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { TServiceParams } from "@digital-alchemy/core";
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
HassConversationService,
|
|
6
|
-
ToggleExpose,
|
|
7
|
-
UPDATE_REGISTRY,
|
|
8
|
-
} from "../helpers/index.mts";
|
|
3
|
+
import type { EditAliasOptions, HassConversationService, ToggleExpose } from "../helpers/index.mts";
|
|
4
|
+
import { UPDATE_REGISTRY } from "../helpers/index.mts";
|
|
9
5
|
|
|
10
6
|
export function Conversation({ hass, logger }: TServiceParams): HassConversationService {
|
|
11
7
|
async function addAlias({ entity, alias }: EditAliasOptions) {
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { debounce } from "@digital-alchemy/core";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
DeviceDetails,
|
|
6
|
-
EARLY_ON_READY,
|
|
7
|
-
HassDeviceService,
|
|
8
|
-
perf,
|
|
9
|
-
} from "../helpers/index.mts";
|
|
4
|
+
import type { DeviceDetails, HassDeviceService } from "../helpers/index.mts";
|
|
5
|
+
import { DEVICE_REGISTRY_UPDATED, EARLY_ON_READY, perf } from "../helpers/index.mts";
|
|
10
6
|
|
|
11
7
|
export function Device({
|
|
12
8
|
hass,
|
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
INCREMENT,
|
|
6
|
-
SECOND,
|
|
7
|
-
sleep,
|
|
8
|
-
START,
|
|
9
|
-
TServiceParams,
|
|
10
|
-
} from "@digital-alchemy/core";
|
|
11
|
-
import dayjs, { Dayjs } from "dayjs";
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { debounce, each, eachSeries, INCREMENT, SECOND, sleep, START } from "@digital-alchemy/core";
|
|
3
|
+
import type { Dayjs } from "dayjs";
|
|
4
|
+
import dayjs from "dayjs";
|
|
12
5
|
|
|
13
|
-
import {
|
|
6
|
+
import type {
|
|
14
7
|
EditLabelOptions,
|
|
15
|
-
ENTITY_REGISTRY_UPDATED,
|
|
16
8
|
ENTITY_STATE,
|
|
17
9
|
EntityHistoryDTO,
|
|
18
10
|
EntityHistoryItem,
|
|
19
11
|
EntityHistoryResult,
|
|
20
12
|
EntityRegistryItem,
|
|
21
13
|
HassEntityManager,
|
|
22
|
-
perf,
|
|
23
14
|
TMasterState,
|
|
24
15
|
} from "../index.mts";
|
|
25
|
-
import {
|
|
16
|
+
import { ENTITY_REGISTRY_UPDATED, perf } from "../index.mts";
|
|
17
|
+
import type { ALL_DOMAINS, ANY_ENTITY, PICK_ENTITY } from "../user.mts";
|
|
26
18
|
|
|
27
19
|
const MAX_ATTEMPTS = 10;
|
|
28
20
|
const RECENT = 5;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { TServiceParams } from "@digital-alchemy/core";
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
2
|
|
|
3
|
+
import type { HassEventsService, SimpleCallback } from "../helpers/index.mts";
|
|
3
4
|
import {
|
|
4
5
|
AREA_REGISTRY_UPDATED,
|
|
5
6
|
DEVICE_REGISTRY_UPDATED,
|
|
6
7
|
ENTITY_REGISTRY_UPDATED,
|
|
7
8
|
FLOOR_REGISTRY_UPDATED,
|
|
8
|
-
HassEventsService,
|
|
9
9
|
LABEL_REGISTRY_UPDATED,
|
|
10
|
-
SimpleCallback,
|
|
11
10
|
ZONE_REGISTRY_UPDATED,
|
|
12
11
|
} from "../helpers/index.mts";
|
|
13
12
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { DOWN, NO_CHANGE, SECOND, UP } from "@digital-alchemy/core";
|
|
3
|
+
import type { Dayjs } from "dayjs";
|
|
4
|
+
import dayjs from "dayjs";
|
|
3
5
|
|
|
4
|
-
import { FetchArguments, FilteredFetchArguments, TFetchBody } from "../helpers/fetch.mts";
|
|
5
|
-
import {
|
|
6
|
+
import type { FetchArguments, FilteredFetchArguments, TFetchBody } from "../helpers/fetch.mts";
|
|
7
|
+
import type {
|
|
6
8
|
ALL_SERVICE_DOMAINS,
|
|
7
9
|
CalendarEvent,
|
|
8
10
|
CalendarFetchOptions,
|
|
@@ -11,13 +13,12 @@ import {
|
|
|
11
13
|
HassConfig,
|
|
12
14
|
HassServiceDTO,
|
|
13
15
|
HomeAssistantServerLogItem,
|
|
14
|
-
perf,
|
|
15
16
|
PICK_SERVICE,
|
|
16
17
|
PICK_SERVICE_PARAMETERS,
|
|
17
|
-
PostConfigPriorities,
|
|
18
18
|
RawCalendarEvent,
|
|
19
19
|
} from "../helpers/index.mts";
|
|
20
|
-
import {
|
|
20
|
+
import { perf, PostConfigPriorities } from "../helpers/index.mts";
|
|
21
|
+
import type { ANY_ENTITY } from "../user.mts";
|
|
21
22
|
|
|
22
23
|
type SendBody<STATE extends string | number = string, ATTRIBUTES extends object = object> = {
|
|
23
24
|
attributes?: ATTRIBUTES;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { debounce } from "@digital-alchemy/core";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
FloorCreate,
|
|
7
|
-
FloorDetails,
|
|
8
|
-
HassFloorService,
|
|
9
|
-
perf,
|
|
10
|
-
} from "../helpers/index.mts";
|
|
11
|
-
import { TFloorId } from "../user.mts";
|
|
4
|
+
import type { FloorCreate, FloorDetails, HassFloorService } from "../helpers/index.mts";
|
|
5
|
+
import { EARLY_ON_READY, FLOOR_REGISTRY_UPDATED, perf } from "../helpers/index.mts";
|
|
6
|
+
import type { TFloorId } from "../user.mts";
|
|
12
7
|
|
|
13
8
|
export function Floor({
|
|
14
9
|
hass,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { FIRST, SINGLE } from "@digital-alchemy/core";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import type { EntityRegistryItem, IDByInterface } from "../index.mts";
|
|
5
|
+
import { domain } from "../index.mts";
|
|
6
|
+
import type {
|
|
5
7
|
ALL_DOMAINS,
|
|
6
8
|
ANY_ENTITY,
|
|
7
9
|
HassUniqueIdMapping,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { FIRST, InternalError } from "@digital-alchemy/core";
|
|
2
3
|
import { createWriteStream } from "fs";
|
|
3
4
|
import { pipeline } from "stream";
|
|
4
5
|
import { promisify } from "util";
|
|
5
6
|
|
|
6
|
-
import {
|
|
7
|
-
buildFilterString,
|
|
7
|
+
import type {
|
|
8
8
|
DownloadOptions,
|
|
9
9
|
FetchArguments,
|
|
10
10
|
FetcherOptions,
|
|
11
11
|
FetchProcessTypes,
|
|
12
12
|
FetchWith,
|
|
13
|
-
isDomain,
|
|
14
13
|
MaybeHttpError,
|
|
15
14
|
TFetchBody,
|
|
16
15
|
} from "../helpers/index.mts";
|
|
16
|
+
import { buildFilterString, isDomain } from "../helpers/index.mts";
|
|
17
17
|
|
|
18
18
|
const streamPipeline = promisify(pipeline);
|
|
19
19
|
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { debounce } from "@digital-alchemy/core";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
LABEL_REGISTRY_UPDATED,
|
|
7
|
-
LabelDefinition,
|
|
8
|
-
LabelOptions,
|
|
9
|
-
perf,
|
|
10
|
-
} from "../helpers/index.mts";
|
|
11
|
-
import { TLabelId } from "../user.mts";
|
|
4
|
+
import type { HassLabelService, LabelDefinition, LabelOptions } from "../helpers/index.mts";
|
|
5
|
+
import { EARLY_ON_READY, LABEL_REGISTRY_UPDATED, perf } from "../helpers/index.mts";
|
|
6
|
+
import type { TLabelId } from "../user.mts";
|
|
12
7
|
|
|
13
8
|
export function Label({
|
|
14
9
|
hass,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import type { TAnyFunction, TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { DOWN, NONE, sleep, UP } from "@digital-alchemy/core";
|
|
3
|
+
import type { Dayjs } from "dayjs";
|
|
4
|
+
import dayjs from "dayjs";
|
|
5
|
+
import type { Get } from "type-fest";
|
|
4
6
|
|
|
5
|
-
import {
|
|
7
|
+
import type {
|
|
6
8
|
ALL_SERVICE_DOMAINS,
|
|
7
9
|
ByIdProxy,
|
|
8
|
-
domain,
|
|
9
10
|
ENTITY_STATE,
|
|
10
11
|
HassReferenceService,
|
|
11
|
-
perf,
|
|
12
12
|
RemoveCallback,
|
|
13
13
|
} from "../helpers/index.mts";
|
|
14
|
-
import {
|
|
14
|
+
import { domain, perf } from "../helpers/index.mts";
|
|
15
|
+
import type {
|
|
15
16
|
ANY_ENTITY,
|
|
16
17
|
HassUniqueIdMapping,
|
|
17
18
|
PICK_ENTITY,
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
START,
|
|
6
|
-
TBlackHole,
|
|
7
|
-
TServiceParams,
|
|
8
|
-
} from "@digital-alchemy/core";
|
|
9
|
-
import dayjs, { Dayjs } from "dayjs";
|
|
1
|
+
import type { TBlackHole, TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { InternalError, SECOND, sleep, START } from "@digital-alchemy/core";
|
|
3
|
+
import type { Dayjs } from "dayjs";
|
|
4
|
+
import dayjs from "dayjs";
|
|
10
5
|
import EventEmitter from "events";
|
|
6
|
+
import type { EmptyObject } from "type-fest";
|
|
11
7
|
import WS from "ws";
|
|
12
8
|
|
|
13
|
-
import {
|
|
9
|
+
import type {
|
|
14
10
|
ConnectionState,
|
|
15
11
|
EntityUpdateEvent,
|
|
16
12
|
HassWebsocketAPI,
|
|
@@ -523,11 +519,10 @@ export function WebsocketAPI({
|
|
|
523
519
|
}
|
|
524
520
|
|
|
525
521
|
// #MARK: subscribe
|
|
526
|
-
async function subscribe<
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}: SocketSubscribeOptions<EVENT>) {
|
|
522
|
+
async function subscribe<
|
|
523
|
+
EVENT extends string,
|
|
524
|
+
PAYLOAD extends Record<string, unknown> = EmptyObject,
|
|
525
|
+
>({ event_type, context, exec }: SocketSubscribeOptions<EVENT, PAYLOAD>) {
|
|
531
526
|
await hass.socket.sendMessage({ event_type, type: "subscribe_events" });
|
|
532
527
|
return hass.socket.onEvent({
|
|
533
528
|
context,
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TServiceParams } from "@digital-alchemy/core";
|
|
2
|
+
import { debounce } from "@digital-alchemy/core";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
HassZoneService,
|
|
6
|
-
ManifestItem,
|
|
7
|
-
perf,
|
|
8
|
-
ZONE_REGISTRY_UPDATED,
|
|
9
|
-
ZoneDetails,
|
|
10
|
-
ZoneOptions,
|
|
11
|
-
} from "../helpers/index.mts";
|
|
4
|
+
import type { HassZoneService, ManifestItem, ZoneDetails, ZoneOptions } from "../helpers/index.mts";
|
|
5
|
+
import { EARLY_ON_READY, perf, ZONE_REGISTRY_UPDATED } from "../helpers/index.mts";
|
|
12
6
|
|
|
13
7
|
export function Zone({
|
|
14
8
|
config,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { sleep } from "@digital-alchemy/core";
|
|
2
2
|
import { subscribe } from "diagnostics_channel";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type { AreaDetails } from "../helpers/index.mts";
|
|
5
|
+
import { AREA_REGISTRY_UPDATED } from "../helpers/index.mts";
|
|
5
6
|
import { hassTestRunner, INTERNAL_MESSAGE } from "../mock_assistant/index.mts";
|
|
6
|
-
import { TAreaId } from "../user.mts";
|
|
7
|
+
import type { TAreaId } from "../user.mts";
|
|
7
8
|
|
|
8
9
|
const EXAMPLE_AREA = {
|
|
9
10
|
area_id: "empty_area" as TAreaId,
|
|
@@ -2,7 +2,7 @@ import { subscribe } from "node:diagnostics_channel";
|
|
|
2
2
|
|
|
3
3
|
import { sleep } from "@digital-alchemy/core";
|
|
4
4
|
|
|
5
|
-
import { DeviceDetails } from "../helpers/index.mts";
|
|
5
|
+
import type { DeviceDetails } from "../helpers/index.mts";
|
|
6
6
|
import { hassTestRunner } from "../mock_assistant/index.mts";
|
|
7
7
|
|
|
8
8
|
describe("Device", () => {
|
|
@@ -3,9 +3,9 @@ import { subscribe } from "node:diagnostics_channel";
|
|
|
3
3
|
import { sleep } from "@digital-alchemy/core";
|
|
4
4
|
import dayjs from "dayjs";
|
|
5
5
|
|
|
6
|
-
import { ENTITY_STATE } from "../index.mts";
|
|
6
|
+
import type { ENTITY_STATE } from "../index.mts";
|
|
7
7
|
import { hassTestRunner } from "../mock_assistant/index.mts";
|
|
8
|
-
import { ANY_ENTITY } from "../user.mts";
|
|
8
|
+
import type { ANY_ENTITY } from "../user.mts";
|
|
9
9
|
|
|
10
10
|
describe("Entity", () => {
|
|
11
11
|
afterEach(async () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
|
-
import { MockInstance } from "vitest";
|
|
2
|
+
import type { MockInstance } from "vitest";
|
|
3
3
|
|
|
4
|
-
import { HassConfig } from "../helpers/index.mts";
|
|
4
|
+
import type { HassConfig } from "../helpers/index.mts";
|
|
5
5
|
import { hassTestRunner } from "../mock_assistant/index.mts";
|
|
6
6
|
|
|
7
7
|
describe("FetchAPI", () => {
|
|
@@ -2,9 +2,10 @@ import { subscribe } from "node:diagnostics_channel";
|
|
|
2
2
|
|
|
3
3
|
import { sleep } from "@digital-alchemy/core";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type { FloorDetails } from "../helpers/index.mts";
|
|
6
|
+
import { FLOOR_REGISTRY_UPDATED } from "../helpers/index.mts";
|
|
6
7
|
import { hassTestRunner } from "../mock_assistant/index.mts";
|
|
7
|
-
import { TFloorId } from "../user.mts";
|
|
8
|
+
import type { TFloorId } from "../user.mts";
|
|
8
9
|
|
|
9
10
|
describe("Floor", () => {
|
|
10
11
|
const EXAMPLE_FLOOR = {
|
|
@@ -2,9 +2,10 @@ import { subscribe } from "node:diagnostics_channel";
|
|
|
2
2
|
|
|
3
3
|
import { sleep } from "@digital-alchemy/core";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type { LabelDefinition } from "../helpers/index.mts";
|
|
6
|
+
import { LABEL_REGISTRY_UPDATED } from "../helpers/index.mts";
|
|
6
7
|
import { hassTestRunner } from "../mock_assistant/index.mts";
|
|
7
|
-
import { TLabelId } from "../user.mts";
|
|
8
|
+
import type { TLabelId } from "../user.mts";
|
|
8
9
|
|
|
9
10
|
describe("Label", () => {
|
|
10
11
|
const EXAMPLE_LABEL = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
2
|
|
|
3
|
-
import { ENTITY_STATE } from "../helpers/index.mts";
|
|
3
|
+
import type { ENTITY_STATE } from "../helpers/index.mts";
|
|
4
4
|
import { hassTestRunner } from "../mock_assistant/index.mts";
|
|
5
|
-
import { ANY_ENTITY } from "../user.mts";
|
|
5
|
+
import type { ANY_ENTITY } from "../user.mts";
|
|
6
6
|
|
|
7
7
|
describe("References", () => {
|
|
8
8
|
afterEach(async () => {
|
|
@@ -2,7 +2,8 @@ import { subscribe } from "node:diagnostics_channel";
|
|
|
2
2
|
|
|
3
3
|
import { sleep } from "@digital-alchemy/core";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type { ZoneDetails } from "../helpers/index.mts";
|
|
6
|
+
import { ZONE_REGISTRY_UPDATED } from "../helpers/index.mts";
|
|
6
7
|
import { hassTestRunner } from "../mock_assistant/index.mts";
|
|
7
8
|
|
|
8
9
|
describe("Zone", () => {
|