@m1kad0/hannah-proto 0.3.9 → 0.4.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.
package/dist/agent.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { EnumValues, StateType } from "./shared";
2
3
  export declare const protobufPackage = "hannah";
3
4
  export declare enum ResidentType {
4
5
  RESIDENT_TYPE_UNSPECIFIED = 0,
@@ -211,6 +212,10 @@ export interface AgentDevice {
211
212
  roomNames: {
212
213
  [key: string]: string;
213
214
  };
215
+ /** derived from ioBroker's common.type/role/states */
216
+ stateType: StateType;
217
+ /** only set when state_type is ENUM or COLOR */
218
+ enumValues: EnumValues | undefined;
214
219
  }
215
220
  export interface AgentDevice_RoomNamesEntry {
216
221
  key: string;
package/dist/agent.js CHANGED
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.AgentSensorUpdate = exports.AgentBleUpdate = exports.AgentResidentAnswered = exports.AgentAskResident = exports.AgentResidentSnapshot = exports.AgentResident = exports.AgentRoomSnapshot = exports.AgentRoom_DisplayNamesEntry = exports.AgentRoom = exports.AgentDeviceSnapshot = exports.AgentDevice_RoomNamesEntry = exports.AgentDevice = exports.AgentStateValue = exports.AgentNotification = exports.AgentTextAnswer = exports.AgentSatelliteDeleted = exports.AgentSatelliteUpdate = exports.AgentSetResidentMood = exports.AgentSetResident = exports.AgentWatchMore = exports.AgentSetState = exports.AgentFirmwareEvent = exports.AgentCommand = exports.AgentTextCommand = exports.AgentStateUpdate = exports.AgentSatelliteControl = exports.AgentMessage = exports.ResidentType = exports.protobufPackage = void 0;
9
9
  /* eslint-disable */
10
10
  const wire_1 = require("@bufbuild/protobuf/wire");
11
+ const shared_1 = require("./shared");
11
12
  exports.protobufPackage = "hannah";
12
13
  var ResidentType;
13
14
  (function (ResidentType) {
@@ -1208,6 +1209,8 @@ function createBaseAgentDevice() {
1208
1209
  functions: [],
1209
1210
  value: undefined,
1210
1211
  roomNames: {},
1212
+ stateType: 0,
1213
+ enumValues: undefined,
1211
1214
  };
1212
1215
  }
1213
1216
  exports.AgentDevice = {
@@ -1236,6 +1239,12 @@ exports.AgentDevice = {
1236
1239
  globalThis.Object.entries(message.roomNames).forEach(([key, value]) => {
1237
1240
  exports.AgentDevice_RoomNamesEntry.encode({ key: key, value }, writer.uint32(66).fork()).join();
1238
1241
  });
1242
+ if (message.stateType !== 0) {
1243
+ writer.uint32(72).int32(message.stateType);
1244
+ }
1245
+ if (message.enumValues !== undefined) {
1246
+ shared_1.EnumValues.encode(message.enumValues, writer.uint32(82).fork()).join();
1247
+ }
1239
1248
  return writer;
1240
1249
  },
1241
1250
  decode(input, length) {
@@ -1304,6 +1313,20 @@ exports.AgentDevice = {
1304
1313
  }
1305
1314
  continue;
1306
1315
  }
1316
+ case 9: {
1317
+ if (tag !== 72) {
1318
+ break;
1319
+ }
1320
+ message.stateType = reader.int32();
1321
+ continue;
1322
+ }
1323
+ case 10: {
1324
+ if (tag !== 82) {
1325
+ break;
1326
+ }
1327
+ message.enumValues = shared_1.EnumValues.decode(reader, reader.uint32());
1328
+ continue;
1329
+ }
1307
1330
  }
1308
1331
  if ((tag & 7) === 4 || tag === 0) {
1309
1332
  break;
@@ -1332,6 +1355,10 @@ exports.AgentDevice = {
1332
1355
  }
1333
1356
  return acc;
1334
1357
  }, {});
1358
+ message.stateType = object.stateType ?? 0;
1359
+ message.enumValues = (object.enumValues !== undefined && object.enumValues !== null)
1360
+ ? shared_1.EnumValues.fromPartial(object.enumValues)
1361
+ : undefined;
1335
1362
  return message;
1336
1363
  },
1337
1364
  };
