@digital-alchemy/hass 25.10.25 → 25.10.26
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/mappings.d.mts +13 -7
- package/dist/dev/registry.d.mts +238 -0
- package/dist/hass.module.d.mts +5 -1
- package/dist/hass.module.mjs +5 -1
- package/dist/hass.module.mjs.map +1 -1
- package/dist/helpers/fetch/service-list.d.mts +15 -4
- package/dist/helpers/index.d.mts +1 -0
- package/dist/helpers/index.mjs +1 -0
- package/dist/helpers/index.mjs.map +1 -1
- package/dist/helpers/supported-features.d.mts +447 -0
- package/dist/helpers/supported-features.mjs +290 -0
- package/dist/helpers/supported-features.mjs.map +1 -0
- package/dist/mock_assistant/mock-assistant.module.d.mts +2 -0
- package/dist/services/feature.service.d.mts +10 -0
- package/dist/services/feature.service.mjs +95 -0
- package/dist/services/feature.service.mjs.map +1 -0
- package/dist/services/index.d.mts +1 -0
- package/dist/services/index.mjs +1 -0
- package/dist/services/index.mjs.map +1 -1
- package/dist/testing/feature.spec.d.mts +1 -0
- package/dist/testing/feature.spec.mjs +203 -0
- package/dist/testing/feature.spec.mjs.map +1 -0
- package/dist/testing/id-by.spec.mjs +3 -3
- package/dist/testing/id-by.spec.mjs.map +1 -1
- package/dist/testing/ref-by.spec.mjs +2 -2
- package/dist/testing/ref-by.spec.mjs.map +1 -1
- package/package.json +9 -9
- package/src/dev/mappings.mts +38 -7
- package/src/dev/registry.mts +232 -0
- package/src/hass.module.mts +6 -0
- package/src/helpers/fetch/service-list.mts +13 -5
- package/src/helpers/index.mts +1 -0
- package/src/helpers/supported-features.mts +328 -0
- package/src/services/feature.service.mts +127 -0
- package/src/services/index.mts +1 -0
- package/src/testing/feature.spec.mts +219 -0
- package/src/testing/id-by.spec.mts +3 -3
- package/src/testing/ref-by.spec.mts +2 -2
package/src/dev/mappings.mts
CHANGED
|
@@ -28,6 +28,10 @@ declare module "../user.mts" {
|
|
|
28
28
|
select_example_unique_id: "select.example";
|
|
29
29
|
text_example_unique_id: "text.example";
|
|
30
30
|
time_example_unique_id: "time.example";
|
|
31
|
+
light_test_light_unique_id: "light.test_light";
|
|
32
|
+
todo_test_todo_unique_id: "todo.test_todo";
|
|
33
|
+
climate_test_climate_unique_id: "climate.test_climate";
|
|
34
|
+
unsupported_test_unique_id: "unsupported.test";
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export interface HassZoneMapping {
|
|
@@ -36,25 +40,43 @@ declare module "../user.mts" {
|
|
|
36
40
|
|
|
37
41
|
export interface HassDomainMapping {
|
|
38
42
|
automation: "automation.example";
|
|
39
|
-
binary_sensor:
|
|
43
|
+
binary_sensor:
|
|
44
|
+
| "binary_sensor.bedroom_window"
|
|
45
|
+
| "binary_sensor.garage_door"
|
|
46
|
+
| "binary_sensor.hass_e2e_online"
|
|
47
|
+
| "binary_sensor.toggles";
|
|
40
48
|
button: "button.example";
|
|
41
49
|
calendar: "calendar.united_states_tx";
|
|
50
|
+
climate: "climate.hallway_thermostat" | "climate.test_room" | "climate.test_climate";
|
|
42
51
|
date: "date.example";
|
|
43
52
|
datetime: "datetime.example";
|
|
44
|
-
light:
|
|
53
|
+
light:
|
|
54
|
+
| "light.bedroom_ceiling_fan"
|
|
55
|
+
| "light.bedroom_light"
|
|
56
|
+
| "light.kitchen_lamp"
|
|
57
|
+
| "light.test_light";
|
|
45
58
|
lock: "lock.example";
|
|
46
59
|
number: "number.example";
|
|
47
60
|
person: "person.digital_alchemy";
|
|
48
61
|
scene: "scene.games_room_auto";
|
|
49
62
|
select: "select.example";
|
|
50
63
|
sensor:
|
|
64
|
+
| "sensor.bedroom_disabled_temp"
|
|
65
|
+
| "sensor.floor_test_disabled"
|
|
66
|
+
| "sensor.kitchen_disabled_temp"
|
|
67
|
+
| "sensor.label_test_disabled"
|
|
68
|
+
| "sensor.living_room_disabled_temp"
|
|
69
|
+
| "sensor.living_room_temperature"
|
|
51
70
|
| "sensor.magic"
|
|
52
71
|
| "sensor.sun_next_dawn"
|
|
53
72
|
| "sensor.sun_next_dusk"
|
|
54
73
|
| "sensor.sun_next_midnight"
|
|
55
74
|
| "sensor.sun_next_noon"
|
|
56
75
|
| "sensor.sun_next_rising"
|
|
57
|
-
| "sensor.sun_next_setting"
|
|
76
|
+
| "sensor.sun_next_setting"
|
|
77
|
+
| "sensor.sun_solar_azimuth"
|
|
78
|
+
| "sensor.sun_solar_elevation"
|
|
79
|
+
| "sensor.sun_solar_rising";
|
|
58
80
|
sun: "sun.sun";
|
|
59
81
|
switch:
|
|
60
82
|
| "switch.bedroom_lamp"
|
|
@@ -63,8 +85,9 @@ declare module "../user.mts" {
|
|
|
63
85
|
| "switch.porch_light";
|
|
64
86
|
text: "text.example";
|
|
65
87
|
time: "time.example";
|
|
66
|
-
todo: "todo.shopping_list";
|
|
88
|
+
todo: "todo.shopping_list" | "todo.test_todo";
|
|
67
89
|
tts: "tts.google_en_com";
|
|
90
|
+
unsupported: "unsupported.test";
|
|
68
91
|
zone: "zone.home";
|
|
69
92
|
}
|
|
70
93
|
|
|
@@ -90,7 +113,11 @@ declare module "../user.mts" {
|
|
|
90
113
|
| "switch.bedroom_lamp"
|
|
91
114
|
| "switch.kitchen_cabinets"
|
|
92
115
|
| "switch.living_room_mood_lights"
|
|
93
|
-
| "switch.porch_light"
|
|
116
|
+
| "switch.porch_light"
|
|
117
|
+
| "light.test_light"
|
|
118
|
+
| "todo.test_todo"
|
|
119
|
+
| "climate.test_climate"
|
|
120
|
+
| "unsupported.test";
|
|
94
121
|
_holiday: "calendar.united_states_tx";
|
|
95
122
|
}
|
|
96
123
|
|
|
@@ -113,7 +140,7 @@ declare module "../user.mts" {
|
|
|
113
140
|
_test: "switch.living_room_mood_lights";
|
|
114
141
|
_living_room: "switch.living_room_mood_lights";
|
|
115
142
|
_kitchen: "switch.kitchen_cabinets";
|
|
116
|
-
_bedroom: "switch.bedroom_lamp" | "light.bedroom_ceiling_fan";
|
|
143
|
+
_bedroom: "switch.bedroom_lamp" | "light.bedroom_ceiling_fan" | "light.bedroom_light";
|
|
117
144
|
}
|
|
118
145
|
|
|
119
146
|
export interface HassLabelMapping {
|
|
@@ -124,7 +151,11 @@ declare module "../user.mts" {
|
|
|
124
151
|
| "switch.bedroom_lamp"
|
|
125
152
|
| "switch.kitchen_cabinets"
|
|
126
153
|
| "switch.living_room_mood_lights"
|
|
127
|
-
| "switch.porch_light"
|
|
154
|
+
| "switch.porch_light"
|
|
155
|
+
| "light.test_light"
|
|
156
|
+
| "todo.test_todo"
|
|
157
|
+
| "climate.test_climate"
|
|
158
|
+
| "unsupported.test";
|
|
128
159
|
_test: never;
|
|
129
160
|
}
|
|
130
161
|
|
package/src/dev/registry.mts
CHANGED
|
@@ -393,5 +393,237 @@ declare module "../user.mts" {
|
|
|
393
393
|
entity_id: "zone.home";
|
|
394
394
|
state: "0";
|
|
395
395
|
};
|
|
396
|
+
"binary_sensor.bedroom_window": {
|
|
397
|
+
attributes: {
|
|
398
|
+
id: "digital_alchemy";
|
|
399
|
+
user_id: "4dd1cf7e93e94f3fbaf419501f9a3d59";
|
|
400
|
+
friendly_name: "Bedroom Window Sensor";
|
|
401
|
+
};
|
|
402
|
+
context: {
|
|
403
|
+
id: "01HWXTSCSBRKJ9T2KV1JNER5KQ";
|
|
404
|
+
parent_id: null;
|
|
405
|
+
user_id: null;
|
|
406
|
+
};
|
|
407
|
+
entity_id: "binary_sensor.bedroom_window";
|
|
408
|
+
state: "on";
|
|
409
|
+
};
|
|
410
|
+
"binary_sensor.garage_door": {
|
|
411
|
+
attributes: {
|
|
412
|
+
device_class: "door";
|
|
413
|
+
friendly_name: "Garage Door Sensor";
|
|
414
|
+
};
|
|
415
|
+
context: {
|
|
416
|
+
id: "05FGHIJKLMNO4PQR5STUV6789WX";
|
|
417
|
+
parent_id: null;
|
|
418
|
+
user_id: null;
|
|
419
|
+
};
|
|
420
|
+
entity_id: "binary_sensor.garage_door";
|
|
421
|
+
state: "off";
|
|
422
|
+
};
|
|
423
|
+
"climate.hallway_thermostat": {
|
|
424
|
+
attributes: {
|
|
425
|
+
current_temperature: 22;
|
|
426
|
+
target_temperature: 20;
|
|
427
|
+
hvac_mode: "cool";
|
|
428
|
+
friendly_name: "Hallway Thermostat";
|
|
429
|
+
supported_features: 1;
|
|
430
|
+
};
|
|
431
|
+
context: {
|
|
432
|
+
id: "04MNOPQRSTUV8WX9YZABCDE123";
|
|
433
|
+
parent_id: null;
|
|
434
|
+
user_id: null;
|
|
435
|
+
};
|
|
436
|
+
entity_id: "climate.hallway_thermostat";
|
|
437
|
+
state: "cool";
|
|
438
|
+
};
|
|
439
|
+
"climate.test_room": {
|
|
440
|
+
attributes: {
|
|
441
|
+
id: "digital_alchemy";
|
|
442
|
+
user_id: "4dd1cf7e93e94f3fbaf419501f9a3d59";
|
|
443
|
+
friendly_name: "Test Room Climate";
|
|
444
|
+
};
|
|
445
|
+
context: {
|
|
446
|
+
id: "01HWXTSCSBRKJ9T2KV1JNER5KQ";
|
|
447
|
+
parent_id: null;
|
|
448
|
+
user_id: null;
|
|
449
|
+
};
|
|
450
|
+
entity_id: "climate.test_room";
|
|
451
|
+
state: "cooling";
|
|
452
|
+
};
|
|
453
|
+
"light.bedroom_light": {
|
|
454
|
+
attributes: {
|
|
455
|
+
brightness: 255;
|
|
456
|
+
friendly_name: "Bedroom Light";
|
|
457
|
+
supported_features: 41;
|
|
458
|
+
};
|
|
459
|
+
context: {
|
|
460
|
+
id: "03UVWXYZABCDE123FGHI456JKL7";
|
|
461
|
+
parent_id: null;
|
|
462
|
+
user_id: null;
|
|
463
|
+
};
|
|
464
|
+
entity_id: "light.bedroom_light";
|
|
465
|
+
state: "on";
|
|
466
|
+
};
|
|
467
|
+
"light.kitchen_lamp": {
|
|
468
|
+
attributes: {
|
|
469
|
+
id: "digital_alchemy";
|
|
470
|
+
user_id: "4dd1cf7e93e94f3fbaf419501f9a3d59";
|
|
471
|
+
friendly_name: "Kitchen Lamp";
|
|
472
|
+
};
|
|
473
|
+
context: {
|
|
474
|
+
id: "01HWXTSCSBRKJ9T2KV1JNER5KQ";
|
|
475
|
+
parent_id: null;
|
|
476
|
+
user_id: null;
|
|
477
|
+
};
|
|
478
|
+
entity_id: "light.kitchen_lamp";
|
|
479
|
+
state: "off";
|
|
480
|
+
};
|
|
481
|
+
"sensor.bedroom_disabled_temp": {
|
|
482
|
+
attributes: {
|
|
483
|
+
id: "digital_alchemy";
|
|
484
|
+
user_id: "disabled_test_3";
|
|
485
|
+
friendly_name: "Bedroom Disabled Temp";
|
|
486
|
+
};
|
|
487
|
+
context: {
|
|
488
|
+
id: "ctx3";
|
|
489
|
+
parent_id: null;
|
|
490
|
+
user_id: null;
|
|
491
|
+
};
|
|
492
|
+
entity_id: "sensor.bedroom_disabled_temp";
|
|
493
|
+
state: "unknown";
|
|
494
|
+
};
|
|
495
|
+
"sensor.floor_test_disabled": {
|
|
496
|
+
attributes: {
|
|
497
|
+
id: "digital_alchemy";
|
|
498
|
+
user_id: "disabled_test_4";
|
|
499
|
+
friendly_name: "Floor Test Disabled";
|
|
500
|
+
};
|
|
501
|
+
context: {
|
|
502
|
+
id: "ctx4";
|
|
503
|
+
parent_id: null;
|
|
504
|
+
user_id: null;
|
|
505
|
+
};
|
|
506
|
+
entity_id: "sensor.floor_test_disabled";
|
|
507
|
+
state: "unknown";
|
|
508
|
+
};
|
|
509
|
+
"sensor.kitchen_disabled_temp": {
|
|
510
|
+
attributes: {
|
|
511
|
+
id: "digital_alchemy";
|
|
512
|
+
user_id: "disabled_test_2";
|
|
513
|
+
friendly_name: "Kitchen Disabled Temp";
|
|
514
|
+
};
|
|
515
|
+
context: {
|
|
516
|
+
id: "ctx2";
|
|
517
|
+
parent_id: null;
|
|
518
|
+
user_id: null;
|
|
519
|
+
};
|
|
520
|
+
entity_id: "sensor.kitchen_disabled_temp";
|
|
521
|
+
state: "unknown";
|
|
522
|
+
};
|
|
523
|
+
"sensor.label_test_disabled": {
|
|
524
|
+
attributes: {
|
|
525
|
+
id: "digital_alchemy";
|
|
526
|
+
user_id: "disabled_test_5";
|
|
527
|
+
friendly_name: "Label Test Disabled";
|
|
528
|
+
};
|
|
529
|
+
context: {
|
|
530
|
+
id: "ctx5";
|
|
531
|
+
parent_id: null;
|
|
532
|
+
user_id: null;
|
|
533
|
+
};
|
|
534
|
+
entity_id: "sensor.label_test_disabled";
|
|
535
|
+
state: "unknown";
|
|
536
|
+
};
|
|
537
|
+
"sensor.living_room_disabled_temp": {
|
|
538
|
+
attributes: {
|
|
539
|
+
id: "digital_alchemy";
|
|
540
|
+
user_id: "disabled_test_1";
|
|
541
|
+
friendly_name: "Living Room Disabled Temp";
|
|
542
|
+
};
|
|
543
|
+
context: {
|
|
544
|
+
id: "ctx1";
|
|
545
|
+
parent_id: null;
|
|
546
|
+
user_id: null;
|
|
547
|
+
};
|
|
548
|
+
entity_id: "sensor.living_room_disabled_temp";
|
|
549
|
+
state: "unknown";
|
|
550
|
+
};
|
|
551
|
+
"sensor.living_room_temperature": {
|
|
552
|
+
attributes: {
|
|
553
|
+
id: "digital_alchemy";
|
|
554
|
+
user_id: "4dd1cf7e93e94f3fbaf419501f9a3d59";
|
|
555
|
+
friendly_name: "Living Room Temperature";
|
|
556
|
+
};
|
|
557
|
+
context: {
|
|
558
|
+
id: "01HWXTSCSBRKJ9T2KV1JNER5KQ";
|
|
559
|
+
parent_id: null;
|
|
560
|
+
user_id: null;
|
|
561
|
+
};
|
|
562
|
+
entity_id: "sensor.living_room_temperature";
|
|
563
|
+
state: "unavailable";
|
|
564
|
+
};
|
|
565
|
+
"sensor.sun_solar_azimuth": {
|
|
566
|
+
attributes: {
|
|
567
|
+
device_class: "angle";
|
|
568
|
+
friendly_name: "Sun Solar azimuth";
|
|
569
|
+
unit_of_measurement: "°";
|
|
570
|
+
};
|
|
571
|
+
context: {
|
|
572
|
+
id: "01HWXTS8W2MMADKGWE4A5BMH51";
|
|
573
|
+
parent_id: null;
|
|
574
|
+
user_id: null;
|
|
575
|
+
};
|
|
576
|
+
entity_id: "sensor.sun_solar_azimuth";
|
|
577
|
+
state: "0.35";
|
|
578
|
+
};
|
|
579
|
+
"sensor.sun_solar_elevation": {
|
|
580
|
+
attributes: {
|
|
581
|
+
device_class: "angle";
|
|
582
|
+
friendly_name: "Sun Solar elevation";
|
|
583
|
+
unit_of_measurement: "°";
|
|
584
|
+
};
|
|
585
|
+
context: {
|
|
586
|
+
id: "01HWXTS8W1J2TDGMN7KKNWP8DV";
|
|
587
|
+
parent_id: null;
|
|
588
|
+
user_id: null;
|
|
589
|
+
};
|
|
590
|
+
entity_id: "sensor.sun_solar_elevation";
|
|
591
|
+
state: "-21.86";
|
|
592
|
+
};
|
|
593
|
+
"sensor.sun_solar_rising": {
|
|
594
|
+
attributes: {
|
|
595
|
+
device_class: "timestamp";
|
|
596
|
+
friendly_name: "Sun Solar rising";
|
|
597
|
+
};
|
|
598
|
+
context: {
|
|
599
|
+
id: "01HWXTS8W2MMADKGWE4A5BMH51";
|
|
600
|
+
parent_id: null;
|
|
601
|
+
user_id: null;
|
|
602
|
+
};
|
|
603
|
+
entity_id: "sensor.sun_solar_rising";
|
|
604
|
+
state: "2024-05-03T04:05:17+00:00";
|
|
605
|
+
};
|
|
606
|
+
"light.test_light": {
|
|
607
|
+
attributes: { supported_features: 44 };
|
|
608
|
+
entity_id: "light.test_light";
|
|
609
|
+
state: "on";
|
|
610
|
+
};
|
|
611
|
+
"todo.test_todo": {
|
|
612
|
+
attributes: {
|
|
613
|
+
supported_features: 15;
|
|
614
|
+
};
|
|
615
|
+
entity_id: "todo.test_todo";
|
|
616
|
+
state: "0";
|
|
617
|
+
};
|
|
618
|
+
"climate.test_climate": {
|
|
619
|
+
attributes: { supported_features: 1 };
|
|
620
|
+
entity_id: "climate.test_climate";
|
|
621
|
+
state: "cool";
|
|
622
|
+
};
|
|
623
|
+
"unsupported.test": {
|
|
624
|
+
attributes: { supported_features: 1 };
|
|
625
|
+
entity_id: "unsupported.test";
|
|
626
|
+
state: "on";
|
|
627
|
+
};
|
|
396
628
|
}
|
|
397
629
|
}
|
package/src/hass.module.mts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
FetchInternals,
|
|
13
13
|
Floor,
|
|
14
14
|
HassDiagnosticsService,
|
|
15
|
+
HassFeatureService,
|
|
15
16
|
IDByExtension,
|
|
16
17
|
Label,
|
|
17
18
|
ReferenceService,
|
|
@@ -189,6 +190,11 @@ export const LIB_HASS = CreateLibrary({
|
|
|
189
190
|
*/
|
|
190
191
|
events: EventsService,
|
|
191
192
|
|
|
193
|
+
/**
|
|
194
|
+
* feature flag checking for entities
|
|
195
|
+
*/
|
|
196
|
+
feature: HassFeatureService,
|
|
197
|
+
|
|
192
198
|
/**
|
|
193
199
|
* rest api commands
|
|
194
200
|
*/
|
|
@@ -198,8 +198,9 @@ export interface ServiceListFilter {
|
|
|
198
198
|
supported_features?: number[];
|
|
199
199
|
supported_color_modes?: LiteralUnion<`${ColorMode}`, string>[];
|
|
200
200
|
}
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
export interface ServiceListFieldDescription<
|
|
202
|
+
TYPE extends keyof ServiceListSelector = keyof ServiceListSelector,
|
|
203
|
+
> {
|
|
203
204
|
fields?: Record<string, ServiceListFieldDescription>;
|
|
204
205
|
target?: ServiceListServiceTarget;
|
|
205
206
|
response?: ResponseOptional;
|
|
@@ -210,12 +211,19 @@ export interface ServiceListFieldDescription {
|
|
|
210
211
|
filter?: ServiceListFilter;
|
|
211
212
|
name?: string;
|
|
212
213
|
required?: boolean;
|
|
213
|
-
|
|
214
|
+
/**
|
|
215
|
+
* The `selector` field is a discriminated union that ensures only one key of `ServiceListSelector`
|
|
216
|
+
* can be present at a time. This mapped type enforces mutual exclusivity at the type level,
|
|
217
|
+
* so that only a single selector type is allowed for each field description.
|
|
218
|
+
*/
|
|
219
|
+
selector?: {
|
|
220
|
+
[K in TYPE]: { [P in K]: ServiceListSelector[P] } & { [P in Exclude<TYPE, K>]?: never };
|
|
221
|
+
}[TYPE];
|
|
214
222
|
}
|
|
215
223
|
|
|
216
224
|
export interface ServiceListServiceTarget {
|
|
217
|
-
entity?: EntityFilterSelector[];
|
|
218
|
-
device?: DeviceFilterSelector[];
|
|
225
|
+
entity?: EntityFilterSelector | EntityFilterSelector[];
|
|
226
|
+
device?: DeviceFilterSelector | DeviceFilterSelector[];
|
|
219
227
|
}
|
|
220
228
|
|
|
221
229
|
export interface ServiceListField {
|
package/src/helpers/index.mts
CHANGED