matter-all-in-one-addon 1.8.21
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/README.md +183 -0
- package/dist/camera/ai/camera-ai-detector.d.ts +44 -0
- package/dist/camera/ai/camera-ai-detector.js +329 -0
- package/dist/camera/ai/camera-ai-detector.js.map +1 -0
- package/dist/camera/camera-capabilities.d.ts +13 -0
- package/dist/camera/camera-capabilities.js +186 -0
- package/dist/camera/camera-capabilities.js.map +1 -0
- package/dist/camera/camera-source-resolver.d.ts +18 -0
- package/dist/camera/camera-source-resolver.js +187 -0
- package/dist/camera/camera-source-resolver.js.map +1 -0
- package/dist/camera/camera-types.d.ts +124 -0
- package/dist/camera/camera-types.js +8 -0
- package/dist/camera/camera-types.js.map +1 -0
- package/dist/camera/cameraui/cameraui-client.d.ts +54 -0
- package/dist/camera/cameraui/cameraui-client.js +698 -0
- package/dist/camera/cameraui/cameraui-client.js.map +1 -0
- package/dist/camera/cameraui/cameraui-homekit-bridge.d.ts +21 -0
- package/dist/camera/cameraui/cameraui-homekit-bridge.js +343 -0
- package/dist/camera/cameraui/cameraui-homekit-bridge.js.map +1 -0
- package/dist/camera/cameraui/cameraui-storage.d.ts +17 -0
- package/dist/camera/cameraui/cameraui-storage.js +916 -0
- package/dist/camera/cameraui/cameraui-storage.js.map +1 -0
- package/dist/camera/cameraui/cameraui-types.d.ts +89 -0
- package/dist/camera/cameraui/cameraui-types.js +5 -0
- package/dist/camera/cameraui/cameraui-types.js.map +1 -0
- package/dist/camera/homekit/ffmpeg-helper.d.ts +88 -0
- package/dist/camera/homekit/ffmpeg-helper.js +673 -0
- package/dist/camera/homekit/ffmpeg-helper.js.map +1 -0
- package/dist/camera/homekit/fmp4-parser.d.ts +48 -0
- package/dist/camera/homekit/fmp4-parser.js +156 -0
- package/dist/camera/homekit/fmp4-parser.js.map +1 -0
- package/dist/camera/homekit/hevc-eligibility.d.ts +16 -0
- package/dist/camera/homekit/hevc-eligibility.js +153 -0
- package/dist/camera/homekit/hevc-eligibility.js.map +1 -0
- package/dist/camera/homekit/homekit-camera-recording.delegate.d.ts +73 -0
- package/dist/camera/homekit/homekit-camera-recording.delegate.js +445 -0
- package/dist/camera/homekit/homekit-camera-recording.delegate.js.map +1 -0
- package/dist/camera/homekit/homekit-camera-stream.delegate.d.ts +47 -0
- package/dist/camera/homekit/homekit-camera-stream.delegate.js +833 -0
- package/dist/camera/homekit/homekit-camera-stream.delegate.js.map +1 -0
- package/dist/camera/homekit/homekit-camera.accessory.d.ts +53 -0
- package/dist/camera/homekit/homekit-camera.accessory.js +697 -0
- package/dist/camera/homekit/homekit-camera.accessory.js.map +1 -0
- package/dist/camera/matter/camera-endpoint.builder.d.ts +7 -0
- package/dist/camera/matter/camera-endpoint.builder.js +127 -0
- package/dist/camera/matter/camera-endpoint.builder.js.map +1 -0
- package/dist/camera/matter/camera-session-manager.d.ts +46 -0
- package/dist/camera/matter/camera-session-manager.js +120 -0
- package/dist/camera/matter/camera-session-manager.js.map +1 -0
- package/dist/camera/matter/camera-webrtc-adapter.d.ts +62 -0
- package/dist/camera/matter/camera-webrtc-adapter.js +298 -0
- package/dist/camera/matter/camera-webrtc-adapter.js.map +1 -0
- package/dist/camera/motion/ffmpeg-motion-detector.d.ts +46 -0
- package/dist/camera/motion/ffmpeg-motion-detector.js +200 -0
- package/dist/camera/motion/ffmpeg-motion-detector.js.map +1 -0
- package/dist/camera/nest/nest-camera-adapter.d.ts +38 -0
- package/dist/camera/nest/nest-camera-adapter.js +109 -0
- package/dist/camera/nest/nest-camera-adapter.js.map +1 -0
- package/dist/camera/scrypted/scrypted-camera-card.d.ts +39 -0
- package/dist/camera/scrypted/scrypted-camera-card.js +38 -0
- package/dist/camera/scrypted/scrypted-camera-card.js.map +1 -0
- package/dist/camera/scrypted/scrypted-camera-detail.d.ts +33 -0
- package/dist/camera/scrypted/scrypted-camera-detail.js +34 -0
- package/dist/camera/scrypted/scrypted-camera-detail.js.map +1 -0
- package/dist/camera/scrypted/scrypted-camera-discovery-adapter.d.ts +17 -0
- package/dist/camera/scrypted/scrypted-camera-discovery-adapter.js +24 -0
- package/dist/camera/scrypted/scrypted-camera-discovery-adapter.js.map +1 -0
- package/dist/camera/scrypted/scrypted-camera-normalizer.d.ts +44 -0
- package/dist/camera/scrypted/scrypted-camera-normalizer.js +44 -0
- package/dist/camera/scrypted/scrypted-camera-normalizer.js.map +1 -0
- package/dist/camera/scrypted/scrypted-camera-policy.d.ts +11 -0
- package/dist/camera/scrypted/scrypted-camera-policy.js +13 -0
- package/dist/camera/scrypted/scrypted-camera-policy.js.map +1 -0
- package/dist/camera/scrypted/scrypted-camera-presentation.d.ts +13 -0
- package/dist/camera/scrypted/scrypted-camera-presentation.js +23 -0
- package/dist/camera/scrypted/scrypted-camera-presentation.js.map +1 -0
- package/dist/camera/scrypted/scrypted-client-discovery-adapter.d.ts +6 -0
- package/dist/camera/scrypted/scrypted-client-discovery-adapter.js +12 -0
- package/dist/camera/scrypted/scrypted-client-discovery-adapter.js.map +1 -0
- package/dist/camera/scrypted/scrypted-client.d.ts +152 -0
- package/dist/camera/scrypted/scrypted-client.js +1170 -0
- package/dist/camera/scrypted/scrypted-client.js.map +1 -0
- package/dist/camera/scrypted/scrypted-crypto.d.ts +21 -0
- package/dist/camera/scrypted/scrypted-crypto.js +90 -0
- package/dist/camera/scrypted/scrypted-crypto.js.map +1 -0
- package/dist/camera/scrypted/scrypted-discovery-provider.d.ts +9 -0
- package/dist/camera/scrypted/scrypted-discovery-provider.js +25 -0
- package/dist/camera/scrypted/scrypted-discovery-provider.js.map +1 -0
- package/dist/camera/scrypted/scrypted-homekit-bridge.d.ts +12 -0
- package/dist/camera/scrypted/scrypted-homekit-bridge.js +214 -0
- package/dist/camera/scrypted/scrypted-homekit-bridge.js.map +1 -0
- package/dist/camera/scrypted/scrypted-matter-bridge.d.ts +36 -0
- package/dist/camera/scrypted/scrypted-matter-bridge.js +226 -0
- package/dist/camera/scrypted/scrypted-matter-bridge.js.map +1 -0
- package/dist/camera/scrypted/scrypted-reconnect-manager.d.ts +40 -0
- package/dist/camera/scrypted/scrypted-reconnect-manager.js +353 -0
- package/dist/camera/scrypted/scrypted-reconnect-manager.js.map +1 -0
- package/dist/camera/scrypted/scrypted-runtime-connector.d.ts +7 -0
- package/dist/camera/scrypted/scrypted-runtime-connector.js +17 -0
- package/dist/camera/scrypted/scrypted-runtime-connector.js.map +1 -0
- package/dist/camera/scrypted/scrypted-runtime-facade.d.ts +13 -0
- package/dist/camera/scrypted/scrypted-runtime-facade.js +29 -0
- package/dist/camera/scrypted/scrypted-runtime-facade.js.map +1 -0
- package/dist/camera/scrypted/scrypted-runtime-ingest.d.ts +5 -0
- package/dist/camera/scrypted/scrypted-runtime-ingest.js +54 -0
- package/dist/camera/scrypted/scrypted-runtime-ingest.js.map +1 -0
- package/dist/camera/scrypted/scrypted-storage.d.ts +95 -0
- package/dist/camera/scrypted/scrypted-storage.js +698 -0
- package/dist/camera/scrypted/scrypted-storage.js.map +1 -0
- package/dist/camera/scrypted/scrypted-stream-validator.d.ts +46 -0
- package/dist/camera/scrypted/scrypted-stream-validator.js +412 -0
- package/dist/camera/scrypted/scrypted-stream-validator.js.map +1 -0
- package/dist/camera/scrypted/scrypted-types.d.ts +354 -0
- package/dist/camera/scrypted/scrypted-types.js +6 -0
- package/dist/camera/scrypted/scrypted-types.js.map +1 -0
- package/dist/converters/binary_sensor.converter.d.ts +18 -0
- package/dist/converters/binary_sensor.converter.js +21 -0
- package/dist/converters/binary_sensor.converter.js.map +1 -0
- package/dist/converters/camera.converter.d.ts +18 -0
- package/dist/converters/camera.converter.js +24 -0
- package/dist/converters/camera.converter.js.map +1 -0
- package/dist/converters/climate.converter.d.ts +21 -0
- package/dist/converters/climate.converter.js +55 -0
- package/dist/converters/climate.converter.js.map +1 -0
- package/dist/converters/cover.converter.d.ts +14 -0
- package/dist/converters/cover.converter.js +22 -0
- package/dist/converters/cover.converter.js.map +1 -0
- package/dist/converters/energy_tariff.converter.d.ts +10 -0
- package/dist/converters/energy_tariff.converter.js +12 -0
- package/dist/converters/energy_tariff.converter.js.map +1 -0
- package/dist/converters/fan.converter.d.ts +233 -0
- package/dist/converters/fan.converter.js +353 -0
- package/dist/converters/fan.converter.js.map +1 -0
- package/dist/converters/index.d.ts +14 -0
- package/dist/converters/index.js +15 -0
- package/dist/converters/index.js.map +1 -0
- package/dist/converters/light.converter.d.ts +26 -0
- package/dist/converters/light.converter.js +36 -0
- package/dist/converters/light.converter.js.map +1 -0
- package/dist/converters/lock.converter.d.ts +20 -0
- package/dist/converters/lock.converter.js +29 -0
- package/dist/converters/lock.converter.js.map +1 -0
- package/dist/converters/sensor.converter.d.ts +18 -0
- package/dist/converters/sensor.converter.js +33 -0
- package/dist/converters/sensor.converter.js.map +1 -0
- package/dist/converters/soil_sensor.converter.d.ts +14 -0
- package/dist/converters/soil_sensor.converter.js +21 -0
- package/dist/converters/soil_sensor.converter.js.map +1 -0
- package/dist/converters/vacuum.converter.d.ts +168 -0
- package/dist/converters/vacuum.converter.js +288 -0
- package/dist/converters/vacuum.converter.js.map +1 -0
- package/dist/device-profiles.d.ts +14 -0
- package/dist/device-profiles.js +245 -0
- package/dist/device-profiles.js.map +1 -0
- package/dist/device-registry.d.ts +58 -0
- package/dist/device-registry.js +288 -0
- package/dist/device-registry.js.map +1 -0
- package/dist/entities/base.entity.d.ts +40 -0
- package/dist/entities/base.entity.js +826 -0
- package/dist/entities/base.entity.js.map +1 -0
- package/dist/entities/camera.entity.d.ts +48 -0
- package/dist/entities/camera.entity.js +127 -0
- package/dist/entities/camera.entity.js.map +1 -0
- package/dist/entities/closure.entity.d.ts +9 -0
- package/dist/entities/closure.entity.js +52 -0
- package/dist/entities/closure.entity.js.map +1 -0
- package/dist/entities/composite-device.entity.d.ts +61 -0
- package/dist/entities/composite-device.entity.js +986 -0
- package/dist/entities/composite-device.entity.js.map +1 -0
- package/dist/entities/cooktop.entity.d.ts +20 -0
- package/dist/entities/cooktop.entity.js +59 -0
- package/dist/entities/cooktop.entity.js.map +1 -0
- package/dist/entities/energy_tariff.entity.d.ts +7 -0
- package/dist/entities/energy_tariff.entity.js +32 -0
- package/dist/entities/energy_tariff.entity.js.map +1 -0
- package/dist/entities/humidifier.entity.d.ts +27 -0
- package/dist/entities/humidifier.entity.js +187 -0
- package/dist/entities/humidifier.entity.js.map +1 -0
- package/dist/entities/lock.entity.d.ts +12 -0
- package/dist/entities/lock.entity.js +58 -0
- package/dist/entities/lock.entity.js.map +1 -0
- package/dist/entities/media-player.entity.d.ts +13 -0
- package/dist/entities/media-player.entity.js +52 -0
- package/dist/entities/media-player.entity.js.map +1 -0
- package/dist/entities/oven.entity.d.ts +20 -0
- package/dist/entities/oven.entity.js +112 -0
- package/dist/entities/oven.entity.js.map +1 -0
- package/dist/entities/pet_feeder.entity.d.ts +28 -0
- package/dist/entities/pet_feeder.entity.js +67 -0
- package/dist/entities/pet_feeder.entity.js.map +1 -0
- package/dist/entities/soil_sensor.entity.d.ts +7 -0
- package/dist/entities/soil_sensor.entity.js +40 -0
- package/dist/entities/soil_sensor.entity.js.map +1 -0
- package/dist/entities/vacuum.entity.d.ts +37 -0
- package/dist/entities/vacuum.entity.js +352 -0
- package/dist/entities/vacuum.entity.js.map +1 -0
- package/dist/frontend/assets/index-DPXu3al2.js +26 -0
- package/dist/frontend/assets/index-DalMl4eS.css +1 -0
- package/dist/frontend/assets/logo-B_gEBugV.png +0 -0
- package/dist/frontend/index.html +14 -0
- package/dist/frontend/logo.png +0 -0
- package/dist/homeAssistant.d.ts +1268 -0
- package/dist/homeAssistant.js +1623 -0
- package/dist/homeAssistant.js.map +1 -0
- package/dist/homekit.compat.d.ts +40 -0
- package/dist/homekit.compat.js +43 -0
- package/dist/homekit.compat.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/mqtt/mqtt-client.d.ts +33 -0
- package/dist/mqtt/mqtt-client.js +138 -0
- package/dist/mqtt/mqtt-client.js.map +1 -0
- package/dist/mqtt/mqtt.entity.d.ts +30 -0
- package/dist/mqtt/mqtt.entity.js +286 -0
- package/dist/mqtt/mqtt.entity.js.map +1 -0
- package/dist/platform.d.ts +318 -0
- package/dist/platform.js +6144 -0
- package/dist/platform.js.map +1 -0
- package/dist/proxy.d.ts +1 -0
- package/dist/proxy.js +226 -0
- package/dist/proxy.js.map +1 -0
- package/dist/utils/ha-discovery.d.ts +30 -0
- package/dist/utils/ha-discovery.js +175 -0
- package/dist/utils/ha-discovery.js.map +1 -0
- package/dist/utils/ha-state.d.ts +48 -0
- package/dist/utils/ha-state.js +21 -0
- package/dist/utils/ha-state.js.map +1 -0
- package/dist/utils/light-color.d.ts +63 -0
- package/dist/utils/light-color.js +213 -0
- package/dist/utils/light-color.js.map +1 -0
- package/dist/utils/log-buffer.d.ts +13 -0
- package/dist/utils/log-buffer.js +50 -0
- package/dist/utils/log-buffer.js.map +1 -0
- package/dist/utils/matter-attributes.d.ts +13 -0
- package/dist/utils/matter-attributes.js +35 -0
- package/dist/utils/matter-attributes.js.map +1 -0
- package/dist/utils/matter-device-identity.d.ts +22 -0
- package/dist/utils/matter-device-identity.js +70 -0
- package/dist/utils/matter-device-identity.js.map +1 -0
- package/dist/utils/thread-credentials.d.ts +22 -0
- package/dist/utils/thread-credentials.js +29 -0
- package/dist/utils/thread-credentials.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,1268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the class HomeAssistant.
|
|
3
|
+
* @file src\homeAssistant.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @created 2024-09-14
|
|
6
|
+
* @version 1.2.0
|
|
7
|
+
* @license Apache-2.0
|
|
8
|
+
* @copyright 2024, 2025, 2026 Luca Liguori.
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
import { EventEmitter } from "node:events";
|
|
23
|
+
import { AnsiLogger } from "matterbridge/logger";
|
|
24
|
+
import WebSocket from "ws";
|
|
25
|
+
export type DeviceId = string;
|
|
26
|
+
export type EntityId = string;
|
|
27
|
+
/**
|
|
28
|
+
* Interface representing a Home Assistant device.
|
|
29
|
+
*/
|
|
30
|
+
export interface HassDevice {
|
|
31
|
+
id: DeviceId;
|
|
32
|
+
area_id: string | null;
|
|
33
|
+
configuration_url: string | null;
|
|
34
|
+
config_entries: string[];
|
|
35
|
+
config_entries_subentries: Record<string, unknown[]>;
|
|
36
|
+
connections: [string, string][];
|
|
37
|
+
created_at: number;
|
|
38
|
+
disabled_by: string | null;
|
|
39
|
+
entry_type: string | null;
|
|
40
|
+
hw_version: string | null;
|
|
41
|
+
identifiers: [string, string][];
|
|
42
|
+
labels: string[];
|
|
43
|
+
manufacturer: string | null;
|
|
44
|
+
model: string | null;
|
|
45
|
+
model_id: string | null;
|
|
46
|
+
modified_at: number;
|
|
47
|
+
name: string | null;
|
|
48
|
+
name_by_user: string | null;
|
|
49
|
+
primary_config_entry: string;
|
|
50
|
+
serial_number: string | null;
|
|
51
|
+
sw_version: string | null;
|
|
52
|
+
via_device_id: DeviceId | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Interface representing a Home Assistant entity.
|
|
56
|
+
*/
|
|
57
|
+
export interface HassEntity {
|
|
58
|
+
id: string;
|
|
59
|
+
entity_id: EntityId;
|
|
60
|
+
area_id: string | null;
|
|
61
|
+
categories: object;
|
|
62
|
+
config_entry_id: string | null;
|
|
63
|
+
config_subentry_id: string | null;
|
|
64
|
+
created_at: number;
|
|
65
|
+
device_id: DeviceId | null;
|
|
66
|
+
disabled_by: string | null;
|
|
67
|
+
entity_category: string | null;
|
|
68
|
+
has_entity_name: boolean;
|
|
69
|
+
hidden_by: string | null;
|
|
70
|
+
icon: string | null;
|
|
71
|
+
labels: string[];
|
|
72
|
+
modified_at: number;
|
|
73
|
+
name: string | null;
|
|
74
|
+
options: Record<string, HomeAssistantPrimitive> | null;
|
|
75
|
+
original_name: string | null;
|
|
76
|
+
platform: string;
|
|
77
|
+
translation_key: string | null;
|
|
78
|
+
unique_id: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Interface representing a Home Assistant label.
|
|
82
|
+
*/
|
|
83
|
+
export interface HassLabel {
|
|
84
|
+
label_id: string;
|
|
85
|
+
color: string | null;
|
|
86
|
+
created_at: number;
|
|
87
|
+
description: string | null;
|
|
88
|
+
icon: string | null;
|
|
89
|
+
modified_at: number;
|
|
90
|
+
name: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Interface representing a Home Assistant area.
|
|
94
|
+
*/
|
|
95
|
+
export interface HassArea {
|
|
96
|
+
aliases: string[];
|
|
97
|
+
area_id: string;
|
|
98
|
+
created_at: number;
|
|
99
|
+
floor_id: string | null;
|
|
100
|
+
humidity_entity_id: string | null;
|
|
101
|
+
icon: string | null;
|
|
102
|
+
labels: string[];
|
|
103
|
+
modified_at: number;
|
|
104
|
+
name: string;
|
|
105
|
+
picture: string | null;
|
|
106
|
+
temperature_entity_id: string | null;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Interface representing the context of a Home Assistant event.
|
|
110
|
+
*/
|
|
111
|
+
export interface HassContext {
|
|
112
|
+
id: string;
|
|
113
|
+
parent_id: string | null;
|
|
114
|
+
user_id: string | null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Interface representing the state of a Home Assistant entity.
|
|
118
|
+
*/
|
|
119
|
+
export interface HassState {
|
|
120
|
+
entity_id: EntityId;
|
|
121
|
+
state: string;
|
|
122
|
+
last_changed: string;
|
|
123
|
+
last_reported: string;
|
|
124
|
+
last_updated: string;
|
|
125
|
+
attributes: HassStateAttributes & HassStateSelectAttributes & HassStateMediaPlayerAttributes & HassStateLightAttributes & HassStateClimateAttributes & HassStateFanAttributes & HassStateValveAttributes & HassStateVacuumAttributes & HassStateEventAttributes;
|
|
126
|
+
context: HassContext;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Interface representing the generic attributes of a Home Assistant entity's state.
|
|
130
|
+
*/
|
|
131
|
+
export interface HassStateAttributes {
|
|
132
|
+
friendly_name?: string;
|
|
133
|
+
unit_of_measurement?: string;
|
|
134
|
+
icon?: string;
|
|
135
|
+
entity_picture?: string;
|
|
136
|
+
supported_features?: number;
|
|
137
|
+
hidden?: boolean;
|
|
138
|
+
assumed_state?: boolean;
|
|
139
|
+
device_class?: string;
|
|
140
|
+
state_class?: string;
|
|
141
|
+
restored?: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Interface representing the attributes of a Home Assistant select entity's state.
|
|
145
|
+
*/
|
|
146
|
+
export interface HassStateSelectAttributes {
|
|
147
|
+
options: string[];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Select services for the select domain.
|
|
151
|
+
*
|
|
152
|
+
* Call via {@link HomeAssistant.callService}:
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* await ha.callService('select', SelectService.SELECT_OPTION, 'select.living_room_mode', { option: 'Eco' });
|
|
156
|
+
* @example
|
|
157
|
+
* await ha.callService('select', SelectService.SELECT_NEXT, 'select.living_room_mode', { cycle: false });
|
|
158
|
+
*/
|
|
159
|
+
export declare enum SelectService {
|
|
160
|
+
SELECT_FIRST = "select_first",
|
|
161
|
+
SELECT_LAST = "select_last",
|
|
162
|
+
SELECT_NEXT = "select_next",
|
|
163
|
+
SELECT_OPTION = "select_option",
|
|
164
|
+
SELECT_PREVIOUS = "select_previous"
|
|
165
|
+
}
|
|
166
|
+
/** Select service/attribute keys for the select domain. */
|
|
167
|
+
export declare enum SelectAttribute {
|
|
168
|
+
CYCLE = "cycle",
|
|
169
|
+
OPTIONS = "options",
|
|
170
|
+
OPTION = "option"
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Interface representing the attributes of a Home Assistant media player entity's state.
|
|
174
|
+
*/
|
|
175
|
+
export interface HassStateMediaPlayerAttributes {
|
|
176
|
+
app_id?: string | null;
|
|
177
|
+
app_name?: string | null;
|
|
178
|
+
group_members?: string[] | null;
|
|
179
|
+
source?: string | null;
|
|
180
|
+
source_list?: string[] | null;
|
|
181
|
+
volume_level?: number | null;
|
|
182
|
+
is_volume_muted?: boolean | null;
|
|
183
|
+
media_content_id?: string | null;
|
|
184
|
+
media_content_type?: MediaType | string | null;
|
|
185
|
+
announce?: boolean | null;
|
|
186
|
+
media_duration?: number | null;
|
|
187
|
+
enqueue?: MediaPlayerEnqueue | boolean | null;
|
|
188
|
+
media_position?: number | null;
|
|
189
|
+
media_position_updated_at?: string | null;
|
|
190
|
+
media_image_url?: string | null;
|
|
191
|
+
media_image_remotely_accessible?: boolean | null;
|
|
192
|
+
media_title?: string | null;
|
|
193
|
+
media_artist?: string | null;
|
|
194
|
+
media_album_name?: string | null;
|
|
195
|
+
media_album_artist?: string | null;
|
|
196
|
+
media_track?: number | null;
|
|
197
|
+
media_series_title?: string | null;
|
|
198
|
+
media_season?: string | number | null;
|
|
199
|
+
media_episode?: string | number | null;
|
|
200
|
+
media_channel?: string | null;
|
|
201
|
+
media_playlist?: string | null;
|
|
202
|
+
shuffle?: boolean | null;
|
|
203
|
+
repeat?: RepeatMode | string | null;
|
|
204
|
+
sound_mode?: string | null;
|
|
205
|
+
sound_mode_list?: string[] | null;
|
|
206
|
+
seek_position?: number | null;
|
|
207
|
+
search_query?: string | null;
|
|
208
|
+
entity_picture_local?: string | null;
|
|
209
|
+
media_filter_classes?: string[] | null;
|
|
210
|
+
extra?: Record<string, HomeAssistantPrimitive> | null;
|
|
211
|
+
supported_features?: MediaPlayerEntityFeature;
|
|
212
|
+
}
|
|
213
|
+
/** Media player services for the media_player domain. */
|
|
214
|
+
export declare enum MediaPlayerService {
|
|
215
|
+
BROWSE_MEDIA = "browse_media",
|
|
216
|
+
CLEAR_PLAYLIST = "clear_playlist",
|
|
217
|
+
JOIN = "join",
|
|
218
|
+
MEDIA_NEXT_TRACK = "media_next_track",
|
|
219
|
+
MEDIA_PAUSE = "media_pause",
|
|
220
|
+
MEDIA_PLAY = "media_play",
|
|
221
|
+
MEDIA_PLAY_PAUSE = "media_play_pause",
|
|
222
|
+
MEDIA_PREVIOUS_TRACK = "media_previous_track",
|
|
223
|
+
MEDIA_SEEK = "media_seek",
|
|
224
|
+
MEDIA_STOP = "media_stop",
|
|
225
|
+
PLAY_MEDIA = "play_media",
|
|
226
|
+
REPEAT_SET = "repeat_set",
|
|
227
|
+
SEARCH_MEDIA = "search_media",
|
|
228
|
+
SELECT_SOUND_MODE = "select_sound_mode",
|
|
229
|
+
SELECT_SOURCE = "select_source",
|
|
230
|
+
SHUFFLE_SET = "shuffle_set",
|
|
231
|
+
TOGGLE = "toggle",
|
|
232
|
+
TURN_OFF = "turn_off",
|
|
233
|
+
TURN_ON = "turn_on",
|
|
234
|
+
UNJOIN = "unjoin",
|
|
235
|
+
VOLUME_DOWN = "volume_down",
|
|
236
|
+
VOLUME_MUTE = "volume_mute",
|
|
237
|
+
VOLUME_SET = "volume_set",
|
|
238
|
+
VOLUME_UP = "volume_up"
|
|
239
|
+
}
|
|
240
|
+
/** Media player attribute keys for the media_player domain. */
|
|
241
|
+
export declare enum MediaPlayerAttribute {
|
|
242
|
+
APP_ID = "app_id",
|
|
243
|
+
APP_NAME = "app_name",
|
|
244
|
+
ENTITY_PICTURE_LOCAL = "entity_picture_local",
|
|
245
|
+
GROUP_MEMBERS = "group_members",
|
|
246
|
+
INPUT_SOURCE = "source",
|
|
247
|
+
INPUT_SOURCE_LIST = "source_list",
|
|
248
|
+
MEDIA_ALBUM_ARTIST = "media_album_artist",
|
|
249
|
+
MEDIA_ALBUM_NAME = "media_album_name",
|
|
250
|
+
MEDIA_ANNOUNCE = "announce",
|
|
251
|
+
MEDIA_ARTIST = "media_artist",
|
|
252
|
+
MEDIA_CHANNEL = "media_channel",
|
|
253
|
+
MEDIA_CONTENT_ID = "media_content_id",
|
|
254
|
+
MEDIA_CONTENT_TYPE = "media_content_type",
|
|
255
|
+
MEDIA_DURATION = "media_duration",
|
|
256
|
+
MEDIA_ENQUEUE = "enqueue",
|
|
257
|
+
MEDIA_EPISODE = "media_episode",
|
|
258
|
+
MEDIA_EXTRA = "extra",
|
|
259
|
+
MEDIA_FILTER_CLASSES = "media_filter_classes",
|
|
260
|
+
MEDIA_IMAGE_REMOTELY_ACCESSIBLE = "media_image_remotely_accessible",
|
|
261
|
+
MEDIA_IMAGE_URL = "media_image_url",
|
|
262
|
+
MEDIA_PLAYLIST = "media_playlist",
|
|
263
|
+
MEDIA_POSITION = "media_position",
|
|
264
|
+
MEDIA_POSITION_UPDATED_AT = "media_position_updated_at",
|
|
265
|
+
MEDIA_REPEAT = "repeat",
|
|
266
|
+
MEDIA_SEARCH_QUERY = "search_query",
|
|
267
|
+
MEDIA_SEASON = "media_season",
|
|
268
|
+
MEDIA_SEEK_POSITION = "seek_position",
|
|
269
|
+
MEDIA_SERIES_TITLE = "media_series_title",
|
|
270
|
+
MEDIA_SHUFFLE = "shuffle",
|
|
271
|
+
MEDIA_TITLE = "media_title",
|
|
272
|
+
MEDIA_TRACK = "media_track",
|
|
273
|
+
MEDIA_VOLUME_LEVEL = "volume_level",
|
|
274
|
+
MEDIA_VOLUME_MUTED = "is_volume_muted",
|
|
275
|
+
SOUND_MODE = "sound_mode",
|
|
276
|
+
SOUND_MODE_LIST = "sound_mode_list"
|
|
277
|
+
}
|
|
278
|
+
/** State of media player entities. */
|
|
279
|
+
export declare enum MediaPlayerState {
|
|
280
|
+
OFF = "off",
|
|
281
|
+
ON = "on",
|
|
282
|
+
IDLE = "idle",
|
|
283
|
+
PLAYING = "playing",
|
|
284
|
+
PAUSED = "paused",
|
|
285
|
+
STANDBY = "standby",
|
|
286
|
+
BUFFERING = "buffering"
|
|
287
|
+
}
|
|
288
|
+
/** Media class for media player entities. */
|
|
289
|
+
export declare enum MediaClass {
|
|
290
|
+
ALBUM = "album",
|
|
291
|
+
APP = "app",
|
|
292
|
+
ARTIST = "artist",
|
|
293
|
+
CHANNEL = "channel",
|
|
294
|
+
COMPOSER = "composer",
|
|
295
|
+
CONTRIBUTING_ARTIST = "contributing_artist",
|
|
296
|
+
DIRECTORY = "directory",
|
|
297
|
+
EPISODE = "episode",
|
|
298
|
+
GAME = "game",
|
|
299
|
+
GENRE = "genre",
|
|
300
|
+
IMAGE = "image",
|
|
301
|
+
MOVIE = "movie",
|
|
302
|
+
MUSIC = "music",
|
|
303
|
+
PLAYLIST = "playlist",
|
|
304
|
+
PODCAST = "podcast",
|
|
305
|
+
SEASON = "season",
|
|
306
|
+
TRACK = "track",
|
|
307
|
+
TV_SHOW = "tv_show",
|
|
308
|
+
URL = "url",
|
|
309
|
+
VIDEO = "video"
|
|
310
|
+
}
|
|
311
|
+
/** Media type for media player entities. */
|
|
312
|
+
export declare enum MediaType {
|
|
313
|
+
ALBUM = "album",
|
|
314
|
+
APP = "app",
|
|
315
|
+
APPS = "apps",
|
|
316
|
+
ARTIST = "artist",
|
|
317
|
+
CHANNEL = "channel",
|
|
318
|
+
CHANNELS = "channels",
|
|
319
|
+
COMPOSER = "composer",
|
|
320
|
+
CONTRIBUTING_ARTIST = "contributing_artist",
|
|
321
|
+
EPISODE = "episode",
|
|
322
|
+
GAME = "game",
|
|
323
|
+
GENRE = "genre",
|
|
324
|
+
IMAGE = "image",
|
|
325
|
+
MOVIE = "movie",
|
|
326
|
+
MUSIC = "music",
|
|
327
|
+
PLAYLIST = "playlist",
|
|
328
|
+
PODCAST = "podcast",
|
|
329
|
+
SEASON = "season",
|
|
330
|
+
TRACK = "track",
|
|
331
|
+
TVSHOW = "tvshow",
|
|
332
|
+
URL = "url",
|
|
333
|
+
VIDEO = "video"
|
|
334
|
+
}
|
|
335
|
+
/** Repeat mode for media player entities. */
|
|
336
|
+
export declare enum RepeatMode {
|
|
337
|
+
ALL = "all",
|
|
338
|
+
OFF = "off",
|
|
339
|
+
ONE = "one"
|
|
340
|
+
}
|
|
341
|
+
/** Device class for media players. */
|
|
342
|
+
export declare enum MediaPlayerDeviceClass {
|
|
343
|
+
TV = "tv",
|
|
344
|
+
SPEAKER = "speaker",
|
|
345
|
+
RECEIVER = "receiver"
|
|
346
|
+
}
|
|
347
|
+
/** Enqueue types for playing media. */
|
|
348
|
+
export declare enum MediaPlayerEnqueue {
|
|
349
|
+
ADD = "add",
|
|
350
|
+
NEXT = "next",
|
|
351
|
+
PLAY = "play",
|
|
352
|
+
REPLACE = "replace"
|
|
353
|
+
}
|
|
354
|
+
/** Supported features of the media player entity. */
|
|
355
|
+
export declare enum MediaPlayerEntityFeature {
|
|
356
|
+
PAUSE = 1,
|
|
357
|
+
SEEK = 2,
|
|
358
|
+
VOLUME_SET = 4,
|
|
359
|
+
VOLUME_MUTE = 8,
|
|
360
|
+
PREVIOUS_TRACK = 16,
|
|
361
|
+
NEXT_TRACK = 32,
|
|
362
|
+
TURN_ON = 128,
|
|
363
|
+
TURN_OFF = 256,
|
|
364
|
+
PLAY_MEDIA = 512,
|
|
365
|
+
VOLUME_STEP = 1024,
|
|
366
|
+
SELECT_SOURCE = 2048,
|
|
367
|
+
STOP = 4096,
|
|
368
|
+
CLEAR_PLAYLIST = 8192,
|
|
369
|
+
PLAY = 16384,
|
|
370
|
+
SHUFFLE_SET = 32768,
|
|
371
|
+
SELECT_SOUND_MODE = 65536,
|
|
372
|
+
BROWSE_MEDIA = 131072,
|
|
373
|
+
REPEAT_SET = 262144,
|
|
374
|
+
GROUPING = 524288,
|
|
375
|
+
MEDIA_ANNOUNCE = 1048576,
|
|
376
|
+
MEDIA_ENQUEUE = 2097152,
|
|
377
|
+
SEARCH_MEDIA = 4194304
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Interface representing the attributes of a Home Assistant light entity's state.
|
|
381
|
+
*/
|
|
382
|
+
export interface HassStateLightAttributes {
|
|
383
|
+
effect_list: string[] | null;
|
|
384
|
+
effect: string | null;
|
|
385
|
+
supported_color_modes: ColorMode[] | null;
|
|
386
|
+
color_mode: ColorMode | null;
|
|
387
|
+
brightness: number | null;
|
|
388
|
+
color_temp_kelvin: number | null;
|
|
389
|
+
min_color_temp_kelvin: number | null;
|
|
390
|
+
max_color_temp_kelvin: number | null;
|
|
391
|
+
xy_color: [number, number] | null;
|
|
392
|
+
hs_color: [number, number] | null;
|
|
393
|
+
rgb_color: [number, number, number] | null;
|
|
394
|
+
rgbw_color: [number, number, number, number] | null;
|
|
395
|
+
rgbww_color: [number, number, number, number, number] | null;
|
|
396
|
+
supported_features?: LightEntityFeature;
|
|
397
|
+
}
|
|
398
|
+
/** Supported features of the light entity. */
|
|
399
|
+
export declare enum LightEntityFeature {
|
|
400
|
+
EFFECT = 4,
|
|
401
|
+
FLASH = 8,
|
|
402
|
+
TRANSITION = 32
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Enum representing the possible color modes of a Home Assistant light entity.
|
|
406
|
+
*/
|
|
407
|
+
export declare enum ColorMode {
|
|
408
|
+
UNKNOWN = "unknown",// """Ambiguous color mode"""
|
|
409
|
+
ONOFF = "onoff",// """Must be the only supported mode"""
|
|
410
|
+
BRIGHTNESS = "brightness",// """Must be the only supported mode"""
|
|
411
|
+
COLOR_TEMP = "color_temp",
|
|
412
|
+
HS = "hs",
|
|
413
|
+
XY = "xy",
|
|
414
|
+
RGB = "rgb",
|
|
415
|
+
RGBW = "rgbw",
|
|
416
|
+
RGBWW = "rgbww",
|
|
417
|
+
WHITE = "white"
|
|
418
|
+
}
|
|
419
|
+
export declare const ATTR_COLOR_MODE = "color_mode";
|
|
420
|
+
export declare const ATTR_SUPPORTED_COLOR_MODES = "supported_color_modes";
|
|
421
|
+
export declare const ATTR_TRANSITION = "transition";
|
|
422
|
+
export declare const ATTR_RGB_COLOR = "rgb_color";
|
|
423
|
+
export declare const ATTR_RGBW_COLOR = "rgbw_color";
|
|
424
|
+
export declare const ATTR_RGBWW_COLOR = "rgbww_color";
|
|
425
|
+
export declare const ATTR_XY_COLOR = "xy_color";
|
|
426
|
+
export declare const ATTR_HS_COLOR = "hs_color";
|
|
427
|
+
export declare const ATTR_COLOR_TEMP_KELVIN = "color_temp_kelvin";
|
|
428
|
+
export declare const ATTR_MIN_COLOR_TEMP_KELVIN = "min_color_temp_kelvin";
|
|
429
|
+
export declare const ATTR_MAX_COLOR_TEMP_KELVIN = "max_color_temp_kelvin";
|
|
430
|
+
export declare const ATTR_COLOR_NAME = "color_name";
|
|
431
|
+
export declare const ATTR_WHITE = "white";
|
|
432
|
+
export declare const DEFAULT_MIN_KELVIN = 2000;
|
|
433
|
+
export declare const DEFAULT_MAX_KELVIN = 6535;
|
|
434
|
+
export declare const DIRECTION_FORWARD = "forward";
|
|
435
|
+
export declare const DIRECTION_REVERSE = "reverse";
|
|
436
|
+
/**
|
|
437
|
+
* Interface representing the attributes of a Home Assistant fan entity's state.
|
|
438
|
+
*/
|
|
439
|
+
export interface HassStateFanAttributes {
|
|
440
|
+
preset_modes: ("auto" | "low" | "medium" | "high" | "natural_wind" | "sleep_wind")[] | null;
|
|
441
|
+
preset_mode: "auto" | "low" | "medium" | "high" | "natural_wind" | "sleep_wind" | null;
|
|
442
|
+
percentage: number | null;
|
|
443
|
+
direction: typeof DIRECTION_FORWARD | typeof DIRECTION_REVERSE | null;
|
|
444
|
+
oscillating: boolean | null;
|
|
445
|
+
speed_count: number;
|
|
446
|
+
supported_features?: FanEntityFeature;
|
|
447
|
+
}
|
|
448
|
+
/** Supported features of the fan entity. */
|
|
449
|
+
export declare enum FanEntityFeature {
|
|
450
|
+
SET_SPEED = 1,
|
|
451
|
+
OSCILLATE = 2,
|
|
452
|
+
DIRECTION = 4,
|
|
453
|
+
PRESET_MODE = 8,
|
|
454
|
+
TURN_OFF = 16,
|
|
455
|
+
TURN_ON = 32
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Interface representing the attributes of a Home Assistant valve entity's state.
|
|
459
|
+
*/
|
|
460
|
+
export interface HassStateValveAttributes {
|
|
461
|
+
current_position?: number | null;
|
|
462
|
+
supported_features?: ValveEntityFeature;
|
|
463
|
+
}
|
|
464
|
+
/** Supported features of the valve entity. */
|
|
465
|
+
export declare enum ValveEntityFeature {
|
|
466
|
+
OPEN = 1,
|
|
467
|
+
CLOSE = 2,
|
|
468
|
+
SET_POSITION = 4,
|
|
469
|
+
STOP = 8
|
|
470
|
+
}
|
|
471
|
+
/** Device class for valve. */
|
|
472
|
+
export declare enum ValveDeviceClass {
|
|
473
|
+
WATER = "water",
|
|
474
|
+
GAS = "gas"
|
|
475
|
+
}
|
|
476
|
+
/** State of Valve entities. */
|
|
477
|
+
export declare enum ValveState {
|
|
478
|
+
OPENING = "opening",
|
|
479
|
+
CLOSING = "closing",
|
|
480
|
+
CLOSED = "closed",
|
|
481
|
+
OPEN = "open"
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Interface representing the attributes of a Home Assistant vacuum entity's state.
|
|
485
|
+
*/
|
|
486
|
+
export interface HassStateVacuumAttributes {
|
|
487
|
+
activity: VacuumActivity;
|
|
488
|
+
cleaned_area?: number;
|
|
489
|
+
fan_speed?: string;
|
|
490
|
+
fan_speed_list?: string[];
|
|
491
|
+
battery_level?: number;
|
|
492
|
+
battery_icon?: string;
|
|
493
|
+
supported_features?: VacuumEntityFeature;
|
|
494
|
+
}
|
|
495
|
+
/** Supported features of the vacuum entity. */
|
|
496
|
+
export declare enum VacuumEntityFeature {
|
|
497
|
+
TURN_ON = 1,// Deprecated, not supported by StateVacuumEntity
|
|
498
|
+
TURN_OFF = 2,// Deprecated, not supported by StateVacuumEntity
|
|
499
|
+
PAUSE = 4,
|
|
500
|
+
STOP = 8,
|
|
501
|
+
RETURN_HOME = 16,
|
|
502
|
+
FAN_SPEED = 32,
|
|
503
|
+
BATTERY = 64,
|
|
504
|
+
STATUS = 128,// Deprecated, not supported by StateVacuumEntity
|
|
505
|
+
SEND_COMMAND = 256,
|
|
506
|
+
LOCATE = 512,
|
|
507
|
+
CLEAN_SPOT = 1024,
|
|
508
|
+
MAP = 2048,
|
|
509
|
+
STATE = 4096,// Must be set by vacuum platforms derived from StateVacuumEntity
|
|
510
|
+
START = 8192
|
|
511
|
+
}
|
|
512
|
+
/** Vacuum activity states. */
|
|
513
|
+
export declare enum VacuumActivity {
|
|
514
|
+
CLEANING = "cleaning",
|
|
515
|
+
DOCKED = "docked",
|
|
516
|
+
IDLE = "idle",
|
|
517
|
+
PAUSED = "paused",
|
|
518
|
+
RETURNING = "returning",
|
|
519
|
+
ERROR = "error"
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Interface representing the attributes of a Home Assistant climate entity's state.
|
|
523
|
+
*/
|
|
524
|
+
export interface HassStateClimateAttributes {
|
|
525
|
+
hvac_modes: HVACMode[];
|
|
526
|
+
hvac_mode: HVACMode | null;
|
|
527
|
+
hvac_action?: HVACAction | null;
|
|
528
|
+
preset_modes?: ("none" | "eco" | "away" | "boost" | "comfort" | "home" | "sleep" | "activity")[];
|
|
529
|
+
preset_mode?: "none" | "eco" | "away" | "boost" | "comfort" | "home" | "sleep" | "activity" | null;
|
|
530
|
+
fan_modes?: ("on" | "off" | "auto" | "low" | "medium" | "high" | "top" | "middle" | "focus" | "diffuse")[];
|
|
531
|
+
fan_mode?: "on" | "off" | "auto" | "low" | "medium" | "high" | "top" | "middle" | "focus" | "diffuse" | null;
|
|
532
|
+
current_humidity: number | null;
|
|
533
|
+
current_temperature: number | null;
|
|
534
|
+
temperature?: number | null;
|
|
535
|
+
target_temp_high?: number | null;
|
|
536
|
+
target_temp_low?: number | null;
|
|
537
|
+
min_temp: number;
|
|
538
|
+
max_temp: number;
|
|
539
|
+
min_humidity: number;
|
|
540
|
+
max_humidity: number;
|
|
541
|
+
temperature_unit: UnitOfTemperature.CELSIUS | UnitOfTemperature.FAHRENHEIT;
|
|
542
|
+
supported_features?: ClimateEntityFeature;
|
|
543
|
+
}
|
|
544
|
+
/** Supported features of the climate entity.*/
|
|
545
|
+
export declare enum ClimateEntityFeature {
|
|
546
|
+
TARGET_TEMPERATURE = 1,
|
|
547
|
+
TARGET_TEMPERATURE_RANGE = 2,
|
|
548
|
+
TARGET_HUMIDITY = 4,
|
|
549
|
+
FAN_MODE = 8,
|
|
550
|
+
PRESET_MODE = 16,
|
|
551
|
+
SWING_MODE = 32,
|
|
552
|
+
TURN_OFF = 128,
|
|
553
|
+
TURN_ON = 256,
|
|
554
|
+
SWING_HORIZONTAL_MODE = 512
|
|
555
|
+
}
|
|
556
|
+
/** HVAC mode for climate devices. */
|
|
557
|
+
export declare enum HVACMode {
|
|
558
|
+
/** All activity disabled / Device is off/standby */
|
|
559
|
+
OFF = "off",
|
|
560
|
+
/** Heating */
|
|
561
|
+
HEAT = "heat",
|
|
562
|
+
/** Cooling */
|
|
563
|
+
COOL = "cool",
|
|
564
|
+
/** The device supports heating/cooling to a range */
|
|
565
|
+
HEAT_COOL = "heat_cool",
|
|
566
|
+
/** The temperature is set based on a schedule, learned behavior, AI or some other related mechanism. User is not able to adjust the temperature */
|
|
567
|
+
AUTO = "auto",
|
|
568
|
+
/** Device is in Dry/Humidity mode */
|
|
569
|
+
DRY = "dry",
|
|
570
|
+
/** Only the fan is on, not fan and another mode like cool */
|
|
571
|
+
FAN_ONLY = "fan_only"
|
|
572
|
+
}
|
|
573
|
+
/** HVAC action for climate devices */
|
|
574
|
+
export declare enum HVACAction {
|
|
575
|
+
COOLING = "cooling",
|
|
576
|
+
DEFROSTING = "defrosting",
|
|
577
|
+
DRYING = "drying",
|
|
578
|
+
FAN = "fan",
|
|
579
|
+
HEATING = "heating",
|
|
580
|
+
IDLE = "idle",
|
|
581
|
+
OFF = "off",
|
|
582
|
+
PREHEATING = "preheating"
|
|
583
|
+
}
|
|
584
|
+
export declare const CLIMATE_FAN_ON = "on";
|
|
585
|
+
export declare const CLIMATE_FAN_OFF = "off";
|
|
586
|
+
export declare const CLIMATE_FAN_AUTO = "auto";
|
|
587
|
+
export declare const CLIMATE_FAN_LOW = "low";
|
|
588
|
+
export declare const CLIMATE_FAN_MEDIUM = "medium";
|
|
589
|
+
export declare const CLIMATE_FAN_HIGH = "high";
|
|
590
|
+
export declare const CLIMATE_FAN_TOP = "top";
|
|
591
|
+
export declare const CLIMATE_FAN_MIDDLE = "middle";
|
|
592
|
+
export declare const CLIMATE_FAN_FOCUS = "focus";
|
|
593
|
+
export declare const CLIMATE_FAN_DIFFUSE = "diffuse";
|
|
594
|
+
export declare const CLIMATE_SWING_ON = "on";
|
|
595
|
+
export declare const CLIMATE_SWING_OFF = "off";
|
|
596
|
+
export declare const CLIMATE_SWING_BOTH = "both";
|
|
597
|
+
export declare const CLIMATE_SWING_VERTICAL = "vertical";
|
|
598
|
+
export declare const CLIMATE_SWING_HORIZONTAL = "horizontal";
|
|
599
|
+
export declare const CLIMATE_SWING_HORIZONTAL_ON = "on";
|
|
600
|
+
export declare const CLIMATE_SWING_HORIZONTAL_OFF = "off";
|
|
601
|
+
export declare const DEFAULT_MIN_TEMP = 7;
|
|
602
|
+
export declare const DEFAULT_MAX_TEMP = 35;
|
|
603
|
+
export declare const DEFAULT_MIN_HUMIDITY = 30;
|
|
604
|
+
export declare const DEFAULT_MAX_HUMIDITY = 99;
|
|
605
|
+
/**
|
|
606
|
+
* Interface representing the attributes of a Home Assistant event entity's state.
|
|
607
|
+
*/
|
|
608
|
+
export interface HassStateEventAttributes {
|
|
609
|
+
event_types: string[];
|
|
610
|
+
event_type: string | null;
|
|
611
|
+
newPosition?: number;
|
|
612
|
+
previousPosition?: number;
|
|
613
|
+
totalNumberOfPressesCounted?: number;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Enum representing the device classes for Home Assistant events.
|
|
617
|
+
*/
|
|
618
|
+
export declare enum EventDeviceClass {
|
|
619
|
+
DOORBELL = "doorbell",
|
|
620
|
+
BUTTON = "button",
|
|
621
|
+
MOTION = "motion"
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Interface representing a Home Assistant event.
|
|
625
|
+
*/
|
|
626
|
+
export interface HassEvent {
|
|
627
|
+
data: {
|
|
628
|
+
entity_id: string;
|
|
629
|
+
new_state: HassState | null;
|
|
630
|
+
old_state: HassState | null;
|
|
631
|
+
};
|
|
632
|
+
event_type: string;
|
|
633
|
+
time_fired: string;
|
|
634
|
+
origin: string;
|
|
635
|
+
context: HassContext;
|
|
636
|
+
}
|
|
637
|
+
/** #### UNITS OF MEASUREMENT #### */
|
|
638
|
+
/** Apparent power units */
|
|
639
|
+
export declare enum UnitOfApparentPower {
|
|
640
|
+
/** Millivolt-ampere */
|
|
641
|
+
MILLIVOLT_AMPERE = "mVA",
|
|
642
|
+
/** Volt-ampere */
|
|
643
|
+
VOLT_AMPERE = "VA",
|
|
644
|
+
/** Kilovolt-ampere */
|
|
645
|
+
KILO_VOLT_AMPERE = "kVA"
|
|
646
|
+
}
|
|
647
|
+
/** Power units */
|
|
648
|
+
export declare enum UnitOfPower {
|
|
649
|
+
/** Milliwatt */
|
|
650
|
+
MILLIWATT = "mW",
|
|
651
|
+
/** Watt */
|
|
652
|
+
WATT = "W",
|
|
653
|
+
/** Kilowatt */
|
|
654
|
+
KILO_WATT = "kW",
|
|
655
|
+
/** Megawatt */
|
|
656
|
+
MEGA_WATT = "MW",
|
|
657
|
+
/** Gigawatt */
|
|
658
|
+
GIGA_WATT = "GW",
|
|
659
|
+
/** Terawatt */
|
|
660
|
+
TERA_WATT = "TW",
|
|
661
|
+
/** British thermal units per hour */
|
|
662
|
+
BTU_PER_HOUR = "BTU/h"
|
|
663
|
+
}
|
|
664
|
+
/** Reactive power units */
|
|
665
|
+
export declare enum UnitOfReactivePower {
|
|
666
|
+
/** Millivolt-ampere reactive */
|
|
667
|
+
MILLIVOLT_AMPERE_REACTIVE = "mvar",
|
|
668
|
+
/** Volt-ampere reactive */
|
|
669
|
+
VOLT_AMPERE_REACTIVE = "var",
|
|
670
|
+
/** Kilovolt-ampere reactive */
|
|
671
|
+
KILO_VOLT_AMPERE_REACTIVE = "kvar"
|
|
672
|
+
}
|
|
673
|
+
/** Energy units */
|
|
674
|
+
export declare enum UnitOfEnergy {
|
|
675
|
+
/** Joule */
|
|
676
|
+
JOULE = "J",
|
|
677
|
+
/** Kilojoule */
|
|
678
|
+
KILO_JOULE = "kJ",
|
|
679
|
+
/** Megajoule */
|
|
680
|
+
MEGA_JOULE = "MJ",
|
|
681
|
+
/** Gigajoule */
|
|
682
|
+
GIGA_JOULE = "GJ",
|
|
683
|
+
/** Milliwatt hour */
|
|
684
|
+
MILLIWATT_HOUR = "mWh",
|
|
685
|
+
/** Watt hour */
|
|
686
|
+
WATT_HOUR = "Wh",
|
|
687
|
+
/** Kilowatt hour */
|
|
688
|
+
KILO_WATT_HOUR = "kWh",
|
|
689
|
+
/** Megawatt hour */
|
|
690
|
+
MEGA_WATT_HOUR = "MWh",
|
|
691
|
+
/** Gigawatt hour */
|
|
692
|
+
GIGA_WATT_HOUR = "GWh",
|
|
693
|
+
/** Terawatt hour */
|
|
694
|
+
TERA_WATT_HOUR = "TWh",
|
|
695
|
+
/** Calorie */
|
|
696
|
+
CALORIE = "cal",
|
|
697
|
+
/** Kilocalorie */
|
|
698
|
+
KILO_CALORIE = "kcal",
|
|
699
|
+
/** Megacalorie */
|
|
700
|
+
MEGA_CALORIE = "Mcal",
|
|
701
|
+
/** Gigacalorie */
|
|
702
|
+
GIGA_CALORIE = "Gcal"
|
|
703
|
+
}
|
|
704
|
+
/** Reactive energy units */
|
|
705
|
+
export declare enum UnitOfReactiveEnergy {
|
|
706
|
+
/** Volt-ampere reactive hour */
|
|
707
|
+
VOLT_AMPERE_REACTIVE_HOUR = "varh",
|
|
708
|
+
/** Kilovolt-ampere reactive hour */
|
|
709
|
+
KILO_VOLT_AMPERE_REACTIVE_HOUR = "kvarh"
|
|
710
|
+
}
|
|
711
|
+
/** Energy Distance units */
|
|
712
|
+
export declare enum UnitOfEnergyDistance {
|
|
713
|
+
/** Kilowatt hour per 100 kilometers */
|
|
714
|
+
KILO_WATT_HOUR_PER_100_KM = "kWh/100km",
|
|
715
|
+
/** Watt hour per kilometer */
|
|
716
|
+
WATT_HOUR_PER_KM = "Wh/km",
|
|
717
|
+
/** Miles per kilowatt hour */
|
|
718
|
+
MILES_PER_KILO_WATT_HOUR = "mi/kWh",
|
|
719
|
+
/** Kilometers per kilowatt hour */
|
|
720
|
+
KM_PER_KILO_WATT_HOUR = "km/kWh"
|
|
721
|
+
}
|
|
722
|
+
/** Electric current units */
|
|
723
|
+
export declare enum UnitOfElectricCurrent {
|
|
724
|
+
/** Milliampere */
|
|
725
|
+
MILLIAMPERE = "mA",
|
|
726
|
+
/** Ampere */
|
|
727
|
+
AMPERE = "A"
|
|
728
|
+
}
|
|
729
|
+
/** Electric potential units */
|
|
730
|
+
export declare enum UnitOfElectricPotential {
|
|
731
|
+
/** Microvolt */
|
|
732
|
+
MICROVOLT = "\u03BCV",
|
|
733
|
+
/** Millivolt */
|
|
734
|
+
MILLIVOLT = "mV",
|
|
735
|
+
/** Volt */
|
|
736
|
+
VOLT = "V",
|
|
737
|
+
/** Kilovolt */
|
|
738
|
+
KILOVOLT = "kV",
|
|
739
|
+
/** Megavolt */
|
|
740
|
+
MEGAVOLT = "MV"
|
|
741
|
+
}
|
|
742
|
+
/** Degree units */
|
|
743
|
+
export declare const DEGREE = "\u00B0";
|
|
744
|
+
/** Currency units */
|
|
745
|
+
export declare enum Currency {
|
|
746
|
+
EURO = "\u20AC",
|
|
747
|
+
DOLLAR = "$",
|
|
748
|
+
CENT = "\u00A2"
|
|
749
|
+
}
|
|
750
|
+
/** Temperature units. */
|
|
751
|
+
export declare enum UnitOfTemperature {
|
|
752
|
+
CELSIUS = "\u00B0C",
|
|
753
|
+
FAHRENHEIT = "\u00B0F",
|
|
754
|
+
KELVIN = "K"
|
|
755
|
+
}
|
|
756
|
+
/** Time units */
|
|
757
|
+
export declare enum UnitOfTime {
|
|
758
|
+
MICROSECONDS = "\u03BCs",
|
|
759
|
+
MILLISECONDS = "ms",
|
|
760
|
+
SECONDS = "s",
|
|
761
|
+
MINUTES = "min",
|
|
762
|
+
HOURS = "h",
|
|
763
|
+
DAYS = "d",
|
|
764
|
+
WEEKS = "w",
|
|
765
|
+
MONTHS = "m",
|
|
766
|
+
YEARS = "y"
|
|
767
|
+
}
|
|
768
|
+
/** Length units */
|
|
769
|
+
export declare enum UnitOfLength {
|
|
770
|
+
MILLIMETERS = "mm",
|
|
771
|
+
CENTIMETERS = "cm",
|
|
772
|
+
METERS = "m",
|
|
773
|
+
KILOMETERS = "km",
|
|
774
|
+
INCHES = "in",
|
|
775
|
+
FEET = "ft",
|
|
776
|
+
YARDS = "yd",
|
|
777
|
+
MILES = "mi",
|
|
778
|
+
NAUTICAL_MILES = "nmi"
|
|
779
|
+
}
|
|
780
|
+
/** Frequency units */
|
|
781
|
+
export declare enum UnitOfFrequency {
|
|
782
|
+
HERTZ = "Hz",
|
|
783
|
+
KILOHERTZ = "kHz",
|
|
784
|
+
MEGAHERTZ = "MHz",
|
|
785
|
+
GIGAHERTZ = "GHz"
|
|
786
|
+
}
|
|
787
|
+
/** Pressure units */
|
|
788
|
+
export declare enum UnitOfPressure {
|
|
789
|
+
MILLIPASCAL = "mPa",
|
|
790
|
+
PA = "Pa",
|
|
791
|
+
HPA = "hPa",
|
|
792
|
+
KPA = "kPa",
|
|
793
|
+
BAR = "bar",
|
|
794
|
+
CBAR = "cbar",
|
|
795
|
+
MBAR = "mbar",
|
|
796
|
+
MMHG = "mmHg",
|
|
797
|
+
INHG = "inHg",
|
|
798
|
+
INH2O = "inH\u2082O",
|
|
799
|
+
PSI = "psi"
|
|
800
|
+
}
|
|
801
|
+
/** Sound pressure units */
|
|
802
|
+
export declare enum UnitOfSoundPressure {
|
|
803
|
+
DECIBEL = "dB",
|
|
804
|
+
WEIGHTED_DECIBEL_A = "dBA"
|
|
805
|
+
}
|
|
806
|
+
/** Volume units */
|
|
807
|
+
export declare enum UnitOfVolume {
|
|
808
|
+
CUBIC_FEET = "ft\u00B3",
|
|
809
|
+
CENTUM_CUBIC_FEET = "CCF",
|
|
810
|
+
MILLE_CUBIC_FEET = "MCF",
|
|
811
|
+
CUBIC_METERS = "m\u00B3",
|
|
812
|
+
LITERS = "L",
|
|
813
|
+
MILLILITERS = "mL",
|
|
814
|
+
GALLONS = "gal",
|
|
815
|
+
FLUID_OUNCES = "fl. oz."
|
|
816
|
+
}
|
|
817
|
+
/** Volume Flow Rate units */
|
|
818
|
+
export declare enum UnitOfVolumeFlowRate {
|
|
819
|
+
CUBIC_METERS_PER_HOUR = "m\u00B3/h",
|
|
820
|
+
CUBIC_METERS_PER_MINUTE = "m\u00B3/min",
|
|
821
|
+
CUBIC_METERS_PER_SECOND = "m\u00B3/s",
|
|
822
|
+
CUBIC_FEET_PER_MINUTE = "ft\u00B3/min",
|
|
823
|
+
LITERS_PER_HOUR = "L/h",
|
|
824
|
+
LITERS_PER_MINUTE = "L/min",
|
|
825
|
+
LITERS_PER_SECOND = "L/s",
|
|
826
|
+
GALLONS_PER_HOUR = "gal/h",
|
|
827
|
+
GALLONS_PER_MINUTE = "gal/min",
|
|
828
|
+
GALLONS_PER_DAY = "gal/d",
|
|
829
|
+
MILLILITERS_PER_SECOND = "mL/s"
|
|
830
|
+
}
|
|
831
|
+
export declare enum UnitOfArea {
|
|
832
|
+
/** Square meters */
|
|
833
|
+
SQUARE_METERS = "m\u00B2",
|
|
834
|
+
/** Square centimeters */
|
|
835
|
+
SQUARE_CENTIMETERS = "cm\u00B2",
|
|
836
|
+
/** Square kilometers */
|
|
837
|
+
SQUARE_KILOMETERS = "km\u00B2",
|
|
838
|
+
/** Square millimeters */
|
|
839
|
+
SQUARE_MILLIMETERS = "mm\u00B2",
|
|
840
|
+
SQUARE_INCHES = "in\u00B2",
|
|
841
|
+
SQUARE_FEET = "ft\u00B2",
|
|
842
|
+
SQUARE_YARDS = "yd\u00B2",
|
|
843
|
+
SQUARE_MILES = "mi\u00B2",
|
|
844
|
+
ACRES = "ac",
|
|
845
|
+
HECTARES = "ha"
|
|
846
|
+
}
|
|
847
|
+
/** Mass units */
|
|
848
|
+
export declare enum UnitOfMass {
|
|
849
|
+
/** Grams */
|
|
850
|
+
GRAMS = "g",
|
|
851
|
+
KILOGRAMS = "kg",
|
|
852
|
+
MILLIGRAMS = "mg",
|
|
853
|
+
MICROGRAMS = "\u03BCg",
|
|
854
|
+
OUNCES = "oz",
|
|
855
|
+
POUNDS = "lb",
|
|
856
|
+
STONES = "st"
|
|
857
|
+
}
|
|
858
|
+
export declare enum UnitOfConductivity {
|
|
859
|
+
/** Siemens per centimeter */
|
|
860
|
+
SIEMENS_PER_CM = "S/cm",
|
|
861
|
+
/** Microsiemens per centimeter */
|
|
862
|
+
MICROSIEMENS_PER_CM = "\u03BCS/cm",
|
|
863
|
+
/** Millisiemens per centimeter */
|
|
864
|
+
MILLISIEMENS_PER_CM = "mS/cm"
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Interface representing the unit system used in Home Assistant.
|
|
868
|
+
*/
|
|
869
|
+
export interface HassUnitSystem {
|
|
870
|
+
/** 'km' or 'mi' */
|
|
871
|
+
length: string;
|
|
872
|
+
/** 'mm' or 'in' */
|
|
873
|
+
accumulated_precipitation: string;
|
|
874
|
+
/** 'g' or 'lb' */
|
|
875
|
+
mass: string;
|
|
876
|
+
/** 'Pa' or 'inHg' */
|
|
877
|
+
pressure: string;
|
|
878
|
+
/** '°C' or '°F' */
|
|
879
|
+
temperature: UnitOfTemperature.CELSIUS | UnitOfTemperature.FAHRENHEIT;
|
|
880
|
+
/** 'L' or 'gal' */
|
|
881
|
+
volume: string;
|
|
882
|
+
/** 'm/s' or 'mph' */
|
|
883
|
+
wind_speed: string;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Interface representing the configuration of Home Assistant.
|
|
887
|
+
*/
|
|
888
|
+
export interface HassConfig {
|
|
889
|
+
latitude: number;
|
|
890
|
+
longitude: number;
|
|
891
|
+
elevation: number;
|
|
892
|
+
unit_system: HassUnitSystem;
|
|
893
|
+
location_name: string;
|
|
894
|
+
time_zone: string;
|
|
895
|
+
components: string[];
|
|
896
|
+
config_dir: string;
|
|
897
|
+
whitelist_external_dirs: string[];
|
|
898
|
+
allowlist_external_dirs: string[];
|
|
899
|
+
allowlist_external_urls: string[];
|
|
900
|
+
version: string;
|
|
901
|
+
config_source: string;
|
|
902
|
+
recovery_mode: boolean;
|
|
903
|
+
state: string;
|
|
904
|
+
external_url: string | null;
|
|
905
|
+
internal_url: string | null;
|
|
906
|
+
currency: string;
|
|
907
|
+
country: string;
|
|
908
|
+
language: string;
|
|
909
|
+
safe_mode: boolean;
|
|
910
|
+
debug: boolean;
|
|
911
|
+
radius: number;
|
|
912
|
+
}
|
|
913
|
+
export interface HassService {
|
|
914
|
+
[key: string]: object;
|
|
915
|
+
}
|
|
916
|
+
export interface HassServices {
|
|
917
|
+
[key: string]: HassService;
|
|
918
|
+
}
|
|
919
|
+
export type HassWebSocketResponse = HassWebSocketResponseAuthRequired | HassWebSocketResponseAuthOk | HassWebSocketResponseAuthInvalid | HassWebSocketResponsePong | HassWebSocketResponseEvent | HassWebSocketResponseResult;
|
|
920
|
+
export interface HassWebSocketResponseAuthRequired {
|
|
921
|
+
type: "auth_required";
|
|
922
|
+
ha_version: string;
|
|
923
|
+
}
|
|
924
|
+
export interface HassWebSocketResponseAuthOk {
|
|
925
|
+
type: "auth_ok";
|
|
926
|
+
ha_version: string;
|
|
927
|
+
}
|
|
928
|
+
export interface HassWebSocketResponseAuthInvalid {
|
|
929
|
+
type: "auth_invalid";
|
|
930
|
+
message: string;
|
|
931
|
+
}
|
|
932
|
+
export interface HassWebSocketResponsePong {
|
|
933
|
+
type: "pong";
|
|
934
|
+
id: number;
|
|
935
|
+
}
|
|
936
|
+
export interface HassWebSocketResponseEvent {
|
|
937
|
+
id: number;
|
|
938
|
+
type: "event";
|
|
939
|
+
event: HassEvent;
|
|
940
|
+
}
|
|
941
|
+
export interface HassWebSocketResponseResult {
|
|
942
|
+
id: number;
|
|
943
|
+
type: "result";
|
|
944
|
+
success: boolean;
|
|
945
|
+
result: null;
|
|
946
|
+
error?: {
|
|
947
|
+
code: string;
|
|
948
|
+
message: string;
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
export interface HassWebSocketResponseSuccess {
|
|
952
|
+
id: number;
|
|
953
|
+
type: "result";
|
|
954
|
+
success: true;
|
|
955
|
+
result: unknown;
|
|
956
|
+
}
|
|
957
|
+
export interface HassWebSocketResponseError {
|
|
958
|
+
id: number;
|
|
959
|
+
type: "result";
|
|
960
|
+
success: false;
|
|
961
|
+
error: {
|
|
962
|
+
code: string;
|
|
963
|
+
message: string;
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
export interface HassWebSocketResponseFetch {
|
|
967
|
+
id: number;
|
|
968
|
+
type: "result";
|
|
969
|
+
success: boolean;
|
|
970
|
+
result: HassConfig | HassServices | HassDevice[] | HassEntity[] | HassState[] | HassArea[] | HassLabel[] | null;
|
|
971
|
+
error?: {
|
|
972
|
+
code: string;
|
|
973
|
+
message: string;
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
export interface HassWebSocketResponseCallService {
|
|
977
|
+
id: number;
|
|
978
|
+
type: "result";
|
|
979
|
+
success: boolean;
|
|
980
|
+
result: {
|
|
981
|
+
context: HassContext;
|
|
982
|
+
response: unknown;
|
|
983
|
+
};
|
|
984
|
+
error?: {
|
|
985
|
+
code: string;
|
|
986
|
+
message: string;
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
export interface HassWebSocketRequestAuth {
|
|
990
|
+
type: "auth";
|
|
991
|
+
access_token: string;
|
|
992
|
+
}
|
|
993
|
+
export interface HassWebSocketRequestPing {
|
|
994
|
+
type: "ping";
|
|
995
|
+
id: number;
|
|
996
|
+
}
|
|
997
|
+
export interface HassWebSocketRequestFetch {
|
|
998
|
+
id: number;
|
|
999
|
+
type: string;
|
|
1000
|
+
}
|
|
1001
|
+
export interface HassWebSocketRequestCallService {
|
|
1002
|
+
id: number;
|
|
1003
|
+
type: "call_service";
|
|
1004
|
+
domain: string;
|
|
1005
|
+
service: string;
|
|
1006
|
+
service_data?: {
|
|
1007
|
+
entity_id: string;
|
|
1008
|
+
} & Record<string, HomeAssistantPrimitive>;
|
|
1009
|
+
target?: {
|
|
1010
|
+
entity_id: string;
|
|
1011
|
+
};
|
|
1012
|
+
return_response?: boolean;
|
|
1013
|
+
}
|
|
1014
|
+
export interface HassWebSocketRequestSubscribeEvents {
|
|
1015
|
+
id: number;
|
|
1016
|
+
type: "subscribe_events";
|
|
1017
|
+
event_type?: string;
|
|
1018
|
+
}
|
|
1019
|
+
export interface HassWebSocketRequestUnsubscribeEvents {
|
|
1020
|
+
id: number;
|
|
1021
|
+
type: "unsubscribe_events";
|
|
1022
|
+
subscription: number;
|
|
1023
|
+
}
|
|
1024
|
+
export type HomeAssistantPrimitive = string | number | bigint | boolean | object | null | undefined;
|
|
1025
|
+
interface HomeAssistantEventEmitter {
|
|
1026
|
+
connected: [ha_version: string];
|
|
1027
|
+
disconnected: [error: string];
|
|
1028
|
+
socket_closed: [code: number, reason: Buffer];
|
|
1029
|
+
socket_opened: [];
|
|
1030
|
+
config: [config: HassConfig];
|
|
1031
|
+
services: [services: HassServices];
|
|
1032
|
+
states: [states: HassState[]];
|
|
1033
|
+
error: [error: string];
|
|
1034
|
+
devices: [devices: HassDevice[]];
|
|
1035
|
+
entities: [entities: HassEntity[]];
|
|
1036
|
+
areas: [areas: HassArea[]];
|
|
1037
|
+
labels: [labels: HassLabel[]];
|
|
1038
|
+
registry_changed: [];
|
|
1039
|
+
subscribed: [];
|
|
1040
|
+
event: [
|
|
1041
|
+
deviceId: string | null,
|
|
1042
|
+
entityId: string,
|
|
1043
|
+
old_state: HassState | null,
|
|
1044
|
+
new_state: HassState
|
|
1045
|
+
];
|
|
1046
|
+
call_service: [];
|
|
1047
|
+
ping: [data: Buffer];
|
|
1048
|
+
pong: [data: Buffer];
|
|
1049
|
+
}
|
|
1050
|
+
export declare class HomeAssistant extends EventEmitter {
|
|
1051
|
+
connected: boolean;
|
|
1052
|
+
ws: WebSocket | null;
|
|
1053
|
+
wsUrl: string;
|
|
1054
|
+
wsAccessToken: string;
|
|
1055
|
+
private readonly initialAccessToken;
|
|
1056
|
+
log: AnsiLogger;
|
|
1057
|
+
/** Map of Home Assistant devices keyed by their device.id */
|
|
1058
|
+
hassDevices: Map<string, HassDevice>;
|
|
1059
|
+
/** Map of Home Assistant entities keyed by their entity.entity_id */
|
|
1060
|
+
hassEntities: Map<string, HassEntity>;
|
|
1061
|
+
/** Map of Home Assistant states keyed by their entity.entity_id */
|
|
1062
|
+
hassStates: Map<string, HassState>;
|
|
1063
|
+
/** Map of Home Assistant areas keyed by their area.area_id */
|
|
1064
|
+
hassAreas: Map<string, HassArea>;
|
|
1065
|
+
/** Map of Home Assistant labels keyed by their label.label_id */
|
|
1066
|
+
hassLabels: Map<string, HassLabel>;
|
|
1067
|
+
hassServices: HassServices | null;
|
|
1068
|
+
hassConfig: HassConfig | null;
|
|
1069
|
+
static hassConfig: HassConfig | null;
|
|
1070
|
+
private readonly debug;
|
|
1071
|
+
private readonly verbose;
|
|
1072
|
+
private pingInterval;
|
|
1073
|
+
private pingTimeout;
|
|
1074
|
+
private reconnectTimeout;
|
|
1075
|
+
private connectionTimeout;
|
|
1076
|
+
private readonly pingIntervalTime;
|
|
1077
|
+
private readonly pingTimeoutTime;
|
|
1078
|
+
private readonly reconnectTimeoutTime;
|
|
1079
|
+
private readonly reconnectRetries;
|
|
1080
|
+
private readonly connectionTimeoutTime;
|
|
1081
|
+
private _responseTimeout;
|
|
1082
|
+
private _serviceTimeout;
|
|
1083
|
+
private readonly deviceCommandQueues;
|
|
1084
|
+
private readonly certificatePath;
|
|
1085
|
+
private readonly rejectUnauthorized;
|
|
1086
|
+
private reconnectRetry;
|
|
1087
|
+
/** Lets delayed callbacks detect that their WebSocket was superseded. */
|
|
1088
|
+
private connectionGeneration;
|
|
1089
|
+
private requestId;
|
|
1090
|
+
private closing;
|
|
1091
|
+
/** One dispatcher prevents one WebSocket listener per HA request. */
|
|
1092
|
+
private readonly pendingRequests;
|
|
1093
|
+
private readonly subscriptions;
|
|
1094
|
+
private fetchTimeout;
|
|
1095
|
+
private fetchQueue;
|
|
1096
|
+
/**
|
|
1097
|
+
* Emits an event of the specified type with the provided arguments.
|
|
1098
|
+
*
|
|
1099
|
+
* @template K - The type of the event to emit.
|
|
1100
|
+
* @param {K} eventName - The name of the event to emit.
|
|
1101
|
+
* @param {...HomeAssistantEventEmitter[K]} args - The arguments to pass to the event listeners.
|
|
1102
|
+
* @returns {boolean} - Returns true if the event had listeners, false otherwise.
|
|
1103
|
+
*/
|
|
1104
|
+
emit<K extends keyof HomeAssistantEventEmitter>(eventName: K, ...args: HomeAssistantEventEmitter[K]): boolean;
|
|
1105
|
+
/**
|
|
1106
|
+
* Registers a listener for the specified event type.
|
|
1107
|
+
*
|
|
1108
|
+
* @template K - The type of the event to listen for.
|
|
1109
|
+
* @param {K} eventName - The name of the event to listen for.
|
|
1110
|
+
* @param {(...args: HomeAssistantEventEmitter[K]) => void} listener - The callback function to invoke when the event is emitted.
|
|
1111
|
+
* @returns {this} - Returns the instance of the HomeAssistant class for chaining.
|
|
1112
|
+
*/
|
|
1113
|
+
on<K extends keyof HomeAssistantEventEmitter>(eventName: K, listener: (...args: HomeAssistantEventEmitter[K]) => void): this;
|
|
1114
|
+
get responseTimeout(): number;
|
|
1115
|
+
set responseTimeout(value: number);
|
|
1116
|
+
get serviceTimeout(): number;
|
|
1117
|
+
set serviceTimeout(value: number);
|
|
1118
|
+
/**
|
|
1119
|
+
* Creates an instance of the HomeAssistant class.
|
|
1120
|
+
*
|
|
1121
|
+
* @param {string} url - The WebSocket URL for connecting to Home Assistant (i.e. ws://192.168.x.x:8123 or wss://...).
|
|
1122
|
+
* Auto-detected from the network if not provided. Protocol prefix ws:// or wss:// is normalised automatically.
|
|
1123
|
+
* @param {string} [accessToken] - The access token for authenticating with Home Assistant.
|
|
1124
|
+
* Optional: when running as HA add-on the SUPERVISOR_TOKEN env var is used automatically.
|
|
1125
|
+
* When HA has trusted_networks configured for the local subnet, an empty token is accepted.
|
|
1126
|
+
* @param {number} [reconnectTimeoutTime] - Timeout in seconds between reconnect attempts. Defaults to 60.
|
|
1127
|
+
* @param {number} [reconnectRetries] - Max reconnection attempts before giving up. Defaults to 10.
|
|
1128
|
+
* @param {string | undefined} [certificatePath] - Path to CA certificate for secure WebSocket. Defaults to undefined.
|
|
1129
|
+
* @param {boolean | undefined} [rejectUnauthorized] - Reject unauthorized TLS certs. Defaults to false (allow LAN self-signed).
|
|
1130
|
+
* @param {number} [connectionTimeoutTime] - Maximum seconds for the WebSocket upgrade and authentication. Defaults to 15.
|
|
1131
|
+
*/
|
|
1132
|
+
constructor(url: string, accessToken?: string, // empty string = trust-local / supervisor mode
|
|
1133
|
+
reconnectTimeoutTime?: number, reconnectRetries?: number, // 0 = infinite retries on HA restart
|
|
1134
|
+
certificatePath?: string | undefined, rejectUnauthorized?: boolean | undefined, // allow self-signed certs on LAN
|
|
1135
|
+
connectionTimeoutTime?: number);
|
|
1136
|
+
private onOpen;
|
|
1137
|
+
private onPing;
|
|
1138
|
+
private onPong;
|
|
1139
|
+
private onError;
|
|
1140
|
+
private onMessage;
|
|
1141
|
+
private onClose;
|
|
1142
|
+
private rejectPendingRequests;
|
|
1143
|
+
private request;
|
|
1144
|
+
private onFetchTimeout;
|
|
1145
|
+
/**
|
|
1146
|
+
* Connects to Home Assistant WebSocket API. It establishes a WebSocket connection and authenticates.
|
|
1147
|
+
*
|
|
1148
|
+
* @returns {Promise<string>} - A Promise that resolves to the HA version when the connection is established and authenticated, or rejects with an error if the connection fails.
|
|
1149
|
+
* @throws {Error} - Throws an error if already connected or if there is an error during connection or authentication.
|
|
1150
|
+
*/
|
|
1151
|
+
connect(): Promise<string>;
|
|
1152
|
+
/**
|
|
1153
|
+
* Starts the ping interval to keep the WebSocket connection alive.
|
|
1154
|
+
* Logs an error if the ping interval is already started.
|
|
1155
|
+
*/
|
|
1156
|
+
private startPing;
|
|
1157
|
+
/**
|
|
1158
|
+
* Stops the ping interval and clears any pending timeouts.
|
|
1159
|
+
*/
|
|
1160
|
+
private stopPing;
|
|
1161
|
+
/**
|
|
1162
|
+
* Start the reconnection timeout if reconnectTimeoutTime and reconnectRetries are set in the config.
|
|
1163
|
+
*/
|
|
1164
|
+
startReconnect(): void;
|
|
1165
|
+
/**
|
|
1166
|
+
* Stops the ping interval, closes the WebSocket connection to Home Assistant and emits a 'disconnected' event.
|
|
1167
|
+
*
|
|
1168
|
+
* @param {number} [code] - The WebSocket close code. Default is 1000 (Normal closure).
|
|
1169
|
+
* @param {string} [reason] - The reason for closing the connection. Default is 'Normal closure'.
|
|
1170
|
+
* @returns {Promise<void>} - A Promise that resolves when the connection is closed or rejects with an error if the connection could not be closed.
|
|
1171
|
+
*/
|
|
1172
|
+
close(code?: number, reason?: string, isPermanent?: boolean): Promise<void>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Fetches the initial data from Home Assistant.
|
|
1175
|
+
*
|
|
1176
|
+
* This method retrieves:
|
|
1177
|
+
* - config
|
|
1178
|
+
* - services
|
|
1179
|
+
* - devices
|
|
1180
|
+
* - entities
|
|
1181
|
+
* - states
|
|
1182
|
+
* - areas
|
|
1183
|
+
* - labels
|
|
1184
|
+
*/
|
|
1185
|
+
fetchData(): Promise<void>;
|
|
1186
|
+
/**
|
|
1187
|
+
* Sends a request to Home Assistant and waits for a response.
|
|
1188
|
+
*
|
|
1189
|
+
* @param {string} type - The type of request to send.
|
|
1190
|
+
* @returns {Promise<any>} - A Promise that resolves with the response from Home Assistant or rejects with an error.
|
|
1191
|
+
* @example
|
|
1192
|
+
* fetch('get_states')
|
|
1193
|
+
* .then(response => {
|
|
1194
|
+
* console.log('Received response:', response);
|
|
1195
|
+
* })
|
|
1196
|
+
* .catch(error => {
|
|
1197
|
+
* console.error('Error:', error);
|
|
1198
|
+
* });
|
|
1199
|
+
*/
|
|
1200
|
+
fetch(type: string): Promise<any>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Sends a "subscribe_events" request to Home Assistant and waits for a response.
|
|
1203
|
+
*
|
|
1204
|
+
* @param {string | undefined} event - The event to subscribe to or all events if not specified.
|
|
1205
|
+
* @returns {Promise<number>} - A Promise that resolves with the subscribe id from Home Assistant or rejects with an error.
|
|
1206
|
+
* @example subscribe('state_changed')
|
|
1207
|
+
* .then(response => {
|
|
1208
|
+
* console.log('Received response subscription id:', response);
|
|
1209
|
+
* })
|
|
1210
|
+
* .catch(error => {
|
|
1211
|
+
* console.error('Error subscribing:', error);
|
|
1212
|
+
* });
|
|
1213
|
+
*/
|
|
1214
|
+
subscribe(event?: string): Promise<number>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Sends a "subscribe_events" request to Home Assistant and waits for a response.
|
|
1217
|
+
*
|
|
1218
|
+
* @param {number} subscriptionId - The subscription id to unsubscribe from.
|
|
1219
|
+
* @returns {Promise<void>} - A Promise that resolves or rejects with an error.
|
|
1220
|
+
* @example unsubscribe('state_changed')
|
|
1221
|
+
* .then(() => {
|
|
1222
|
+
* console.log('Unsubscribed successfully');
|
|
1223
|
+
* })
|
|
1224
|
+
* .catch(error => {
|
|
1225
|
+
* console.error('Error unsubscribing:', error);
|
|
1226
|
+
* });
|
|
1227
|
+
*/
|
|
1228
|
+
unsubscribe(subscriptionId: number): Promise<void>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Sends async command to a specified Home Assistant service for a specific entity and waits for a response.
|
|
1231
|
+
*
|
|
1232
|
+
* @param {string} domain - The domain of the Home Assistant service.
|
|
1233
|
+
* @param {string} service - The service to call on the Home Assistant domain.
|
|
1234
|
+
* @param {string} entityId - The ID of the entity to target with the command.
|
|
1235
|
+
* @param {Record<string, any>} [serviceData] - Optional additional data to send with the command.
|
|
1236
|
+
*
|
|
1237
|
+
* @returns {Promise<any>} - A Promise that resolves with the response from Home Assistant or rejects with an error.
|
|
1238
|
+
*
|
|
1239
|
+
* @example <caption>Example usage of the callService method.</caption>
|
|
1240
|
+
* await this.callService('switch', 'toggle', 'switch.living_room');
|
|
1241
|
+
* await this.callService('light', 'turn_on', 'light.living_room', { brightness: 255 });
|
|
1242
|
+
*/
|
|
1243
|
+
callService(domain: string, service: string, entityId: string, serviceData?: Record<string, HomeAssistantPrimitive>): Promise<{
|
|
1244
|
+
context: HassContext;
|
|
1245
|
+
response: unknown;
|
|
1246
|
+
}>;
|
|
1247
|
+
/**
|
|
1248
|
+
* Returns the HTTP/HTTPS base URL corresponding to the WebSocket endpoint.
|
|
1249
|
+
*/
|
|
1250
|
+
getHttpBaseUrl(): string;
|
|
1251
|
+
/**
|
|
1252
|
+
* Returns the active WebSocket / REST access token if configured.
|
|
1253
|
+
*/
|
|
1254
|
+
getAccessToken(): string | undefined;
|
|
1255
|
+
/**
|
|
1256
|
+
* Requests a live camera HLS stream URL via Home Assistant WebSocket API (`camera/stream`).
|
|
1257
|
+
*/
|
|
1258
|
+
requestCameraStream(entityId: string): Promise<string | null>;
|
|
1259
|
+
/**
|
|
1260
|
+
* Fetches a raw JPEG image snapshot from Home Assistant `/api/camera_proxy/{entity_id}`.
|
|
1261
|
+
*/
|
|
1262
|
+
fetchSnapshot(entityId: string): Promise<Buffer | null>;
|
|
1263
|
+
/**
|
|
1264
|
+
* Returns the official Home Assistant camera proxy stream endpoint URL.
|
|
1265
|
+
*/
|
|
1266
|
+
getCameraProxyStreamUrl(entityId: string): string;
|
|
1267
|
+
}
|
|
1268
|
+
export {};
|