@m1kad0/hannah-proto 5.0.0 → 5.1.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.
Binary file
@@ -1,5 +1,5 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
- import { DeviceClass, Slot, SlotValue } from "./device_model";
2
+ import { DeviceClass, DeviceSubtype, Slot, SlotValue } from "./device_model";
3
3
  export declare const protobufPackage = "hannah.v2";
4
4
  /**
5
5
  * A device for control menus (WebUI, Telegram), in the typed device model: the class
@@ -16,6 +16,8 @@ export interface DeviceInfo {
16
16
  /** with current values; Slot.writable says what a menu may offer */
17
17
  slots: Slot[];
18
18
  available: boolean;
19
+ /** TypedDevice.subtype, e.g. window or door for a contact */
20
+ subtype: DeviceSubtype;
19
21
  }
20
22
  export interface RoomInfo {
21
23
  /** room_id (lowercase), e.g. "wohnzimmer" */
@@ -11,7 +11,7 @@ const wire_1 = require("@bufbuild/protobuf/wire");
11
11
  const device_model_1 = require("./device_model");
12
12
  exports.protobufPackage = "hannah.v2";
13
13
  function createBaseDeviceInfo() {
14
- return { id: "", name: "", deviceClass: 0, slots: [], available: false };
14
+ return { id: "", name: "", deviceClass: 0, slots: [], available: false, subtype: 0 };
15
15
  }
16
16
  exports.DeviceInfo = {
17
17
  encode(message, writer = new wire_1.BinaryWriter()) {
@@ -30,6 +30,9 @@ exports.DeviceInfo = {
30
30
  if (message.available !== false) {
31
31
  writer.uint32(96).bool(message.available);
32
32
  }
33
+ if (message.subtype !== 0) {
34
+ writer.uint32(104).int32(message.subtype);
35
+ }
33
36
  return writer;
34
37
  },
35
38
  decode(input, length) {
@@ -80,6 +83,13 @@ exports.DeviceInfo = {
80
83
  message.available = reader.bool();
81
84
  continue;
82
85
  }
86
+ case 13: {
87
+ if (tag !== 104) {
88
+ break;
89
+ }
90
+ message.subtype = reader.int32();
91
+ continue;
92
+ }
83
93
  }
84
94
  if ((tag & 7) === 4 || tag === 0) {
85
95
  break;
@@ -102,6 +112,7 @@ exports.DeviceInfo = {
102
112
  message.deviceClass = object.deviceClass ?? 0;
103
113
  message.slots = object.slots?.map((e) => device_model_1.Slot.fromPartial(e)) || [];
104
114
  message.available = object.available ?? false;
115
+ message.subtype = object.subtype ?? 0;
105
116
  return message;
106
117
  },
107
118
  };
@@ -16,8 +16,9 @@ export declare enum DeviceClass {
16
16
  */
17
17
  DEVICE_CLASS_GENERIC_BINARY_SWITCH = 3,
18
18
  /**
19
- * DEVICE_CLASS_THERMOSTAT - Thermostat/room climate. Slots: TARGET_TEMPERATURE (required), TEMPERATURE,
20
- * HUMIDITY, VALVE. Comfort/eco setpoints and similar are not slots.
19
+ * DEVICE_CLASS_THERMOSTAT - Radiator or room thermostat. Slots: TARGET_TEMPERATURE (required), TEMPERATURE,
20
+ * HUMIDITY, VALVE. Comfort/eco setpoints and similar are not slots. Units with an
21
+ * operating mode and a fan are DEVICE_CLASS_CLIMATE.
21
22
  */
22
23
  DEVICE_CLASS_THERMOSTAT = 4,
23
24
  /** DEVICE_CLASS_COVER - Blind, shutter, awning. Slots: POSITION (required), TILT, STOP. */
@@ -34,6 +35,26 @@ export declare enum DeviceClass {
34
35
  * (GENERIC_NUMBER / GENERIC_BOOL / GENERIC_TEXT), each with label and unit.
35
36
  */
36
37
  DEVICE_CLASS_GENERIC = 8,
38
+ /**
39
+ * DEVICE_CLASS_CLIMATE - Air conditioner / room climate unit with operating mode and fan. Slots: ON (required),
40
+ * MODE, TARGET_TEMPERATURE, TEMPERATURE, HUMIDITY, FAN_SPEED. A radiator thermostat
41
+ * without mode and fan is a THERMOSTAT, not a CLIMATE.
42
+ */
43
+ DEVICE_CLASS_CLIMATE = 9,
44
+ UNRECOGNIZED = -1
45
+ }
46
+ /**
47
+ * A finer kind within a device class, for the cases where the class alone does not say
48
+ * what a user means ("the windows" versus "the doors"). Optional: the adapter sets it
49
+ * where it knows (function, role, type detector), otherwise UNSPECIFIED.
50
+ */
51
+ export declare enum DeviceSubtype {
52
+ /** DEVICE_SUBTYPE_UNSPECIFIED - No statement. Hannah Core may fall back to the device name. */
53
+ DEVICE_SUBTYPE_UNSPECIFIED = 0,
54
+ /** DEVICE_SUBTYPE_WINDOW - DEVICE_CLASS_CONTACT: window contact. */
55
+ DEVICE_SUBTYPE_WINDOW = 1,
56
+ /** DEVICE_SUBTYPE_DOOR - DEVICE_CLASS_CONTACT: door contact. */
57
+ DEVICE_SUBTYPE_DOOR = 2,
37
58
  UNRECOGNIZED = -1
38
59
  }
39
60
  /**
@@ -66,6 +87,17 @@ export declare enum SlotKind {
66
87
  SLOT_KIND_HUMIDITY = 22,
67
88
  /** SLOT_KIND_VALVE - number, 0-100 (% open) */
68
89
  SLOT_KIND_VALVE = 23,
90
+ /**
91
+ * SLOT_KIND_MODE - Operating mode of a CLIMATE device, text, one of: "cool", "heat", "dry", "fan_only",
92
+ * "auto". The adapter normalizes the device's own values to this vocabulary. The modes the
93
+ * device really supports are listed in Slot.options.
94
+ */
95
+ SLOT_KIND_MODE = 24,
96
+ /**
97
+ * SLOT_KIND_FAN_SPEED - Fan level of a CLIMATE device, text, one of: "low", "medium", "high", "auto". Supported
98
+ * levels are listed in Slot.options.
99
+ */
100
+ SLOT_KIND_FAN_SPEED = 25,
69
101
  /** SLOT_KIND_POSITION - --- cover --- */
70
102
  SLOT_KIND_POSITION = 30,
71
103
  /** SLOT_KIND_TILT - number, 0-100 (%) */
@@ -124,6 +156,13 @@ export interface Slot {
124
156
  * Unset = not configured, no restriction — distinct from an explicit 0.
125
157
  */
126
158
  requiredTrustLevel?: number | undefined;
159
+ /**
160
+ * The values this slot accepts, for SLOT_KIND_MODE and SLOT_KIND_FAN_SPEED, taken from the
161
+ * vocabulary of the kind (e.g. a cooling-only unit lists just "cool", "dry", "fan_only").
162
+ * Empty = no statement, every value of the vocabulary may work. Hannah uses it to answer
163
+ * honestly when a device cannot do what was asked.
164
+ */
165
+ options: string[];
127
166
  }
128
167
  /** A device, as the adapter derived it from the ioBroker objects (grouping, class, slots). */
129
168
  export interface TypedDevice {
@@ -139,6 +178,8 @@ export interface TypedDevice {
139
178
  slots: Slot[];
140
179
  /** false = device currently unreachable */
141
180
  available: boolean;
181
+ /** finer kind within the class, UNSPECIFIED = no statement */
182
+ subtype: DeviceSubtype;
142
183
  }
143
184
  /**
144
185
  * All devices the adapter knows. Sent on AgentConnect and whenever the set of devices
@@ -5,7 +5,7 @@
5
5
  // protoc unknown
6
6
  // source: hannah/v2/device_model.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.SetSlot = exports.DeviceAvailability = exports.SlotUpdate = exports.TypedDeviceSnapshot = exports.TypedDevice = exports.Slot = exports.SlotValue = exports.SlotKind = exports.DeviceClass = exports.protobufPackage = void 0;
8
+ exports.SetSlot = exports.DeviceAvailability = exports.SlotUpdate = exports.TypedDeviceSnapshot = exports.TypedDevice = exports.Slot = exports.SlotValue = exports.SlotKind = exports.DeviceSubtype = exports.DeviceClass = exports.protobufPackage = void 0;
9
9
  /* eslint-disable */
10
10
  const wire_1 = require("@bufbuild/protobuf/wire");
11
11
  exports.protobufPackage = "hannah.v2";
@@ -26,8 +26,9 @@ var DeviceClass;
26
26
  */
27
27
  DeviceClass[DeviceClass["DEVICE_CLASS_GENERIC_BINARY_SWITCH"] = 3] = "DEVICE_CLASS_GENERIC_BINARY_SWITCH";
28
28
  /**
29
- * DEVICE_CLASS_THERMOSTAT - Thermostat/room climate. Slots: TARGET_TEMPERATURE (required), TEMPERATURE,
30
- * HUMIDITY, VALVE. Comfort/eco setpoints and similar are not slots.
29
+ * DEVICE_CLASS_THERMOSTAT - Radiator or room thermostat. Slots: TARGET_TEMPERATURE (required), TEMPERATURE,
30
+ * HUMIDITY, VALVE. Comfort/eco setpoints and similar are not slots. Units with an
31
+ * operating mode and a fan are DEVICE_CLASS_CLIMATE.
31
32
  */
32
33
  DeviceClass[DeviceClass["DEVICE_CLASS_THERMOSTAT"] = 4] = "DEVICE_CLASS_THERMOSTAT";
33
34
  /** DEVICE_CLASS_COVER - Blind, shutter, awning. Slots: POSITION (required), TILT, STOP. */
@@ -44,8 +45,29 @@ var DeviceClass;
44
45
  * (GENERIC_NUMBER / GENERIC_BOOL / GENERIC_TEXT), each with label and unit.
45
46
  */
46
47
  DeviceClass[DeviceClass["DEVICE_CLASS_GENERIC"] = 8] = "DEVICE_CLASS_GENERIC";
48
+ /**
49
+ * DEVICE_CLASS_CLIMATE - Air conditioner / room climate unit with operating mode and fan. Slots: ON (required),
50
+ * MODE, TARGET_TEMPERATURE, TEMPERATURE, HUMIDITY, FAN_SPEED. A radiator thermostat
51
+ * without mode and fan is a THERMOSTAT, not a CLIMATE.
52
+ */
53
+ DeviceClass[DeviceClass["DEVICE_CLASS_CLIMATE"] = 9] = "DEVICE_CLASS_CLIMATE";
47
54
  DeviceClass[DeviceClass["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
48
55
  })(DeviceClass || (exports.DeviceClass = DeviceClass = {}));
56
+ /**
57
+ * A finer kind within a device class, for the cases where the class alone does not say
58
+ * what a user means ("the windows" versus "the doors"). Optional: the adapter sets it
59
+ * where it knows (function, role, type detector), otherwise UNSPECIFIED.
60
+ */
61
+ var DeviceSubtype;
62
+ (function (DeviceSubtype) {
63
+ /** DEVICE_SUBTYPE_UNSPECIFIED - No statement. Hannah Core may fall back to the device name. */
64
+ DeviceSubtype[DeviceSubtype["DEVICE_SUBTYPE_UNSPECIFIED"] = 0] = "DEVICE_SUBTYPE_UNSPECIFIED";
65
+ /** DEVICE_SUBTYPE_WINDOW - DEVICE_CLASS_CONTACT: window contact. */
66
+ DeviceSubtype[DeviceSubtype["DEVICE_SUBTYPE_WINDOW"] = 1] = "DEVICE_SUBTYPE_WINDOW";
67
+ /** DEVICE_SUBTYPE_DOOR - DEVICE_CLASS_CONTACT: door contact. */
68
+ DeviceSubtype[DeviceSubtype["DEVICE_SUBTYPE_DOOR"] = 2] = "DEVICE_SUBTYPE_DOOR";
69
+ DeviceSubtype[DeviceSubtype["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
70
+ })(DeviceSubtype || (exports.DeviceSubtype = DeviceSubtype = {}));
49
71
  /**
50
72
  * What a slot means, and therefore which scale and unit its value has. The adapter
51
73
  * normalizes every value to exactly this scale; Core relies on it.
@@ -77,6 +99,17 @@ var SlotKind;
77
99
  SlotKind[SlotKind["SLOT_KIND_HUMIDITY"] = 22] = "SLOT_KIND_HUMIDITY";
78
100
  /** SLOT_KIND_VALVE - number, 0-100 (% open) */
79
101
  SlotKind[SlotKind["SLOT_KIND_VALVE"] = 23] = "SLOT_KIND_VALVE";
102
+ /**
103
+ * SLOT_KIND_MODE - Operating mode of a CLIMATE device, text, one of: "cool", "heat", "dry", "fan_only",
104
+ * "auto". The adapter normalizes the device's own values to this vocabulary. The modes the
105
+ * device really supports are listed in Slot.options.
106
+ */
107
+ SlotKind[SlotKind["SLOT_KIND_MODE"] = 24] = "SLOT_KIND_MODE";
108
+ /**
109
+ * SLOT_KIND_FAN_SPEED - Fan level of a CLIMATE device, text, one of: "low", "medium", "high", "auto". Supported
110
+ * levels are listed in Slot.options.
111
+ */
112
+ SlotKind[SlotKind["SLOT_KIND_FAN_SPEED"] = 25] = "SLOT_KIND_FAN_SPEED";
80
113
  /** SLOT_KIND_POSITION - --- cover --- */
81
114
  SlotKind[SlotKind["SLOT_KIND_POSITION"] = 30] = "SLOT_KIND_POSITION";
82
115
  /** SLOT_KIND_TILT - number, 0-100 (%) */
@@ -188,7 +221,16 @@ exports.SlotValue = {
188
221
  },
189
222
  };
190
223
  function createBaseSlot() {
191
- return { slotId: "", kind: 0, value: undefined, writable: false, unit: "", label: "", requiredTrustLevel: undefined };
224
+ return {
225
+ slotId: "",
226
+ kind: 0,
227
+ value: undefined,
228
+ writable: false,
229
+ unit: "",
230
+ label: "",
231
+ requiredTrustLevel: undefined,
232
+ options: [],
233
+ };
192
234
  }
193
235
  exports.Slot = {
194
236
  encode(message, writer = new wire_1.BinaryWriter()) {
@@ -213,6 +255,9 @@ exports.Slot = {
213
255
  if (message.requiredTrustLevel !== undefined) {
214
256
  writer.uint32(56).int32(message.requiredTrustLevel);
215
257
  }
258
+ for (const v of message.options) {
259
+ writer.uint32(66).string(v);
260
+ }
216
261
  return writer;
217
262
  },
218
263
  decode(input, length) {
@@ -277,6 +322,13 @@ exports.Slot = {
277
322
  message.requiredTrustLevel = reader.int32();
278
323
  continue;
279
324
  }
325
+ case 8: {
326
+ if (tag !== 66) {
327
+ break;
328
+ }
329
+ message.options.push(reader.string());
330
+ continue;
331
+ }
280
332
  }
281
333
  if ((tag & 7) === 4 || tag === 0) {
282
334
  break;
@@ -303,11 +355,12 @@ exports.Slot = {
303
355
  message.unit = object.unit ?? "";
304
356
  message.label = object.label ?? "";
305
357
  message.requiredTrustLevel = object.requiredTrustLevel ?? undefined;
358
+ message.options = object.options?.map((e) => e) || [];
306
359
  return message;
307
360
  },
308
361
  };
309
362
  function createBaseTypedDevice() {
310
- return { deviceId: "", name: "", room: "", floor: "", deviceClass: 0, slots: [], available: false };
363
+ return { deviceId: "", name: "", room: "", floor: "", deviceClass: 0, slots: [], available: false, subtype: 0 };
311
364
  }
312
365
  exports.TypedDevice = {
313
366
  encode(message, writer = new wire_1.BinaryWriter()) {
@@ -332,6 +385,9 @@ exports.TypedDevice = {
332
385
  if (message.available !== false) {
333
386
  writer.uint32(56).bool(message.available);
334
387
  }
388
+ if (message.subtype !== 0) {
389
+ writer.uint32(64).int32(message.subtype);
390
+ }
335
391
  return writer;
336
392
  },
337
393
  decode(input, length) {
@@ -396,6 +452,13 @@ exports.TypedDevice = {
396
452
  message.available = reader.bool();
397
453
  continue;
398
454
  }
455
+ case 8: {
456
+ if (tag !== 64) {
457
+ break;
458
+ }
459
+ message.subtype = reader.int32();
460
+ continue;
461
+ }
399
462
  }
400
463
  if ((tag & 7) === 4 || tag === 0) {
401
464
  break;
@@ -420,6 +483,7 @@ exports.TypedDevice = {
420
483
  message.deviceClass = object.deviceClass ?? 0;
421
484
  message.slots = object.slots?.map((e) => exports.Slot.fromPartial(e)) || [];
422
485
  message.available = object.available ?? false;
486
+ message.subtype = object.subtype ?? 0;
423
487
  return message;
424
488
  },
425
489
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m1kad0/hannah-proto",
3
- "version": "5.0.0",
3
+ "version": "5.1.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",
@@ -22,7 +22,7 @@
22
22
  "@grpc/grpc-js": "^1.14.4"
23
23
  },
24
24
  "devDependencies": {
25
- "@grpc/grpc-js": "1.14.4",
25
+ "@grpc/grpc-js": "1.14.5",
26
26
  "ts-proto": "2.12.1",
27
27
  "typescript": "7.0.2"
28
28
  },