@@ -1,4 +1,5 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { EnumValues, StateType } from "./shared";
2
3
  export declare const protobufPackage = "hannah";
3
4
  export interface DeviceInfo {
4
5
  /** full device prefix, e.g. "javascript.0.virtualDevice.Licht.EG.Wohnzimmer.DeckeSeite" */
@@ -13,11 +14,27 @@ export interface DeviceInfo {
13
14
  current: {
14
15
  [key: string]: string;
15
16
  };
17
+ /** canon-key -> type, e.g. {"on": BOOLEAN, "level": NUMERIC} */
18
+ stateTypes: {
19
+ [key: string]: StateType;
20
+ };
21
+ /** canon-key -> allowed values, only present for ENUM/COLOR states */
22
+ stateEnumValues: {
23
+ [key: string]: EnumValues;
24
+ };
16
25
  }
17
26
  export interface DeviceInfo_CurrentEntry {
18
27
  key: string;
19
28
  value: string;
20
29
  }
30
+ export interface DeviceInfo_StateTypesEntry {
31
+ key: string;
32
+ value: StateType;
33
+ }
34
+ export interface DeviceInfo_StateEnumValuesEntry {
35
+ key: string;
36
+ value: EnumValues | undefined;
37
+ }
21
38
  export interface RoomInfo {
22
39
  /** room_id (lowercase), e.g. "wohnzimmer" */
23
40
  key: string;
@@ -38,6 +55,8 @@ export interface ControlDeviceRequest {
38
55
  }
39
56
  export declare const DeviceInfo: MessageFns<DeviceInfo>;
40
57
  export declare const DeviceInfo_CurrentEntry: MessageFns<DeviceInfo_CurrentEntry>;
58
+ export declare const DeviceInfo_StateTypesEntry: MessageFns<DeviceInfo_StateTypesEntry>;
59
+ export declare const DeviceInfo_StateEnumValuesEntry: MessageFns<DeviceInfo_StateEnumValuesEntry>;
41
60
  export declare const RoomInfo: MessageFns<RoomInfo>;
42
61
  export declare const GetDevicesResponse: MessageFns<GetDevicesResponse>;
43
62
  export declare const ControlDeviceRequest: MessageFns<ControlDeviceRequest>;
@@ -5,12 +5,13 @@
5
5
  // protoc unknown
6
6
  // source: device_control_menu.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ControlDeviceRequest = exports.GetDevicesResponse = exports.RoomInfo = exports.DeviceInfo_CurrentEntry = exports.DeviceInfo = exports.protobufPackage = void 0;
8
+ exports.ControlDeviceRequest = exports.GetDevicesResponse = exports.RoomInfo = exports.DeviceInfo_StateEnumValuesEntry = exports.DeviceInfo_StateTypesEntry = exports.DeviceInfo_CurrentEntry = exports.DeviceInfo = exports.protobufPackage = void 0;
9
9
  /* eslint-disable */
10
10
  const wire_1 = require("@bufbuild/protobuf/wire");
11
+ const shared_1 = require("./shared");
11
12
  exports.protobufPackage = "hannah";
12
13
  function createBaseDeviceInfo() {
13
- return { id: "", name: "", category: "", states: [], current: {} };
14
+ return { id: "", name: "", category: "", states: [], current: {}, stateTypes: {}, stateEnumValues: {} };
14
15
  }
15
16
  exports.DeviceInfo = {
16
17
  encode(message, writer = new wire_1.BinaryWriter()) {
@@ -29,6 +30,12 @@ exports.DeviceInfo = {
29
30
  globalThis.Object.entries(message.current).forEach(([key, value]) => {
30
31
  exports.DeviceInfo_CurrentEntry.encode({ key: key, value }, writer.uint32(42).fork()).join();
31
32
  });
33
+ globalThis.Object.entries(message.stateTypes).forEach(([key, value]) => {
34
+ exports.DeviceInfo_StateTypesEntry.encode({ key: key, value }, writer.uint32(50).fork()).join();
35
+ });
36
+ globalThis.Object.entries(message.stateEnumValues).forEach(([key, value]) => {
37
+ exports.DeviceInfo_StateEnumValuesEntry.encode({ key: key, value }, writer.uint32(58).fork()).join();
38
+ });
32
39
  return writer;
33
40
  },
34
41
  decode(input, length) {
@@ -76,6 +83,26 @@ exports.DeviceInfo = {
76
83
  }
77
84
  continue;
78
85
  }
86
+ case 6: {
87
+ if (tag !== 50) {
88
+ break;
89
+ }
90
+ const entry6 = exports.DeviceInfo_StateTypesEntry.decode(reader, reader.uint32());
91
+ if (entry6.value !== undefined) {
92
+ message.stateTypes[entry6.key] = entry6.value;
93
+ }
94
+ continue;
95
+ }
96
+ case 7: {
97
+ if (tag !== 58) {
98
+ break;
99
+ }
100
+ const entry7 = exports.DeviceInfo_StateEnumValuesEntry.decode(reader, reader.uint32());
101
+ if (entry7.value !== undefined) {
102
+ message.stateEnumValues[entry7.key] = entry7.value;
103
+ }
104
+ continue;
105
+ }
79
106
  }
80
107
  if ((tag & 7) === 4 || tag === 0) {
81
108
  break;
@@ -99,6 +126,19 @@ exports.DeviceInfo = {
99
126
  }
100
127
  return acc;
101
128
  }, {});
129
+ message.stateTypes = globalThis.Object.entries(object.stateTypes ?? {}).reduce((acc, [key, value]) => {
130
+ if (value !== undefined) {
131
+ acc[key] = value;
132
+ }
133
+ return acc;
134
+ }, {});
135
+ message.stateEnumValues = globalThis.Object.entries(object.stateEnumValues ?? {})
136
+ .reduce((acc, [key, value]) => {
137
+ if (value !== undefined) {
138
+ acc[key] = shared_1.EnumValues.fromPartial(value);
139
+ }
140
+ return acc;
141
+ }, {});
102
142
  return message;
103
143
  },
104
144
  };
