@digital-alchemy/hass 25.10.19-beta.0 → 25.10.21-beta.0

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.
@@ -1,52 +1,187 @@
1
1
  import type { LiteralUnion } from "type-fest";
2
- import type { ALL_DOMAINS, TPlatformId } from "../../user.mts";
2
+ import type { ALL_DOMAINS, PICK_ENTITY, TPlatformId } from "../../user.mts";
3
3
  import type { ColorMode } from "../features.mts";
4
- export interface ServiceListSelectorTarget {
5
- domain?: ALL_DOMAINS;
4
+ export type EntityFilterSelector = {
6
5
  integration?: TPlatformId;
7
- multiple?: boolean;
8
- }
6
+ domain?: ALL_DOMAINS | ALL_DOMAINS[];
7
+ device_class?: string | string[];
8
+ supported_features?: string | string[];
9
+ };
10
+ export type DeviceFilterSelector = {
11
+ integration?: TPlatformId;
12
+ manufacturer?: string;
13
+ model?: string;
14
+ model_id?: string;
15
+ };
16
+ export type LegacyEntitySelector = {
17
+ integration?: TPlatformId;
18
+ domain?: ALL_DOMAINS | ALL_DOMAINS[];
19
+ device_class?: string | string[];
20
+ supported_features?: string | string[];
21
+ };
22
+ export type LegacyDeviceSelector = {
23
+ integration?: TPlatformId;
24
+ manufacturer?: string;
25
+ model?: string;
26
+ };
9
27
  export interface ServiceListSelector {
10
- addon?: null;
11
- backup_location?: null;
12
- boolean?: null;
13
- color_rgb?: null;
14
- color_temp?: {
15
- unit: "kelvin";
16
- min: number;
17
- max: number;
18
- };
19
- conversation_agent?: null;
20
- date?: null;
21
- datetime?: null;
22
- entity?: ServiceListSelectorTarget;
23
- icon?: null;
24
- number?: {
25
- max: number;
26
- min: number;
27
- mode?: string;
28
- step?: number;
29
- unit_of_measurement: string;
30
- };
31
- object?: null;
32
- select?: {
28
+ action: null;
29
+ addon: {
30
+ name?: string;
31
+ slug?: string;
32
+ };
33
+ area: {
34
+ device?: DeviceFilterSelector | DeviceFilterSelector[];
35
+ entity?: EntityFilterSelector | EntityFilterSelector[];
36
+ multiple?: boolean;
37
+ };
38
+ attribute: {
39
+ entity_id?: PICK_ENTITY;
40
+ hide_attributes?: string[];
41
+ };
42
+ assist_pipeline: null;
43
+ backup_location: null;
44
+ boolean: null;
45
+ color_rgb: null;
46
+ color_temp: {
47
+ unit?: "kelvin" | "mired";
48
+ min?: number;
49
+ max?: number;
50
+ max_mireds?: number;
51
+ min_mireds?: number;
52
+ };
53
+ condition: null;
54
+ config_entry: {
55
+ integration: TPlatformId;
56
+ };
57
+ constant: {
58
+ label?: string;
59
+ value: string | number | boolean;
60
+ translation_key?: string;
61
+ };
62
+ conversation_agent: {
63
+ language?: string;
64
+ };
65
+ country: {
66
+ countries?: string | string[];
67
+ no_sort?: boolean;
68
+ };
69
+ date: null;
70
+ datetime: null;
71
+ device: LegacyDeviceSelector & {
72
+ multiple?: boolean;
73
+ filter?: DeviceFilterSelector | DeviceFilterSelector[];
74
+ entity?: EntityFilterSelector | EntityFilterSelector[];
75
+ };
76
+ duration: {
77
+ enable_day?: boolean;
78
+ enable_millisecond?: boolean;
79
+ allow_negative?: boolean;
80
+ };
81
+ entity: LegacyEntitySelector & {
82
+ exclude_entities?: PICK_ENTITY | PICK_ENTITY[];
83
+ include_entities?: PICK_ENTITY | PICK_ENTITY[];
84
+ multiple?: boolean;
85
+ reorder?: boolean;
86
+ filter?: EntityFilterSelector | EntityFilterSelector[];
87
+ };
88
+ file: {
89
+ accept: string;
90
+ };
91
+ floor: {
92
+ entity?: EntityFilterSelector | EntityFilterSelector[];
93
+ device?: DeviceFilterSelector | DeviceFilterSelector[];
94
+ multiple?: boolean;
95
+ };
96
+ icon: {
97
+ placeholder?: string;
98
+ };
99
+ label: {
100
+ multiple?: boolean;
101
+ };
102
+ language: {
103
+ languages?: string | string[];
104
+ native_name?: boolean;
105
+ no_sort?: boolean;
106
+ };
107
+ location: {
108
+ radius?: boolean;
109
+ icon?: string;
110
+ };
111
+ media: {
112
+ accept?: string | string[];
113
+ };
114
+ number: {
115
+ min?: number;
116
+ max?: number;
117
+ mode?: "box" | "slider";
118
+ translation_key?: string;
119
+ step?: number | "any";
120
+ unit_of_measurement?: string;
121
+ };
122
+ object: {
123
+ fields?: Record<string, {
124
+ selector: ServiceListSelector;
125
+ required?: boolean;
126
+ label?: string;
127
+ }>;
128
+ multiple?: boolean;
129
+ label_field?: string;
130
+ description_field?: string;
131
+ translation_key?: string;
132
+ };
133
+ qr_code: {
134
+ data: string;
135
+ scale?: number;
136
+ error_correction_level?: "L" | "M" | "Q" | "H";
137
+ };
138
+ select: {
139
+ options: (string | {
140
+ label: string;
141
+ value: string;
142
+ })[];
143
+ multiple?: boolean;
33
144
  custom_value?: boolean;
145
+ mode?: "dropdown" | "list";
146
+ translation_key?: string;
147
+ sort?: boolean;
148
+ };
149
+ state: {
150
+ entity_id?: PICK_ENTITY;
151
+ multiple?: boolean;
152
+ hide_states?: string[];
153
+ };
154
+ statistic: {
34
155
  multiple?: boolean;
35
- options: Record<"label" | "value", string>[] | string[];
36
156
  };
37
- text?: null | {
38
- type: "password";
157
+ target: {
158
+ entity?: EntityFilterSelector | EntityFilterSelector[];
159
+ device?: DeviceFilterSelector | DeviceFilterSelector[];
39
160
  };
40
- theme?: {
161
+ template: null;
162
+ text: {
163
+ type?: "color" | "date" | "datetime-local" | "email" | "month" | "number" | "password" | "search" | "tel" | "text" | "time" | "url" | "week";
164
+ autocomplete?: string;
165
+ multiline?: boolean;
166
+ prefix?: string;
167
+ suffix?: string;
168
+ multiple?: boolean;
169
+ };
170
+ theme: {
41
171
  include_defaults?: boolean;
42
172
  };
43
- time?: null;
173
+ time: null;
174
+ trigger: null;
44
175
  }
45
176
  export interface ServiceListFilter {
177
+ attribute?: Record<string, string[]>;
46
178
  supported_features?: number[];
47
179
  supported_color_modes?: LiteralUnion<`${ColorMode}`, string>[];
48
180
  }
49
181
  export interface ServiceListFieldDescription {
182
+ fields?: Record<string, ServiceListFieldDescription>;
183
+ target?: ServiceListServiceTarget;
184
+ response?: ResponseOptional;
50
185
  advanced?: boolean;
51
186
  default?: unknown;
52
187
  description?: string;
@@ -56,21 +191,13 @@ export interface ServiceListFieldDescription {
56
191
  required?: boolean;
57
192
  selector?: ServiceListSelector;
58
193
  }
59
- export type ServiceListEntityTarget = {
60
- domain?: ALL_DOMAINS[];
61
- integration?: TPlatformId;
62
- supported_features?: number[];
63
- };
64
194
  export interface ServiceListServiceTarget {
65
- device?: {
66
- integration?: string;
67
- };
68
- entity?: ServiceListEntityTarget[];
69
- integration?: string;
195
+ entity?: EntityFilterSelector[];
196
+ device?: DeviceFilterSelector[];
70
197
  }
71
198
  export interface ServiceListField {
72
199
  description?: string;
73
- fields: Record<string, ServiceListFieldDescription>;
200
+ fields?: Record<string, ServiceListFieldDescription>;
74
201
  name?: string;
75
202
  target?: ServiceListServiceTarget;
76
203
  response?: ResponseOptional;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "@digital-alchemy/hass",
4
4
  "repository": "https://github.com/Digital-Alchemy-TS/hass",
5
5
  "homepage": "https://docs.digital-alchemy.app",
6
- "version": "25.10.19-beta.0",
6
+ "version": "25.10.21-beta.0",
7
7
  "description": "Typescript APIs for Home Assistant. Includes rest & websocket bindings",
8
8
  "scripts": {
9
9
  "build": "rm -rf dist/; tsc",
@@ -1,49 +1,208 @@
1
1
  import type { LiteralUnion } from "type-fest";
2
2
 
3
- import type { ALL_DOMAINS, TPlatformId } from "../../user.mts";
3
+ import type { ALL_DOMAINS, PICK_ENTITY, TPlatformId } from "../../user.mts";
4
4
  import type { ColorMode } from "../features.mts";
5
5
 
6
- export interface ServiceListSelectorTarget {
7
- domain?: ALL_DOMAINS;
6
+ export type EntityFilterSelector = {
8
7
  integration?: TPlatformId;
9
- multiple?: boolean;
10
- }
8
+ domain?: ALL_DOMAINS | ALL_DOMAINS[];
9
+ device_class?: string | string[];
10
+ supported_features?: string | string[];
11
+ };
12
+
13
+ export type DeviceFilterSelector = {
14
+ integration?: TPlatformId;
15
+ manufacturer?: string;
16
+ model?: string;
17
+ model_id?: string;
18
+ };
19
+
20
+ export type LegacyEntitySelector = {
21
+ integration?: TPlatformId;
22
+ domain?: ALL_DOMAINS | ALL_DOMAINS[];
23
+ device_class?: string | string[];
24
+ supported_features?: string | string[];
25
+ };
26
+
27
+ export type LegacyDeviceSelector = {
28
+ integration?: TPlatformId;
29
+ manufacturer?: string;
30
+ model?: string;
31
+ };
11
32
 
12
33
  export interface ServiceListSelector {
13
- addon?: null;
14
- backup_location?: null;
15
- boolean?: null;
16
- color_rgb?: null;
17
- color_temp?: { unit: "kelvin"; min: number; max: number };
18
- conversation_agent?: null;
19
- date?: null;
20
- datetime?: null;
21
- entity?: ServiceListSelectorTarget;
22
- icon?: null;
23
- number?: {
24
- max: number;
25
- min: number;
26
- mode?: string;
27
- step?: number;
28
- unit_of_measurement: string;
29
- };
30
- object?: null;
31
- select?: {
34
+ action: null;
35
+ addon: {
36
+ name?: string;
37
+ slug?: string;
38
+ };
39
+ area: {
40
+ device?: DeviceFilterSelector | DeviceFilterSelector[];
41
+ entity?: EntityFilterSelector | EntityFilterSelector[];
42
+ multiple?: boolean;
43
+ };
44
+ attribute: {
45
+ entity_id?: PICK_ENTITY;
46
+ hide_attributes?: string[];
47
+ };
48
+ assist_pipeline: null;
49
+ backup_location: null;
50
+ boolean: null;
51
+ color_rgb: null;
52
+ color_temp: {
53
+ unit?: "kelvin" | "mired";
54
+ min?: number;
55
+ max?: number;
56
+ max_mireds?: number;
57
+ min_mireds?: number;
58
+ };
59
+ condition: null;
60
+ config_entry: {
61
+ integration: TPlatformId;
62
+ };
63
+ constant: {
64
+ label?: string;
65
+ value: string | number | boolean;
66
+ translation_key?: string;
67
+ };
68
+ conversation_agent: {
69
+ language?: string;
70
+ };
71
+ country: {
72
+ countries?: string | string[];
73
+ no_sort?: boolean;
74
+ };
75
+ date: null;
76
+ datetime: null;
77
+ device: LegacyDeviceSelector & {
78
+ multiple?: boolean;
79
+ filter?: DeviceFilterSelector | DeviceFilterSelector[];
80
+ entity?: EntityFilterSelector | EntityFilterSelector[];
81
+ };
82
+ duration: {
83
+ enable_day?: boolean;
84
+ enable_millisecond?: boolean;
85
+ allow_negative?: boolean;
86
+ };
87
+ entity: LegacyEntitySelector & {
88
+ exclude_entities?: PICK_ENTITY | PICK_ENTITY[];
89
+ include_entities?: PICK_ENTITY | PICK_ENTITY[];
90
+ multiple?: boolean;
91
+ reorder?: boolean;
92
+ filter?: EntityFilterSelector | EntityFilterSelector[];
93
+ };
94
+ file: {
95
+ accept: string;
96
+ };
97
+ floor: {
98
+ entity?: EntityFilterSelector | EntityFilterSelector[];
99
+ device?: DeviceFilterSelector | DeviceFilterSelector[];
100
+ multiple?: boolean;
101
+ };
102
+ icon: {
103
+ placeholder?: string;
104
+ };
105
+ label: {
106
+ multiple?: boolean;
107
+ };
108
+ language: {
109
+ languages?: string | string[];
110
+ native_name?: boolean;
111
+ no_sort?: boolean;
112
+ };
113
+ location: {
114
+ radius?: boolean;
115
+ icon?: string;
116
+ };
117
+ media: {
118
+ accept?: string | string[];
119
+ };
120
+ number: {
121
+ min?: number;
122
+ max?: number;
123
+ mode?: "box" | "slider";
124
+ translation_key?: string;
125
+ step?: number | "any";
126
+ unit_of_measurement?: string;
127
+ };
128
+ object: {
129
+ fields?: Record<
130
+ string,
131
+ {
132
+ selector: ServiceListSelector;
133
+ required?: boolean;
134
+ label?: string;
135
+ }
136
+ >;
137
+ multiple?: boolean;
138
+ label_field?: string;
139
+ description_field?: string;
140
+ translation_key?: string;
141
+ };
142
+ qr_code: {
143
+ data: string;
144
+ scale?: number;
145
+ error_correction_level?: "L" | "M" | "Q" | "H";
146
+ };
147
+ select: {
148
+ options: (string | { label: string; value: string })[];
149
+ multiple?: boolean;
32
150
  custom_value?: boolean;
151
+ mode?: "dropdown" | "list";
152
+ translation_key?: string;
153
+ sort?: boolean;
154
+ };
155
+ state: {
156
+ entity_id?: PICK_ENTITY;
157
+ multiple?: boolean;
158
+ hide_states?: string[];
159
+ };
160
+ statistic: {
33
161
  multiple?: boolean;
34
- options: Record<"label" | "value", string>[] | string[];
35
162
  };
36
- text?: null | { type: "password" };
37
- theme?: { include_defaults?: boolean };
38
- time?: null;
163
+ target: {
164
+ entity?: EntityFilterSelector | EntityFilterSelector[];
165
+ device?: DeviceFilterSelector | DeviceFilterSelector[];
166
+ };
167
+ template: null;
168
+ text: {
169
+ type?:
170
+ | "color"
171
+ | "date"
172
+ | "datetime-local"
173
+ | "email"
174
+ | "month"
175
+ | "number"
176
+ | "password"
177
+ | "search"
178
+ | "tel"
179
+ | "text"
180
+ | "time"
181
+ | "url"
182
+ | "week";
183
+ autocomplete?: string;
184
+ multiline?: boolean;
185
+ prefix?: string;
186
+ suffix?: string;
187
+ multiple?: boolean;
188
+ };
189
+ theme: {
190
+ include_defaults?: boolean;
191
+ };
192
+ time: null;
193
+ trigger: null;
39
194
  }
40
195
 
41
196
  export interface ServiceListFilter {
197
+ attribute?: Record<string, string[]>;
42
198
  supported_features?: number[];
43
199
  supported_color_modes?: LiteralUnion<`${ColorMode}`, string>[];
44
200
  }
45
201
 
46
202
  export interface ServiceListFieldDescription {
203
+ fields?: Record<string, ServiceListFieldDescription>;
204
+ target?: ServiceListServiceTarget;
205
+ response?: ResponseOptional;
47
206
  advanced?: boolean;
48
207
  default?: unknown;
49
208
  description?: string;
@@ -54,21 +213,14 @@ export interface ServiceListFieldDescription {
54
213
  selector?: ServiceListSelector;
55
214
  }
56
215
 
57
- export type ServiceListEntityTarget = {
58
- domain?: ALL_DOMAINS[];
59
- integration?: TPlatformId;
60
- supported_features?: number[];
61
- };
62
-
63
216
  export interface ServiceListServiceTarget {
64
- device?: { integration?: string };
65
- entity?: ServiceListEntityTarget[];
66
- integration?: string;
217
+ entity?: EntityFilterSelector[];
218
+ device?: DeviceFilterSelector[];
67
219
  }
68
220
 
69
221
  export interface ServiceListField {
70
222
  description?: string;
71
- fields: Record<string, ServiceListFieldDescription>;
223
+ fields?: Record<string, ServiceListFieldDescription>;
72
224
  name?: string;
73
225
  target?: ServiceListServiceTarget;
74
226
  response?: ResponseOptional;