@digital-alchemy/hass 24.11.4 → 25.2.1
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/dynamic.d.mts +45 -44
- package/dist/dynamic.mjs +0 -1
- package/dist/dynamic.mjs.map +1 -1
- package/dist/helpers/utility.d.mts +1 -2
- package/dist/helpers/utility.mjs +1 -2
- package/dist/helpers/utility.mjs.map +1 -1
- package/dist/merge.d.mts +4 -0
- package/dist/merge.mjs +2 -0
- package/dist/merge.mjs.map +1 -0
- package/dist/mock_assistant/services/entity.service.mjs +2 -1
- package/dist/mock_assistant/services/entity.service.mjs.map +1 -1
- package/dist/mock_assistant/services/fixtures.service.mjs +2 -1
- package/dist/mock_assistant/services/fixtures.service.mjs.map +1 -1
- package/dist/services/backup.service.d.mts +1 -1
- package/dist/services/backup.service.mjs +2 -2
- package/dist/services/backup.service.mjs.map +1 -1
- package/dist/services/call-proxy.service.mjs +1 -1
- package/dist/services/call-proxy.service.mjs.map +1 -1
- package/dist/services/config.service.mjs +2 -1
- package/dist/services/config.service.mjs.map +1 -1
- package/dist/services/entity.service.mjs +2 -1
- package/dist/services/entity.service.mjs.map +1 -1
- package/dist/services/events.service.d.mts +1 -1
- package/dist/services/events.service.mjs +7 -8
- package/dist/services/events.service.mjs.map +1 -1
- package/dist/services/fetch-api.service.d.mts +1 -1
- package/dist/services/fetch-api.service.mjs +2 -2
- package/dist/services/fetch-api.service.mjs.map +1 -1
- package/dist/services/id-by.service.d.mts +1 -1
- package/dist/services/id-by.service.mjs +7 -8
- package/dist/services/id-by.service.mjs.map +1 -1
- package/dist/services/internal.service.d.mts +1 -1
- package/dist/services/internal.service.mjs +5 -3
- package/dist/services/internal.service.mjs.map +1 -1
- package/dist/services/reference.service.mjs +2 -1
- package/dist/services/reference.service.mjs.map +1 -1
- package/dist/services/websocket-api.service.mjs +15 -8
- package/dist/services/websocket-api.service.mjs.map +1 -1
- package/dist/testing/fetch-api.spec.mjs +1 -1
- package/dist/testing/fetch-api.spec.mjs.map +1 -1
- package/package.json +27 -27
- package/src/dynamic.mts +192 -149
- package/src/helpers/utility.mts +1 -2
- package/src/merge.mts +9 -0
- package/src/mock_assistant/services/entity.service.mts +2 -1
- package/src/mock_assistant/services/fixtures.service.mts +2 -1
- package/src/services/backup.service.mts +9 -2
- package/src/services/call-proxy.service.mts +2 -1
- package/src/services/config.service.mts +2 -9
- package/src/services/entity.service.mts +1 -1
- package/src/services/events.service.mts +8 -8
- package/src/services/fetch-api.service.mts +11 -2
- package/src/services/id-by.service.mts +14 -8
- package/src/services/internal.service.mts +6 -2
- package/src/services/reference.service.mts +2 -1
- package/src/services/websocket-api.service.mts +24 -9
- package/src/testing/fetch-api.spec.mts +1 -1
package/src/dynamic.mts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/* eslint-disable sonarjs/redundant-type-aliases */
|
|
3
3
|
/* eslint-disable @cspell/spellchecker */
|
|
4
4
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
5
|
-
/* eslint-disable sonarjs/no-redundant-type-constituents */
|
|
6
5
|
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
7
6
|
|
|
8
7
|
// @ts-nocheck
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
NotificationData,
|
|
15
14
|
PICK_ENTITY,
|
|
16
15
|
} from "./helpers/index.mts";
|
|
16
|
+
import { DynamicMergeAttributes } from "./merge.mts";
|
|
17
17
|
|
|
18
18
|
type PICK_FROM_PLATFORM<ID extends TPlatformId, DOMAIN extends TRawDomains = TRawDomains> = Extract<
|
|
19
19
|
REGISTRY_SETUP["platform"][`_${ID}`],
|
|
@@ -25,16 +25,17 @@ export type ENTITY_SETUP = {
|
|
|
25
25
|
"button.example": {
|
|
26
26
|
state: string;
|
|
27
27
|
entity_id: "button.example";
|
|
28
|
-
attributes: {
|
|
29
|
-
friendly_name: "Example button";
|
|
30
|
-
};
|
|
28
|
+
attributes: DynamicMergeAttributes<"button.example", { friendly_name: "Example button" }>;
|
|
31
29
|
};
|
|
32
30
|
"binary_sensor.hass_e2e_online": {
|
|
33
|
-
attributes:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
attributes: DynamicMergeAttributes<
|
|
32
|
+
"binary_sensor.hass_e2e_online",
|
|
33
|
+
{
|
|
34
|
+
friendly_name: "hass_e2e online";
|
|
35
|
+
restored: true;
|
|
36
|
+
supported_features: 0;
|
|
37
|
+
}
|
|
38
|
+
>;
|
|
38
39
|
context: {
|
|
39
40
|
id: "01HWXTSCSBGW129NV7WY8MMG1E";
|
|
40
41
|
parent_id: null;
|
|
@@ -45,119 +46,134 @@ export type ENTITY_SETUP = {
|
|
|
45
46
|
state: "unavailable";
|
|
46
47
|
};
|
|
47
48
|
"binary_sensor.toggles": {
|
|
48
|
-
attributes:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
attributes: DynamicMergeAttributes<
|
|
50
|
+
"binary_sensor.toggles",
|
|
51
|
+
{
|
|
52
|
+
friendly_name: "toggles";
|
|
53
|
+
icon: "mdi:toggle-switch-variant-off";
|
|
54
|
+
restored: true;
|
|
55
|
+
supported_features: 0;
|
|
56
|
+
}
|
|
57
|
+
>;
|
|
54
58
|
context: {
|
|
55
59
|
id: "01HWXTSCSB43FF1R6FX0QEE4Z6";
|
|
56
60
|
parent_id: null;
|
|
57
61
|
user_id: null;
|
|
58
62
|
};
|
|
59
63
|
entity_id: "binary_sensor.toggles";
|
|
60
|
-
|
|
61
64
|
state: "unavailable";
|
|
62
65
|
};
|
|
63
66
|
"calendar.united_states_tx": {
|
|
64
|
-
attributes:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
attributes: DynamicMergeAttributes<
|
|
68
|
+
"calendar.united_states_tx",
|
|
69
|
+
{
|
|
70
|
+
all_day: true;
|
|
71
|
+
description: "";
|
|
72
|
+
end_time: "2024-05-28 00:00:00";
|
|
73
|
+
friendly_name: "United States, TX";
|
|
74
|
+
location: "United States, TX";
|
|
75
|
+
message: "Memorial Day";
|
|
76
|
+
start_time: "2024-05-27 00:00:00";
|
|
77
|
+
}
|
|
78
|
+
>;
|
|
73
79
|
context: {
|
|
74
80
|
id: "01HWXTYEEFBB7QQC1CSM6PAR36";
|
|
75
81
|
parent_id: null;
|
|
76
82
|
user_id: null;
|
|
77
83
|
};
|
|
78
84
|
entity_id: "calendar.united_states_tx";
|
|
79
|
-
|
|
80
85
|
state: "off";
|
|
81
86
|
};
|
|
82
87
|
"light.bedroom_ceiling_fan": {
|
|
83
|
-
attributes:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
88
|
+
attributes: DynamicMergeAttributes<
|
|
89
|
+
"light.bedroom_ceiling_fan",
|
|
90
|
+
{
|
|
91
|
+
brightness: null;
|
|
92
|
+
color_mode: null;
|
|
93
|
+
color_temp: null;
|
|
94
|
+
color_temp_kelvin: null;
|
|
95
|
+
friendly_name: "Bedroom Ceiling Fan";
|
|
96
|
+
hs_color: null;
|
|
97
|
+
icon: "mdi:lightbulb-group";
|
|
98
|
+
max_color_temp_kelvin: 6535;
|
|
99
|
+
max_mireds: 500;
|
|
100
|
+
min_color_temp_kelvin: 2000;
|
|
101
|
+
min_mireds: 153;
|
|
102
|
+
rgb_color: null;
|
|
103
|
+
supported_color_modes: ["color_temp", "xy"];
|
|
104
|
+
supported_features: 40;
|
|
105
|
+
xy_color: null;
|
|
106
|
+
}
|
|
107
|
+
>;
|
|
100
108
|
context: {
|
|
101
109
|
id: "01HX722Y1JFS6KN2MDERK0VJ2D";
|
|
102
110
|
parent_id: null;
|
|
103
111
|
user_id: null;
|
|
104
112
|
};
|
|
105
113
|
entity_id: "light.bedroom_ceiling_fan";
|
|
106
|
-
|
|
107
114
|
state: "off";
|
|
108
115
|
};
|
|
109
116
|
"person.digital_alchemy": {
|
|
110
|
-
attributes:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
attributes: DynamicMergeAttributes<
|
|
118
|
+
"person.digital_alchemy",
|
|
119
|
+
{
|
|
120
|
+
device_trackers: [];
|
|
121
|
+
editable: true;
|
|
122
|
+
friendly_name: "digital-alchemy";
|
|
123
|
+
id: "digital_alchemy";
|
|
124
|
+
user_id: "4dd1cf7e93e94f3fbaf419501f9a3d59";
|
|
125
|
+
}
|
|
126
|
+
>;
|
|
117
127
|
context: {
|
|
118
128
|
id: "01HWXTSCSBRKJ9T2KV1JNER5KQ";
|
|
119
129
|
parent_id: null;
|
|
120
130
|
user_id: null;
|
|
121
131
|
};
|
|
122
132
|
entity_id: "person.digital_alchemy";
|
|
123
|
-
|
|
124
133
|
state: "unknown";
|
|
125
134
|
};
|
|
126
135
|
"scene.games_room_auto": {
|
|
127
|
-
attributes:
|
|
128
|
-
"
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
attributes: DynamicMergeAttributes<
|
|
137
|
+
"scene.games_room_auto",
|
|
138
|
+
{
|
|
139
|
+
"Managed By": "home_automation";
|
|
140
|
+
friendly_name: "bedroom off";
|
|
141
|
+
}
|
|
142
|
+
>;
|
|
131
143
|
context: {
|
|
132
144
|
id: "01HWXW289S8HP5MSGNNTNB2CBG";
|
|
133
145
|
parent_id: null;
|
|
134
146
|
user_id: null;
|
|
135
147
|
};
|
|
136
148
|
entity_id: "scene.games_room_auto";
|
|
137
|
-
|
|
138
149
|
state: "unknown";
|
|
139
150
|
};
|
|
140
151
|
"sensor.magic": {
|
|
141
|
-
attributes:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
attributes: DynamicMergeAttributes<
|
|
153
|
+
"sensor.magic",
|
|
154
|
+
{
|
|
155
|
+
friendly_name: "magic";
|
|
156
|
+
icon: "mdi:satellite-uplink";
|
|
157
|
+
restored: true;
|
|
158
|
+
supported_features: 0;
|
|
159
|
+
}
|
|
160
|
+
>;
|
|
147
161
|
context: {
|
|
148
162
|
id: "01HWXTSCSBW34BP3R20RJ09CVZ";
|
|
149
163
|
parent_id: null;
|
|
150
164
|
user_id: null;
|
|
151
165
|
};
|
|
152
166
|
entity_id: "sensor.magic";
|
|
153
|
-
|
|
154
167
|
state: string;
|
|
155
168
|
};
|
|
156
169
|
"sensor.sun_next_dawn": {
|
|
157
|
-
attributes:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
170
|
+
attributes: DynamicMergeAttributes<
|
|
171
|
+
"sensor.sun_next_dawn",
|
|
172
|
+
{
|
|
173
|
+
device_class: "timestamp";
|
|
174
|
+
friendly_name: "Sun Next dawn";
|
|
175
|
+
}
|
|
176
|
+
>;
|
|
161
177
|
context: {
|
|
162
178
|
id: "01HWXTS8W1SRTPT5K1XM0G491X";
|
|
163
179
|
parent_id: null;
|
|
@@ -168,133 +184,152 @@ export type ENTITY_SETUP = {
|
|
|
168
184
|
state: "2024-05-03T03:24:45+00:00";
|
|
169
185
|
};
|
|
170
186
|
"sensor.sun_next_dusk": {
|
|
171
|
-
attributes:
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
187
|
+
attributes: DynamicMergeAttributes<
|
|
188
|
+
"sensor.sun_next_dusk",
|
|
189
|
+
{
|
|
190
|
+
device_class: "timestamp";
|
|
191
|
+
friendly_name: "Sun Next dusk";
|
|
192
|
+
}
|
|
193
|
+
>;
|
|
175
194
|
context: {
|
|
176
195
|
id: "01HWXTS8W1S95P1MVHDGHSQEB2";
|
|
177
196
|
parent_id: null;
|
|
178
197
|
user_id: null;
|
|
179
198
|
};
|
|
180
199
|
entity_id: "sensor.sun_next_dusk";
|
|
181
|
-
|
|
182
200
|
state: "2024-05-03T19:51:10+00:00";
|
|
183
201
|
};
|
|
184
202
|
"sensor.sun_next_midnight": {
|
|
185
|
-
attributes:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
203
|
+
attributes: DynamicMergeAttributes<
|
|
204
|
+
"sensor.sun_next_midnight",
|
|
205
|
+
{
|
|
206
|
+
device_class: "timestamp";
|
|
207
|
+
friendly_name: "Sun Next midnight";
|
|
208
|
+
}
|
|
209
|
+
>;
|
|
189
210
|
context: {
|
|
190
211
|
id: "01HWXTS8W1YQCPA3WZ69Y9JSPD";
|
|
191
212
|
parent_id: null;
|
|
192
213
|
user_id: null;
|
|
193
214
|
};
|
|
194
215
|
entity_id: "sensor.sun_next_midnight";
|
|
195
|
-
|
|
196
216
|
state: "2024-05-03T23:37:12+00:00";
|
|
197
217
|
};
|
|
198
218
|
"sensor.sun_next_noon": {
|
|
199
|
-
attributes:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
219
|
+
attributes: DynamicMergeAttributes<
|
|
220
|
+
"sensor.sun_next_noon",
|
|
221
|
+
{
|
|
222
|
+
device_class: "timestamp";
|
|
223
|
+
friendly_name: "Sun Next noon";
|
|
224
|
+
}
|
|
225
|
+
>;
|
|
203
226
|
context: {
|
|
204
227
|
id: "01HWXTS8W28MVV48CQ31JB2WKC";
|
|
205
228
|
parent_id: null;
|
|
206
229
|
user_id: null;
|
|
207
230
|
};
|
|
208
231
|
entity_id: "sensor.sun_next_noon";
|
|
209
|
-
|
|
210
232
|
state: "2024-05-03T11:37:19+00:00";
|
|
211
233
|
};
|
|
212
234
|
"sensor.sun_next_rising": {
|
|
213
|
-
attributes:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
235
|
+
attributes: DynamicMergeAttributes<
|
|
236
|
+
"sensor.sun_next_rising",
|
|
237
|
+
{
|
|
238
|
+
device_class: "timestamp";
|
|
239
|
+
friendly_name: "Sun Next rising";
|
|
240
|
+
}
|
|
241
|
+
>;
|
|
217
242
|
context: {
|
|
218
243
|
id: "01HWXTS8W2MMADKGWE4A5BMH51";
|
|
219
244
|
parent_id: null;
|
|
220
245
|
user_id: null;
|
|
221
246
|
};
|
|
222
247
|
entity_id: "sensor.sun_next_rising";
|
|
223
|
-
|
|
224
248
|
state: "2024-05-03T04:05:17+00:00";
|
|
225
249
|
};
|
|
226
250
|
"sensor.sun_next_setting": {
|
|
227
|
-
attributes:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
251
|
+
attributes: DynamicMergeAttributes<
|
|
252
|
+
"sensor.sun_next_setting",
|
|
253
|
+
{
|
|
254
|
+
device_class: "timestamp";
|
|
255
|
+
friendly_name: "Sun Next setting";
|
|
256
|
+
}
|
|
257
|
+
>;
|
|
231
258
|
context: {
|
|
232
259
|
id: "01HWXTS8W24KWTHR2B6V32NCXG";
|
|
233
260
|
parent_id: null;
|
|
234
261
|
user_id: null;
|
|
235
262
|
};
|
|
236
263
|
entity_id: "sensor.sun_next_setting";
|
|
237
|
-
|
|
238
264
|
state: "2024-05-03T19:10:21+00:00";
|
|
239
265
|
};
|
|
240
266
|
"sun.sun": {
|
|
241
|
-
attributes:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
267
|
+
attributes: DynamicMergeAttributes<
|
|
268
|
+
"sun.sun",
|
|
269
|
+
{
|
|
270
|
+
azimuth: 0.35;
|
|
271
|
+
elevation: -21.86;
|
|
272
|
+
friendly_name: "Sun";
|
|
273
|
+
next_dawn: "2024-05-03T03:24:45.747945+00:00";
|
|
274
|
+
next_dusk: "2024-05-03T19:51:10.358970+00:00";
|
|
275
|
+
next_midnight: "2024-05-03T23:37:12+00:00";
|
|
276
|
+
next_noon: "2024-05-03T11:37:19+00:00";
|
|
277
|
+
next_rising: "2024-05-03T04:05:17.926549+00:00";
|
|
278
|
+
next_setting: "2024-05-03T19:10:21.280558+00:00";
|
|
279
|
+
rising: true;
|
|
280
|
+
}
|
|
281
|
+
>;
|
|
253
282
|
context: {
|
|
254
283
|
id: "01HWXTS8W1J2TDGMN7KKNWP8DV";
|
|
255
284
|
parent_id: null;
|
|
256
285
|
user_id: null;
|
|
257
286
|
};
|
|
258
287
|
entity_id: "sun.sun";
|
|
259
|
-
|
|
260
288
|
state: "below_horizon";
|
|
261
289
|
};
|
|
262
290
|
"switch.bedroom_lamp": {
|
|
263
|
-
attributes:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
291
|
+
attributes: DynamicMergeAttributes<
|
|
292
|
+
"switch.bedroom_lamp",
|
|
293
|
+
{
|
|
294
|
+
friendly_name: "bedroom_lamp";
|
|
295
|
+
restored: true;
|
|
296
|
+
supported_features: 0;
|
|
297
|
+
}
|
|
298
|
+
>;
|
|
268
299
|
context: {
|
|
269
300
|
id: "01HWXTSCSB7BK003CH3AYYVXCB";
|
|
270
301
|
parent_id: null;
|
|
271
302
|
user_id: null;
|
|
272
303
|
};
|
|
273
304
|
entity_id: "switch.bedroom_lamp";
|
|
274
|
-
|
|
275
305
|
state: "unavailable";
|
|
276
306
|
};
|
|
277
307
|
"switch.kitchen_cabinets": {
|
|
278
|
-
attributes:
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
308
|
+
attributes: DynamicMergeAttributes<
|
|
309
|
+
"switch.kitchen_cabinets",
|
|
310
|
+
{
|
|
311
|
+
friendly_name: "kitchen_cabinets";
|
|
312
|
+
restored: true;
|
|
313
|
+
supported_features: 0;
|
|
314
|
+
}
|
|
315
|
+
>;
|
|
283
316
|
context: {
|
|
284
317
|
id: "01HWXTSCSBM9Y3SRQTFJ5CVK6H";
|
|
285
318
|
parent_id: null;
|
|
286
319
|
user_id: null;
|
|
287
320
|
};
|
|
288
321
|
entity_id: "switch.kitchen_cabinets";
|
|
289
|
-
|
|
290
322
|
state: "unavailable";
|
|
291
323
|
};
|
|
292
324
|
"switch.living_room_mood_lights": {
|
|
293
|
-
attributes:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
325
|
+
attributes: DynamicMergeAttributes<
|
|
326
|
+
"switch.living_room_mood_lights",
|
|
327
|
+
{
|
|
328
|
+
friendly_name: "living_room_mood_lights";
|
|
329
|
+
restored: true;
|
|
330
|
+
supported_features: 0;
|
|
331
|
+
}
|
|
332
|
+
>;
|
|
298
333
|
context: {
|
|
299
334
|
id: "01HWXTSCSBS5B586JJ7VFH10SX";
|
|
300
335
|
parent_id: null;
|
|
@@ -305,65 +340,73 @@ export type ENTITY_SETUP = {
|
|
|
305
340
|
state: "unavailable";
|
|
306
341
|
};
|
|
307
342
|
"switch.porch_light": {
|
|
308
|
-
attributes:
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
343
|
+
attributes: DynamicMergeAttributes<
|
|
344
|
+
"switch.porch_light",
|
|
345
|
+
{
|
|
346
|
+
friendly_name: "porch_light";
|
|
347
|
+
restored: true;
|
|
348
|
+
supported_features: 0;
|
|
349
|
+
}
|
|
350
|
+
>;
|
|
313
351
|
context: {
|
|
314
352
|
id: "01HWXTSCSBFTSZR1M5XAK7XSR8";
|
|
315
353
|
parent_id: null;
|
|
316
354
|
user_id: null;
|
|
317
355
|
};
|
|
318
356
|
entity_id: "switch.porch_light";
|
|
319
|
-
|
|
320
357
|
state: string;
|
|
321
358
|
};
|
|
322
359
|
"todo.shopping_list": {
|
|
323
|
-
attributes:
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
360
|
+
attributes: DynamicMergeAttributes<
|
|
361
|
+
"todo.shopping_list",
|
|
362
|
+
{
|
|
363
|
+
friendly_name: "Shopping List";
|
|
364
|
+
supported_features: 15;
|
|
365
|
+
}
|
|
366
|
+
>;
|
|
327
367
|
context: {
|
|
328
368
|
id: "01HWXTS8X3D417XC4YJTG8QJWB";
|
|
329
369
|
parent_id: null;
|
|
330
370
|
user_id: null;
|
|
331
371
|
};
|
|
332
372
|
entity_id: "todo.shopping_list";
|
|
333
|
-
|
|
334
373
|
state: "0";
|
|
335
374
|
};
|
|
336
375
|
"tts.google_en_com": {
|
|
337
|
-
attributes:
|
|
338
|
-
|
|
339
|
-
|
|
376
|
+
attributes: DynamicMergeAttributes<
|
|
377
|
+
"tts.google_en_com",
|
|
378
|
+
{
|
|
379
|
+
friendly_name: "Google en com";
|
|
380
|
+
}
|
|
381
|
+
>;
|
|
340
382
|
context: {
|
|
341
383
|
id: "01HWXTS8XMPQ236CDJ6X7C6E60";
|
|
342
384
|
parent_id: null;
|
|
343
385
|
user_id: null;
|
|
344
386
|
};
|
|
345
387
|
entity_id: "tts.google_en_com";
|
|
346
|
-
|
|
347
388
|
state: "unknown";
|
|
348
389
|
};
|
|
349
390
|
"zone.home": {
|
|
350
|
-
attributes:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
391
|
+
attributes: DynamicMergeAttributes<
|
|
392
|
+
"zone.home",
|
|
393
|
+
{
|
|
394
|
+
editable: true;
|
|
395
|
+
friendly_name: "Home";
|
|
396
|
+
icon: "mdi:home";
|
|
397
|
+
latitude: 52.373_133_9;
|
|
398
|
+
longitude: 4.890_314_7;
|
|
399
|
+
passive: false;
|
|
400
|
+
persons: [];
|
|
401
|
+
radius: 100;
|
|
402
|
+
}
|
|
403
|
+
>;
|
|
360
404
|
context: {
|
|
361
405
|
id: "01HWXTS8GMB4ZW20P8MGMX0QSN";
|
|
362
406
|
parent_id: null;
|
|
363
407
|
user_id: null;
|
|
364
408
|
};
|
|
365
409
|
entity_id: "zone.home";
|
|
366
|
-
|
|
367
410
|
state: "0";
|
|
368
411
|
};
|
|
369
412
|
};
|
package/src/helpers/utility.mts
CHANGED
|
@@ -97,7 +97,7 @@ export type GetDomain<ENTITY extends ANY_ENTITY> = ENTITY extends `${infer domai
|
|
|
97
97
|
? domain
|
|
98
98
|
: never;
|
|
99
99
|
|
|
100
|
-
function isDomain<DOMAIN extends ALL_DOMAINS>(
|
|
100
|
+
export function isDomain<DOMAIN extends ALL_DOMAINS>(
|
|
101
101
|
entity: string,
|
|
102
102
|
domain: DOMAIN | DOMAIN[],
|
|
103
103
|
): entity is PICK_ENTITY<DOMAIN> {
|
|
@@ -105,7 +105,6 @@ function isDomain<DOMAIN extends ALL_DOMAINS>(
|
|
|
105
105
|
return [domain].flat().includes(test);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
is.domain = isDomain;
|
|
109
108
|
is.removeFn = (remove: () => void) => {
|
|
110
109
|
const out = remove as RemoveCallback;
|
|
111
110
|
out.remove = remove;
|
package/src/merge.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PICK_ENTITY } from "./index.mts";
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
4
|
+
export interface EntityMergeAttributes {}
|
|
5
|
+
|
|
6
|
+
export type DynamicMergeAttributes<MAYBE_ENTITY extends string, SCANNED extends object> =
|
|
7
|
+
MAYBE_ENTITY extends Extract<PICK_ENTITY, keyof EntityMergeAttributes>
|
|
8
|
+
? SCANNED & EntityMergeAttributes[MAYBE_ENTITY]
|
|
9
|
+
: SCANNED;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deepExtend, InternalError,
|
|
1
|
+
import { deepExtend, InternalError, sleep, TServiceParams } from "@digital-alchemy/core";
|
|
2
2
|
|
|
3
3
|
import { TRawEntityIds } from "../../dynamic.mts";
|
|
4
4
|
import { ENTITY_STATE, PICK_ENTITY } from "../../helpers/index.mts";
|
|
@@ -11,6 +11,7 @@ export function MockEntityExtension({
|
|
|
11
11
|
config,
|
|
12
12
|
mock_assistant,
|
|
13
13
|
}: TServiceParams) {
|
|
14
|
+
const { is } = internal.utils;
|
|
14
15
|
let entities = new Map<TRawEntityIds, ENTITY_STATE<TRawEntityIds>>();
|
|
15
16
|
|
|
16
17
|
const origGetAll = hass.fetch.getAllEntities;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BootstrapException,
|
|
1
|
+
import { BootstrapException, TServiceParams } from "@digital-alchemy/core";
|
|
2
2
|
import { existsSync, readFileSync } from "fs";
|
|
3
3
|
|
|
4
4
|
import { ANY_ENTITY, ENTITY_STATE } from "../../helpers/index.mts";
|
|
@@ -17,6 +17,7 @@ export function MockFixtures({
|
|
|
17
17
|
context,
|
|
18
18
|
mock_assistant,
|
|
19
19
|
}: TServiceParams) {
|
|
20
|
+
const { is } = internal.utils;
|
|
20
21
|
// This file DELIBERATELY breaks some rules
|
|
21
22
|
// Setup actions that depend on config are not NORMALLY expected to run inside constructor
|
|
22
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SECOND, sleep, TServiceParams } from "@digital-alchemy/core";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
BackupResponse,
|
|
@@ -7,7 +7,14 @@ import {
|
|
|
7
7
|
SignRequestResponse,
|
|
8
8
|
} from "../helpers/index.mts";
|
|
9
9
|
|
|
10
|
-
export function Backup({
|
|
10
|
+
export function Backup({
|
|
11
|
+
logger,
|
|
12
|
+
hass,
|
|
13
|
+
config,
|
|
14
|
+
internal: {
|
|
15
|
+
utils: { is },
|
|
16
|
+
},
|
|
17
|
+
}: TServiceParams): HassBackupService {
|
|
11
18
|
async function download(slug: string, destination: string): Promise<void> {
|
|
12
19
|
const result = await hass.socket.sendMessage<SignRequestResponse>({
|
|
13
20
|
path: `/api/backup/download/${slug}`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TServiceParams } from "@digital-alchemy/core";
|
|
2
2
|
|
|
3
3
|
import { iCallService } from "../dynamic.mts";
|
|
4
4
|
import { ALL_SERVICE_DOMAINS, PICK_SERVICE, PICK_SERVICE_PARAMETERS } from "../helpers/index.mts";
|
|
@@ -10,6 +10,7 @@ export function CallProxy({
|
|
|
10
10
|
hass,
|
|
11
11
|
config,
|
|
12
12
|
}: TServiceParams): iCallService {
|
|
13
|
+
const { is } = internal.utils;
|
|
13
14
|
let loaded = false;
|
|
14
15
|
const rawProxy = {} as Record<string, Record<string, unknown>>;
|
|
15
16
|
/**
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
-
import {
|
|
3
|
-
asyncNoop,
|
|
4
|
-
INCREMENT,
|
|
5
|
-
is,
|
|
6
|
-
SECOND,
|
|
7
|
-
sleep,
|
|
8
|
-
START,
|
|
9
|
-
TServiceParams,
|
|
10
|
-
} from "@digital-alchemy/core";
|
|
2
|
+
import { asyncNoop, INCREMENT, SECOND, sleep, START, TServiceParams } from "@digital-alchemy/core";
|
|
11
3
|
import { env } from "process";
|
|
12
4
|
|
|
13
5
|
import { iCallService } from "../dynamic.mts";
|
|
@@ -31,6 +23,7 @@ export function Configure({
|
|
|
31
23
|
config,
|
|
32
24
|
internal,
|
|
33
25
|
}: TServiceParams): HassConfigService {
|
|
26
|
+
const { is } = internal.utils;
|
|
34
27
|
lifecycle.onPreInit(() => {
|
|
35
28
|
// HASSIO_TOKEN provided by home assistant to addons
|
|
36
29
|
// SUPERVISOR_TOKEN used as alias elsewhere
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
each,
|
|
4
4
|
eachSeries,
|
|
5
5
|
INCREMENT,
|
|
6
|
-
is,
|
|
7
6
|
SECOND,
|
|
8
7
|
sleep,
|
|
9
8
|
START,
|
|
@@ -38,6 +37,7 @@ export function EntityManager({
|
|
|
38
37
|
context,
|
|
39
38
|
internal,
|
|
40
39
|
}: TServiceParams): HassEntityManager {
|
|
40
|
+
const { is } = internal.utils;
|
|
41
41
|
// #MARK: Local vars
|
|
42
42
|
/**
|
|
43
43
|
* MASTER_STATE.switch.desk_light = {entity_id,state,attributes,...}
|