@@ -154,6 +194,112 @@ exports.DeviceInfo_CurrentEntry = {
154
194
  return message;
155
195
  },
156
196
  };
197
+ function createBaseDeviceInfo_StateTypesEntry() {
198
+ return { key: "", value: 0 };
199
+ }
200
+ exports.DeviceInfo_StateTypesEntry = {
201
+ encode(message, writer = new wire_1.BinaryWriter()) {
202
+ if (message.key !== "") {
203
+ writer.uint32(10).string(message.key);
204
+ }
205
+ if (message.value !== 0) {
206
+ writer.uint32(16).int32(message.value);
207
+ }
208
+ return writer;
209
+ },
210
+ decode(input, length) {
211
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
212
+ const end = length === undefined ? reader.len : reader.pos + length;
213
+ const message = createBaseDeviceInfo_StateTypesEntry();
214
+ while (reader.pos < end) {
215
+ const tag = reader.uint32();
216
+ switch (tag >>> 3) {
217
+ case 1: {
218
+ if (tag !== 10) {
219
+ break;
220
+ }
221
+ message.key = reader.string();
222
+ continue;
223
+ }
224
+ case 2: {
225
+ if (tag !== 16) {
226
+ break;
227
+ }
228
+ message.value = reader.int32();
229
+ continue;
230
+ }
231
+ }
232
+ if ((tag & 7) === 4 || tag === 0) {
233
+ break;
234
+ }
235
+ reader.skip(tag & 7);
236
+ }
237
+ return message;
238
+ },
239
+ create(base) {
240
+ return exports.DeviceInfo_StateTypesEntry.fromPartial(base ?? {});
241
+ },
242
+ fromPartial(object) {
243
+ const message = createBaseDeviceInfo_StateTypesEntry();
244
+ message.key = object.key ?? "";
245
+ message.value = object.value ?? 0;
246
+ return message;
247
+ },
248
+ };
249
+ function createBaseDeviceInfo_StateEnumValuesEntry() {
250
+ return { key: "", value: undefined };
251
+ }
252
+ exports.DeviceInfo_StateEnumValuesEntry = {
253
+ encode(message, writer = new wire_1.BinaryWriter()) {
254
+ if (message.key !== "") {
255
+ writer.uint32(10).string(message.key);
256
+ }
257
+ if (message.value !== undefined) {
258
+ shared_1.EnumValues.encode(message.value, writer.uint32(18).fork()).join();
259
+ }
260
+ return writer;
261
+ },
262
+ decode(input, length) {
263
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
264
+ const end = length === undefined ? reader.len : reader.pos + length;
265
+ const message = createBaseDeviceInfo_StateEnumValuesEntry();
266
+ while (reader.pos < end) {
267
+ const tag = reader.uint32();
268
+ switch (tag >>> 3) {
269
+ case 1: {
270
+ if (tag !== 10) {
271
+ break;
272
+ }
273
+ message.key = reader.string();
274
+ continue;
275
+ }
276
+ case 2: {
277
+ if (tag !== 18) {
278
+ break;
279
+ }
280
+ message.value = shared_1.EnumValues.decode(reader, reader.uint32());
281
+ continue;
282
+ }
283
+ }
284
+ if ((tag & 7) === 4 || tag === 0) {
285
+ break;
286
+ }
287
+ reader.skip(tag & 7);
288
+ }
289
+ return message;
290
+ },
291
+ create(base) {
292
+ return exports.DeviceInfo_StateEnumValuesEntry.fromPartial(base ?? {});
293
+ },
294
+ fromPartial(object) {
295
+ const message = createBaseDeviceInfo_StateEnumValuesEntry();
296
+ message.key = object.key ?? "";
297
+ message.value = (object.value !== undefined && object.value !== null)
298
+ ? shared_1.EnumValues.fromPartial(object.value)
299
+ : undefined;
300
+ return message;
301
+ },
302
+ };
157
303
  function createBaseRoomInfo() {
158
304
  return { key: "", name: "", devices: [] };
159
305
  }
