@m1kad0/hannah-proto 5.1.0 → 5.2.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/descriptor.binpb +0 -0
- package/dist/v2/agent.d.ts +17 -7
- package/dist/v2/agent.js +12 -1
- package/dist/v2/device_model.d.ts +8 -0
- package/dist/v2/device_model.js +12 -0
- package/package.json +1 -1
package/dist/descriptor.binpb
CHANGED
|
Binary file
|
package/dist/v2/agent.d.ts
CHANGED
|
@@ -100,13 +100,15 @@ export interface CaptureControl {
|
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* A state change event for a state Hannah asked to watch (AgentWatchMore), e.g. the
|
|
103
|
-
* trigger engine's conditions.
|
|
103
|
+
* trigger engine's conditions. `state_id` is the identifier the adapter uses for the value
|
|
104
|
+
* (for ioBroker the state ID, the same as `Slot.identifier` for a slot of a device). Devices
|
|
105
|
+
* report their changes as SlotUpdate; a value that is both a slot and watched gets both.
|
|
104
106
|
* ack=true means the device confirmed the value (as opposed to ack=false which is the
|
|
105
107
|
* "desired" value). Hannah uses this to verify that a SetState command was executed
|
|
106
|
-
* successfully.
|
|
108
|
+
* successfully. The value is the raw one of that state, not normalized to a slot scale.
|
|
107
109
|
*/
|
|
108
110
|
export interface AgentStateUpdate {
|
|
109
|
-
/**
|
|
111
|
+
/** identifier of the value, for ioBroker the full state ID, e.g. "0_userdata.0.feeded" */
|
|
110
112
|
stateId: string;
|
|
111
113
|
/** JSON-encoded value: "true", "42", "\"text\"" */
|
|
112
114
|
value: string;
|
|
@@ -114,6 +116,13 @@ export interface AgentStateUpdate {
|
|
|
114
116
|
ack: boolean;
|
|
115
117
|
/** Unix timestamp in milliseconds */
|
|
116
118
|
ts: bigint;
|
|
119
|
+
/**
|
|
120
|
+
* Field 5 is deliberately unused: in hannah.v1 it was `canonical_key`, a different type.
|
|
121
|
+
* true = the current value the adapter sends when it starts watching a state (its answer to
|
|
122
|
+
* AgentWatchMore), not a change. Hannah Core uses it to prefill the trigger engine's cache
|
|
123
|
+
* silently, without firing triggers: an update from "unknown" to a value is not a transition.
|
|
124
|
+
*/
|
|
125
|
+
initial: boolean;
|
|
117
126
|
}
|
|
118
127
|
/** The text-command state in ioBroker changed — treat as a SubmitText call. */
|
|
119
128
|
export interface AgentTextCommand {
|
|
@@ -183,15 +192,16 @@ export interface AgentFirmwareEvent {
|
|
|
183
192
|
* confirms execution back to Hannah.
|
|
184
193
|
*/
|
|
185
194
|
export interface AgentSetState {
|
|
186
|
-
/**
|
|
195
|
+
/** identifier of the value to write, for ioBroker the state ID */
|
|
187
196
|
stateId: string;
|
|
188
197
|
/** JSON-encoded value */
|
|
189
198
|
value: string;
|
|
190
199
|
}
|
|
191
200
|
/**
|
|
192
|
-
* Hannah requests additional state IDs to be included in the
|
|
193
|
-
* Used by the trigger engine at runtime when triggers reference
|
|
194
|
-
* (e.g. unless.state: "0_userdata.0.feeded") that aren't covered by enum
|
|
201
|
+
* Hannah requests additional identifiers (for ioBroker state IDs) to be included in the
|
|
202
|
+
* AgentStateUpdate stream. Used by the trigger engine at runtime when triggers reference
|
|
203
|
+
* arbitrary values (e.g. unless.state: "0_userdata.0.feeded") that aren't covered by enum
|
|
204
|
+
* discovery. The adapter answers every new one with its current raw value, `initial` = true.
|
|
195
205
|
*/
|
|
196
206
|
export interface AgentWatchMore {
|
|
197
207
|
stateIds: string[];
|
package/dist/v2/agent.js
CHANGED
|
@@ -476,7 +476,7 @@ exports.CaptureControl = {
|
|
|
476
476
|
},
|
|
477
477
|
};
|
|
478
478
|
function createBaseAgentStateUpdate() {
|
|
479
|
-
return { stateId: "", value: "", ack: false, ts: 0n };
|
|
479
|
+
return { stateId: "", value: "", ack: false, ts: 0n, initial: false };
|
|
480
480
|
}
|
|
481
481
|
exports.AgentStateUpdate = {
|
|
482
482
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
@@ -495,6 +495,9 @@ exports.AgentStateUpdate = {
|
|
|
495
495
|
}
|
|
496
496
|
writer.uint32(32).int64(message.ts);
|
|
497
497
|
}
|
|
498
|
+
if (message.initial !== false) {
|
|
499
|
+
writer.uint32(48).bool(message.initial);
|
|
500
|
+
}
|
|
498
501
|
return writer;
|
|
499
502
|
},
|
|
500
503
|
decode(input, length) {
|
|
@@ -538,6 +541,13 @@ exports.AgentStateUpdate = {
|
|
|
538
541
|
message.ts = reader.int64();
|
|
539
542
|
continue;
|
|
540
543
|
}
|
|
544
|
+
case 6: {
|
|
545
|
+
if (tag !== 48) {
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
message.initial = reader.bool();
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
541
551
|
}
|
|
542
552
|
if ((tag & 7) === 4 || tag === 0) {
|
|
543
553
|
break;
|
|
@@ -559,6 +569,7 @@ exports.AgentStateUpdate = {
|
|
|
559
569
|
message.value = object.value ?? "";
|
|
560
570
|
message.ack = object.ack ?? false;
|
|
561
571
|
message.ts = (object.ts !== undefined && object.ts !== null) ? BigInt(object.ts) : 0n;
|
|
572
|
+
message.initial = object.initial ?? false;
|
|
562
573
|
return message;
|
|
563
574
|
},
|
|
564
575
|
};
|
|
@@ -163,6 +163,14 @@ export interface Slot {
|
|
|
163
163
|
* honestly when a device cannot do what was asked.
|
|
164
164
|
*/
|
|
165
165
|
options: string[];
|
|
166
|
+
/**
|
|
167
|
+
* How a trigger (and any client building triggers) refers to the value behind this slot: the
|
|
168
|
+
* identifier the adapter uses for it, for ioBroker the state ID. Opaque to Hannah Core, which
|
|
169
|
+
* only passes it through (AgentWatchMore, AgentSetState, AgentStateUpdate, trigger conditions
|
|
170
|
+
* and actions). Empty = not addressable by triggers. Triggers compare against the raw value
|
|
171
|
+
* of the identified state (and its own scale), not against the normalized `value` above.
|
|
172
|
+
*/
|
|
173
|
+
identifier: string;
|
|
166
174
|
}
|
|
167
175
|
/** A device, as the adapter derived it from the ioBroker objects (grouping, class, slots). */
|
|
168
176
|
export interface TypedDevice {
|
package/dist/v2/device_model.js
CHANGED
|
@@ -230,6 +230,7 @@ function createBaseSlot() {
|
|
|
230
230
|
label: "",
|
|
231
231
|
requiredTrustLevel: undefined,
|
|
232
232
|
options: [],
|
|
233
|
+
identifier: "",
|
|
233
234
|
};
|
|
234
235
|
}
|
|
235
236
|
exports.Slot = {
|
|
@@ -258,6 +259,9 @@ exports.Slot = {
|
|
|
258
259
|
for (const v of message.options) {
|
|
259
260
|
writer.uint32(66).string(v);
|
|
260
261
|
}
|
|
262
|
+
if (message.identifier !== "") {
|
|
263
|
+
writer.uint32(74).string(message.identifier);
|
|
264
|
+
}
|
|
261
265
|
return writer;
|
|
262
266
|
},
|
|
263
267
|
decode(input, length) {
|
|
@@ -329,6 +333,13 @@ exports.Slot = {
|
|
|
329
333
|
message.options.push(reader.string());
|
|
330
334
|
continue;
|
|
331
335
|
}
|
|
336
|
+
case 9: {
|
|
337
|
+
if (tag !== 74) {
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
message.identifier = reader.string();
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
332
343
|
}
|
|
333
344
|
if ((tag & 7) === 4 || tag === 0) {
|
|
334
345
|
break;
|
|
@@ -356,6 +367,7 @@ exports.Slot = {
|
|
|
356
367
|
message.label = object.label ?? "";
|
|
357
368
|
message.requiredTrustLevel = object.requiredTrustLevel ?? undefined;
|
|
358
369
|
message.options = object.options?.map((e) => e) || [];
|
|
370
|
+
message.identifier = object.identifier ?? "";
|
|
359
371
|
return message;
|
|
360
372
|
},
|
|
361
373
|
};
|
package/package.json
CHANGED