package/dist/shared.d.ts CHANGED
@@ -1,13 +1,40 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
2
  export declare const protobufPackage = "hannah";
3
+ /**
4
+ * Classification of an ioBroker state's value, derived from common.type/role/states.
5
+ * Lets consumers (e.g. the WebUI trigger editor) offer the right operators/input widget
6
+ * per state instead of requiring a free-text ioBroker state ID.
7
+ */
8
+ export declare enum StateType {
9
+ STATE_TYPE_UNSPECIFIED = 0,
10
+ BOOLEAN = 1,
11
+ NUMERIC = 2,
12
+ ENUM = 3,
13
+ COLOR = 4,
14
+ TEXT = 5,
15
+ UNRECOGNIZED = -1
16
+ }
3
17
  export interface Empty {
4
18
  }
5
19
  export interface StatusResponse {
6
20
  ok: boolean;
7
21
  message: string;
8
22
  }
23
+ /** Allowed values for an ENUM/COLOR state, e.g. from ioBroker's common.states. */
24
+ export interface EnumValues {
25
+ /** raw value -> display label */
26
+ values: {
27
+ [key: string]: string;
28
+ };
29
+ }
30
+ export interface EnumValues_ValuesEntry {
31
+ key: string;
32
+ value: string;
33
+ }
9
34
  export declare const Empty: MessageFns<Empty>;
10
35
  export declare const StatusResponse: MessageFns<StatusResponse>;
36
+ export declare const EnumValues: MessageFns<EnumValues>;
37
+ export declare const EnumValues_ValuesEntry: MessageFns<EnumValues_ValuesEntry>;
11
38
  type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
12
39
  export type DeepPartial<T> = T extends bigint ? string | number | bigint : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
13
40
  [K in keyof T]?: DeepPartial<T[K]>;
package/dist/shared.js CHANGED
@@ -5,10 +5,25 @@
5
5
  // protoc unknown
6
6
  // source: shared.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.StatusResponse = exports.Empty = exports.protobufPackage = void 0;
8
+ exports.EnumValues_ValuesEntry = exports.EnumValues = exports.StatusResponse = exports.Empty = exports.StateType = exports.protobufPackage = void 0;
9
9
  /* eslint-disable */
10
10
  const wire_1 = require("@bufbuild/protobuf/wire");
11
11
  exports.protobufPackage = "hannah";
12
+ /**
13
+ * Classification of an ioBroker state's value, derived from common.type/role/states.
14
+ * Lets consumers (e.g. the WebUI trigger editor) offer the right operators/input widget
15
+ * per state instead of requiring a free-text ioBroker state ID.
16
+ */
17
+ var StateType;
18
+ (function (StateType) {
19
+ StateType[StateType["STATE_TYPE_UNSPECIFIED"] = 0] = "STATE_TYPE_UNSPECIFIED";
20
+ StateType[StateType["BOOLEAN"] = 1] = "BOOLEAN";
21
+ StateType[StateType["NUMERIC"] = 2] = "NUMERIC";
22
+ StateType[StateType["ENUM"] = 3] = "ENUM";
23
+ StateType[StateType["COLOR"] = 4] = "COLOR";
24
+ StateType[StateType["TEXT"] = 5] = "TEXT";
25
+ StateType[StateType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
26
+ })(StateType || (exports.StateType = StateType = {}));
12
27
  function createBaseEmpty() {
13
28
  return {};
14
29
  }
@@ -91,3 +106,104 @@ exports.StatusResponse = {
91
106
  return message;
92
107
  },
93
108
  };
109
+ function createBaseEnumValues() {
110
+ return { values: {} };
111
+ }
112
+ exports.EnumValues = {
113
+ encode(message, writer = new wire_1.BinaryWriter()) {
114
+ globalThis.Object.entries(message.values).forEach(([key, value]) => {
115
+ exports.EnumValues_ValuesEntry.encode({ key: key, value }, writer.uint32(10).fork()).join();
116
+ });
117
+ return writer;
118
+ },
119
+ decode(input, length) {
120
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
121
+ const end = length === undefined ? reader.len : reader.pos + length;
122
+ const message = createBaseEnumValues();
123
+ while (reader.pos < end) {
124
+ const tag = reader.uint32();
125
+ switch (tag >>> 3) {
126
+ case 1: {
127
+ if (tag !== 10) {
128
+ break;
129
+ }
130
+ const entry1 = exports.EnumValues_ValuesEntry.decode(reader, reader.uint32());
131
+ if (entry1.value !== undefined) {
132
+ message.values[entry1.key] = entry1.value;
133
+ }
134
+ continue;
135
+ }
136
+ }
137
+ if ((tag & 7) === 4 || tag === 0) {
138
+ break;
139
+ }
140
+ reader.skip(tag & 7);
141
+ }
142
+ return message;
143
+ },
144
+ create(base) {
145
+ return exports.EnumValues.fromPartial(base ?? {});
146
+ },
147
+ fromPartial(object) {
148
+ const message = createBaseEnumValues();
149
+ message.values = globalThis.Object.entries(object.values ?? {}).reduce((acc, [key, value]) => {
150
+ if (value !== undefined) {
151
+ acc[key] = globalThis.String(value);
152
+ }
153
+ return acc;
154
+ }, {});
155
+ return message;
156
+ },
157
+ };
158
+ function createBaseEnumValues_ValuesEntry() {
159
+ return { key: "", value: "" };
160
+ }
161
+ exports.EnumValues_ValuesEntry = {
162
+ encode(message, writer = new wire_1.BinaryWriter()) {
163
+ if (message.key !== "") {
164
+ writer.uint32(10).string(message.key);
165
+ }
166
+ if (message.value !== "") {
167
+ writer.uint32(18).string(message.value);
168
+ }
169
+ return writer;
170
+ },
171
+ decode(input, length) {
172
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
173
+ const end = length === undefined ? reader.len : reader.pos + length;
174
+ const message = createBaseEnumValues_ValuesEntry();
175
+ while (reader.pos < end) {
176
+ const tag = reader.uint32();
177
+ switch (tag >>> 3) {
178
+ case 1: {
179
+ if (tag !== 10) {
180
+ break;
181
+ }
182
+ message.key = reader.string();
183
+ continue;
184
+ }
185
+ case 2: {
186
+ if (tag !== 18) {
187
+ break;
188
+ }
189
+ message.value = reader.string();
190
+ continue;
191
+ }
192
+ }
193
+ if ((tag & 7) === 4 || tag === 0) {
194
+ break;
195
+ }
196
+ reader.skip(tag & 7);
197
+ }
198
+ return message;
199
+ },
200
+ create(base) {
201
+ return exports.EnumValues_ValuesEntry.fromPartial(base ?? {});
202
+ },
203
+ fromPartial(object) {
204
+ const message = createBaseEnumValues_ValuesEntry();
205
+ message.key = object.key ?? "";
206
+ message.value = object.value ?? "";
207
+ return message;
208
+ },
209
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m1kad0/hannah-proto",
3
- "version": "0.3.9",
3
+ "version": "0.4.0",
4
4
  "description": "Generated TypeScript gRPC-js client stubs for the Hannah voice assistant proto schema",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",