iobroker.digitalstrom 2.2.1 → 3.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dssSmartHome.js","sourceRoot":"","sources":["../../src/lib/dssSmartHome.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,gDAAkC;AAClC,kDAAoC;AACpC,+CAA+D;AAC/D,+BAA4B;AAE5B,2CAA4C;AA+E5C,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1C,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC;;;;;;GAMG;AACH,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAC3C,wFAAwF;AACxF,MAAM,8BAA8B,GAAG,KAAK,CAAC;AAC7C,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAClC,2DAA2D;AAC3D,MAAM,gBAAgB,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AAEnD,mEAAmE;AACnE,MAAM,kBAAkB,GAAG;IACvB,cAAc;IACd,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,OAAO;IACP,UAAU;IACV,cAAc;IACd,UAAU;IACV,aAAa;IACb,aAAa;IACb,WAAW;CACd,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,gEAAgE;AAChE,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE1F,MAAa,cAAe,SAAQ,KAAK;IACrC,MAAM,CAAqB;IAC3B,4CAA4C;IAC5C,IAAI,CAAqB;IACzB,oDAAoD;IACpD,QAAQ,CAAsB;IAE9B;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAe,EAAE,OAAsB;Q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vF,CAAC;YACF,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACP,CAAC;;AA5uBL,oCA6uBC"}
@@ -0,0 +1,601 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SmartHomeOutputSync = void 0;
37
+ const dssConstants = __importStar(require("./constants"));
38
+ const configUtils_1 = require("./configUtils");
39
+ /** Collect triggers for this long before the one status request */
40
+ const DEFAULT_DEBOUNCE = 2000;
41
+ /** A travelling blind carries no value - ask again after this pause */
42
+ const DEFAULT_FOLLOW_UP_DELAY = 15000;
43
+ /** After this many follow-ups the classic read takes over */
44
+ const DEFAULT_MAX_FOLLOW_UPS = 4;
45
+ /** After a failed status request the classic path serves alone for this long */
46
+ const DEFAULT_FAILURE_BACKOFF = 5 * 60 * 1000;
47
+ /** A channel is considered undeliverable after this many exhausted follow-up budgets */
48
+ const DEFAULT_LEARN_AFTER_MISSES = 2;
49
+ /**
50
+ * How long a channel stays on the fast re-read schedule after its announced travel
51
+ * end. Long enough to catch the real value in the next read or two, short enough that
52
+ * a device stuck on "moving" runs into the normal follow-up budget.
53
+ */
54
+ const TRAVEL_GRACE = 5000;
55
+ /**
56
+ * A learned channel is probed again after this long. Healing normally happens by
57
+ * looking at the status answers of OTHER channels - but if every channel of an
58
+ * installation were learned (a dSS serving degraded 200-answers for a while), no
59
+ * status request would ever run again and the learning could never heal. The
60
+ * periodic probe bounds that state instead of latching it until the next restart.
61
+ */
62
+ const DEFAULT_RELEARN_INTERVAL = 60 * 60 * 1000;
63
+ class SmartHomeOutputSync {
64
+ structure;
65
+ smartHome;
66
+ adapter;
67
+ debounce;
68
+ followUpDelay;
69
+ maxFollowUps;
70
+ failureBackoff;
71
+ learnAfterMisses;
72
+ relearnInterval;
73
+ pending;
74
+ missCounts;
75
+ undeliverable;
76
+ flushTimer;
77
+ flushTimerFireAt;
78
+ flushInFlight;
79
+ disabledUntil;
80
+ warnedFailure;
81
+ constructor(options) {
82
+ this.structure = options.structure;
83
+ this.smartHome = options.smartHome;
84
+ this.adapter = options.adapter;
85
+ this.debounce = options.debounce || DEFAULT_DEBOUNCE;
86
+ this.followUpDelay = options.followUpDelay || DEFAULT_FOLLOW_UP_DELAY;
87
+ this.maxFollowUps = options.maxFollowUps === undefined ? DEFAULT_MAX_FOLLOW_UPS : options.maxFollowUps;
88
+ this.failureBackoff = options.failureBackoff || DEFAULT_FAILURE_BACKOFF;
89
+ this.learnAfterMisses =
90
+ options.learnAfterMisses === undefined ? DEFAULT_LEARN_AFTER_MISSES : options.learnAfterMisses;
91
+ this.relearnInterval = options.relearnInterval || DEFAULT_RELEARN_INTERVAL;
92
+ this.pending = new Map();
93
+ /** "<dSUID>|<channel>" -> exhausted follow-up budgets in a row */
94
+ this.missCounts = new Map();
95
+ /** learned "<dSUID>|<channel>" pairs the status never answers -> learned at */
96
+ this.undeliverable = new Map();
97
+ /** the armed flush timer, null while none is armed */
98
+ this.flushTimer = null;
99
+ /** When the armed flush timer will fire - to let an earlier request pull it forward */
100
+ this.flushTimerFireAt = 0;
101
+ /** True while a status request is on its way */
102
+ this.flushInFlight = false;
103
+ this.disabledUntil = 0;
104
+ this.warnedFailure = false;
105
+ }
106
+ now() {
107
+ return Date.now();
108
+ }
109
+ /**
110
+ * @returns false while a failed request keeps the classic path in charge
111
+ */
112
+ isAvailable() {
113
+ return !!this.smartHome && this.disabledUntil <= this.now();
114
+ }
115
+ /**
116
+ * Asks for a fresh read of the given output channels of a device.
117
+ *
118
+ * @param dev device object of the structure, with outputChannelList. Untyped
119
+ * on purpose: this is the entry point every caller reaches with whatever the
120
+ * structure built, and the first line below is what validates it.
121
+ * @param [outputTypes] channel types, default every channel of the device
122
+ * @returns true when the sync takes care of it, false = use the classic path
123
+ */
124
+ requestDeviceSync(dev, outputTypes) {
125
+ if (!dev || !dev.dSUID || !dev.outputChannelList || !this.isAvailable()) {
126
+ return false;
127
+ }
128
+ const wanted = outputTypes && outputTypes.length
129
+ ? outputTypes.filter(type => dev.outputChannelList[type])
130
+ : Object.keys(dev.outputChannelList);
131
+ if (!wanted.length) {
132
+ return false;
133
+ }
134
+ const askable = [];
135
+ let probes = 0;
136
+ for (const type of wanted) {
137
+ const key = `${dev.dSUID}|${type}`;
138
+ const learnedAt = this.undeliverable.get(key);
139
+ if (learnedAt === undefined) {
140
+ askable.push(type);
141
+ continue;
142
+ }
143
+ if (this.now() - learnedAt > this.relearnInterval) {
144
+ // Probe an old entry once through the status again - one more
145
+ // exhausted budget relearns it, one delivered value heals it
146
+ this.undeliverable.delete(key);
147
+ this.missCounts.set(key, this.learnAfterMisses - 1);
148
+ askable.push(type);
149
+ probes++;
150
+ continue;
151
+ }
152
+ // A learned gap: the status will never answer, the classic read serves
153
+ // right away instead of after the exhausted follow-up budget. Without
154
+ // report - the Smart Home API stays in charge of the other channels.
155
+ this.structure.queueClassicOutputRead(dev, type, 'medium', { report: false });
156
+ }
157
+ if (!askable.length) {
158
+ // Fully handled classically - true, so the caller does not read a second time
159
+ return true;
160
+ }
161
+ const existing = this.pending.get(dev.dSUID);
162
+ const entry = existing || {
163
+ dev,
164
+ outputTypes: new Set(),
165
+ attempts: 0,
166
+ lastTriggeredAt: 0,
167
+ travellingUntil: 0,
168
+ probeOnly: true,
169
+ };
170
+ // An entry exists "only to probe" while EVERY reason it exists is such a question.
171
+ // The moment a real trigger joins it, the full follow-up budget applies again.
172
+ entry.probeOnly = (existing ? existing.probeOnly !== false : true) && probes === askable.length;
173
+ askable.forEach(type => entry.outputTypes.add(type));
174
+ // A new trigger restarts the follow-up budget - the outputs are moving again.
175
+ // The timestamp keeps a status answer that was already on its way from
176
+ // satisfying this trigger with values from before it.
177
+ entry.attempts = 0;
178
+ entry.lastTriggeredAt = this.now();
179
+ this.pending.set(dev.dSUID, entry);
180
+ this.scheduleFlush(this.debounce);
181
+ return true;
182
+ }
183
+ /**
184
+ * @param delay ms until the pending devices are read
185
+ */
186
+ scheduleFlush(delay) {
187
+ const fireAt = this.now() + delay;
188
+ if (this.flushTimer) {
189
+ if (fireAt >= this.flushTimerFireAt) {
190
+ // The armed timer fires earlier or at the same time - join that read
191
+ return;
192
+ }
193
+ // A fresh 2 s trigger must not wait behind a 15 s follow-up timer
194
+ clearTimeout(this.flushTimer);
195
+ this.structure.pendingTimeouts && this.structure.pendingTimeouts.delete(this.flushTimer);
196
+ this.flushTimer = null;
197
+ }
198
+ this.flushTimerFireAt = fireAt;
199
+ this.flushTimer = this.structure.setClearableTimeout(() => {
200
+ this.flushTimer = null;
201
+ this.flush().catch(err => {
202
+ // flush() handles its own errors, this only guards a broken handler
203
+ this.adapter.log.error(`Smart Home output sync failed unexpectedly: ${(0, configUtils_1.errorMessage)(err)}`);
204
+ });
205
+ }, delay);
206
+ }
207
+ /**
208
+ * ONE status request for everything that piled up, then classic reads for the rest.
209
+ */
210
+ async flush() {
211
+ if (this.structure.isAdapterStopping() || !this.pending.size) {
212
+ return;
213
+ }
214
+ if (!this.isAvailable()) {
215
+ return void this.fallBackAll();
216
+ }
217
+ if (this.flushInFlight) {
218
+ // The running read predates this timer - ask again once it is through
219
+ return void this.scheduleFlush(this.debounce);
220
+ }
221
+ // A trigger that arrives while the request is on its way must not be satisfied
222
+ // by its answer - the answer shows the state from BEFORE that trigger
223
+ const flightStart = this.now();
224
+ this.flushInFlight = true;
225
+ let status;
226
+ try {
227
+ status = await this.smartHome.getApartmentStatus();
228
+ }
229
+ catch (err) {
230
+ this.flushInFlight = false;
231
+ const shutdown = !!(err && typeof err === 'object' && 'shutdown' in err && err.shutdown === true);
232
+ if (shutdown || this.structure.isAdapterStopping()) {
233
+ return;
234
+ }
235
+ this.disabledUntil = this.now() + this.failureBackoff;
236
+ const minutes = Math.max(1, Math.round(this.failureBackoff / 60000));
237
+ const message = `Could not read the output values via the Smart Home API (${(0, configUtils_1.errorMessage)(err)}); ` +
238
+ `reading them through the classic API and trying the Smart Home API again in ${minutes} minute${minutes === 1 ? '' : 's'}`;
239
+ if (this.warnedFailure) {
240
+ this.adapter.log.debug(message);
241
+ }
242
+ else {
243
+ this.adapter.log.warn(message);
244
+ this.warnedFailure = true;
245
+ }
246
+ return void this.fallBackAll();
247
+ }
248
+ this.flushInFlight = false;
249
+ if (this.structure.isAdapterStopping()) {
250
+ return;
251
+ }
252
+ this.warnedFailure = false;
253
+ const travelEndsAt = this.applyStatus(status, flightStart);
254
+ if (typeof this.structure.applyZoneTemperatureStatus === 'function') {
255
+ // Die Antwort traegt auch Sollwert und Stellgroesse der Raumtemperatur-
256
+ // regelung je Zone - mitnehmen, sie ist schon bezahlt
257
+ this.structure.applyZoneTemperatureStatus(status);
258
+ }
259
+ // What is left had no value in the answer - typically a travelling blind.
260
+ // Ask again a few times, then let the classic read deliver whatever it can.
261
+ for (const [dSUID, entry] of [...this.pending]) {
262
+ if (entry.lastTriggeredAt > flightStart) {
263
+ // Was not asked yet - its own read is already scheduled
264
+ continue;
265
+ }
266
+ if (entry.travellingUntil > this.now()) {
267
+ // A running travel is not a missing answer - the status told us when it
268
+ // ends, so the budget must not burn while we wait for exactly that
269
+ continue;
270
+ }
271
+ entry.attempts++;
272
+ // A probe is a question, not a value someone is waiting for: the channel is
273
+ // already served classically, so it gets NO follow-up at all - the one status it
274
+ // rode along with is the answer. The hourly probe of four Sonos players used to
275
+ // spend the full budget instead, measured twelve of the eighty-four status reads
276
+ // of three hours, and it healed nothing in any of them.
277
+ const followUpBudget = entry.probeOnly ? 0 : this.maxFollowUps;
278
+ if (entry.attempts > followUpBudget) {
279
+ this.pending.delete(dSUID);
280
+ for (const outputType of entry.outputTypes) {
281
+ const key = `${dSUID}|${outputType}`;
282
+ const misses = (this.missCounts.get(key) || 0) + 1;
283
+ this.missCounts.set(key, misses);
284
+ if (misses >= this.learnAfterMisses && !this.undeliverable.has(key)) {
285
+ this.undeliverable.set(key, this.now());
286
+ this.adapter.log.debug(`The status never answers output channel ${outputType} of ${dSUID} - ` +
287
+ `the classic read serves it directly from now on`);
288
+ }
289
+ }
290
+ // Without report: one undeliverable channel does not put the classic
291
+ // path in charge, the Smart Home API keeps serving everything else
292
+ this.fallBackEntry(entry, false);
293
+ }
294
+ }
295
+ if (this.pending.size) {
296
+ const hasFreshTrigger = [...this.pending.values()].some(entry => entry.lastTriggeredAt > flightStart);
297
+ let delay = hasFreshTrigger ? this.debounce : this.followUpDelay;
298
+ if (travelEndsAt !== Infinity) {
299
+ // Ask again right after the travel ends instead of on the fixed grid -
300
+ // that answer carries the real final position
301
+ delay = Math.max(this.debounce, Math.min(delay, travelEndsAt - this.now() + 500));
302
+ }
303
+ this.scheduleFlush(delay);
304
+ }
305
+ }
306
+ /**
307
+ * Writes every pending output value the status answer carries.
308
+ *
309
+ * @param status answer of getApartmentStatus()
310
+ * @param flightStart entries triggered after this moment are not touched
311
+ * @returns when the earliest running travel ends, Infinity without one
312
+ */
313
+ applyStatus(status, flightStart) {
314
+ const statusDevices = (status && status.included && status.included.dsDevices) || [];
315
+ const devicesById = new Map();
316
+ for (const device of statusDevices) {
317
+ if (device && typeof device.id === 'string') {
318
+ devicesById.set(device.id, device);
319
+ }
320
+ }
321
+ let applied = 0;
322
+ // The earliest moment a running travel ends - the next read is due right after
323
+ let travelEndsAt = Infinity;
324
+ for (const [dSUID, entry] of [...this.pending]) {
325
+ if (entry.lastTriggeredAt > flightStart) {
326
+ // The answer predates this trigger and could carry stale values
327
+ continue;
328
+ }
329
+ const statusEntry = devicesById.get(dSUID);
330
+ const values = SmartHomeOutputSync.collectOutputValues(statusEntry, this.now());
331
+ const travelling = SmartHomeOutputSync.collectTravellingChannels(statusEntry, this.now());
332
+ for (const outputType of [...entry.outputTypes]) {
333
+ const value = values.get(outputType);
334
+ if (value === undefined) {
335
+ // Missing means "unchanged", never null - stays pending
336
+ continue;
337
+ }
338
+ // The status DID answer - this channel is deliverable
339
+ this.missCounts.delete(`${dSUID}|${outputType}`);
340
+ if (this.applyValue(entry.dev, outputType, value) === 'unsupported') {
341
+ // The channel exists but its semantics are not verified against the
342
+ // new API (boolean 0/1 channels) - the classic read knows them.
343
+ // Without report: the sync stays in charge, see fallBackEntry.
344
+ this.structure.queueClassicOutputRead(entry.dev, outputType, 'medium', { report: false });
345
+ }
346
+ else {
347
+ applied++;
348
+ }
349
+ if (travelling.has(outputType)) {
350
+ // An interpolated position is a good intermediate value, not the
351
+ // final one - the channel stays pending until the travel is over
352
+ continue;
353
+ }
354
+ entry.outputTypes.delete(outputType);
355
+ }
356
+ // Whatever is still pending AND travelling decides when to ask again. This
357
+ // has to look at the pending set, not only at the channels a value was
358
+ // written for: right after the announced end there is no value to write,
359
+ // and exactly then the next read must come quickly.
360
+ let entryTravelEnd = 0;
361
+ for (const outputType of entry.outputTypes) {
362
+ const travelEnd = travelling.get(outputType);
363
+ if (travelEnd !== undefined) {
364
+ entryTravelEnd = Math.max(entryTravelEnd, travelEnd);
365
+ travelEndsAt = Math.min(travelEndsAt, travelEnd);
366
+ }
367
+ }
368
+ entry.travellingUntil = entryTravelEnd;
369
+ if (!entry.outputTypes.size) {
370
+ this.pending.delete(dSUID);
371
+ }
372
+ }
373
+ // A learned gap may close again - a blind that just travelled longer than the
374
+ // whole follow-up budget, or a firmware that starts delivering the channel.
375
+ // One look at the answer that is already here heals it, no extra request -
376
+ // and the value it carries is applied right away instead of being thrown out.
377
+ for (const key of [...this.undeliverable.keys()]) {
378
+ const [dSUID, outputType] = key.split('|');
379
+ const statusEntry = devicesById.get(dSUID);
380
+ if (!statusEntry) {
381
+ continue;
382
+ }
383
+ const value = SmartHomeOutputSync.collectOutputValues(statusEntry, this.now()).get(outputType);
384
+ if (value === undefined) {
385
+ continue;
386
+ }
387
+ this.undeliverable.delete(key);
388
+ this.missCounts.delete(key);
389
+ const dev = (this.structure.devicesByDsuid && this.structure.devicesByDsuid[dSUID]) || null;
390
+ if (dev && this.applyValue(dev, outputType, value) !== 'unsupported') {
391
+ applied++;
392
+ }
393
+ this.adapter.log.debug(`The status answers output channel ${outputType} of ${dSUID} again - back to the Smart Home API`);
394
+ }
395
+ if (applied && typeof this.structure.reportOutputApi === 'function') {
396
+ // Makes the division of labour visible: info.outputApi in the instance
397
+ this.structure.reportOutputApi('smarthome');
398
+ }
399
+ return travelEndsAt;
400
+ }
401
+ /**
402
+ * The outputs of a device status, across all its function blocks.
403
+ *
404
+ * @param statusEntry one dsDeviceStatus entry
405
+ * @param [now] clock for the interpolation of a travelling output
406
+ * @returns output id (= channel type) to value
407
+ */
408
+ static collectOutputValues(statusEntry, now = Date.now()) {
409
+ const values = new Map();
410
+ let powerStateLevel;
411
+ const blocks = (statusEntry && statusEntry.attributes && statusEntry.attributes.functionBlocks) || [];
412
+ for (const block of blocks) {
413
+ for (const output of (block && block.outputs) || []) {
414
+ if (output &&
415
+ typeof output.id === 'string' &&
416
+ typeof output.value === 'number' &&
417
+ isFinite(output.value)) {
418
+ values.set(output.id, output.value);
419
+ }
420
+ else if (output && typeof output.id === 'string') {
421
+ const travelled = SmartHomeOutputSync.travelPosition(output, now);
422
+ if (travelled !== undefined) {
423
+ values.set(output.id, travelled);
424
+ }
425
+ }
426
+ if (output &&
427
+ output.id === 'powerState' &&
428
+ typeof output.level === 'number' &&
429
+ isFinite(output.level)) {
430
+ powerStateLevel = output.level;
431
+ }
432
+ }
433
+ }
434
+ // Two id mismatches of the dSS status, measured on a dSS20 1.19.13: a switched
435
+ // socket (SW-KL200) declares the powerLevel channel but reports it as the level
436
+ // field of a powerState output, and a blind (GR-KL300) declares the ...Indoor
437
+ // shade channels but reports the single class-64 shade bank only under the
438
+ // ...Outside ids - there the classic read (getConfig class 64) would deliver
439
+ // the identical value to both, so the alias is exact by construction. The
440
+ // level field is 0..1, NOT 0..100 like the regular output values - measured
441
+ // live: 0 while the socket is off, 1 while it powers a device (2.4.19 wrote
442
+ // "1 %" here). Matches the structure, which normalizes the switch threshold
443
+ // to 0..1 as well (levelThresholds 200/255). Scaled and clamped to the
444
+ // 0..100 state.
445
+ if (!values.has('powerLevel') && powerStateLevel !== undefined) {
446
+ values.set('powerLevel', Math.max(0, Math.min(100, Math.round(powerStateLevel * 100))));
447
+ }
448
+ for (const [indoor, outside] of [
449
+ ['shadePositionIndoor', 'shadePositionOutside'],
450
+ ['shadeOpeningAngleIndoor', 'shadeOpeningAngleOutside'],
451
+ ]) {
452
+ if (!values.has(indoor) && values.has(outside)) {
453
+ values.set(indoor, values.get(outside));
454
+ }
455
+ }
456
+ return values;
457
+ }
458
+ /**
459
+ * Where an output stands while it travels. The status leaves the value out for a
460
+ * moving output, but it carries the whole journey: status "moving", where it
461
+ * started, where it goes, and the window it takes (measured live on a dSS20
462
+ * 1.19.13: initialValue 100, targetValue 0, 24.8 s for one full blind travel).
463
+ * So the position IS known during the travel, it just has to be computed.
464
+ *
465
+ * Nothing here is assumed about how long a travel takes: the dSS sends its own
466
+ * window with every single movement, so a slow awning, a fast roller shutter and
467
+ * a short partial travel each carry their own.
468
+ *
469
+ * Clock skew between dSS and ioBroker cannot do harm: the ratio is clamped, so
470
+ * the worst case is the start or the target position.
471
+ *
472
+ * @param output one entry of a functionBlock outputs array
473
+ * @param now current time in ms
474
+ * @returns the position now, or undefined if this is no travel
475
+ */
476
+ static travelPosition(output, now) {
477
+ if (!output || output.status !== 'moving') {
478
+ return undefined;
479
+ }
480
+ const from = output.initialValue;
481
+ const to = output.targetValue;
482
+ if (typeof from !== 'number' || typeof to !== 'number' || !isFinite(from) || !isFinite(to)) {
483
+ return undefined;
484
+ }
485
+ const start = Date.parse(output.startedAt);
486
+ const end = Date.parse(output.terminatesAt);
487
+ if (!isFinite(start) || !isFinite(end) || end <= start) {
488
+ return undefined;
489
+ }
490
+ if (now >= end) {
491
+ // The window has passed but the dSS still says "moving": writing the target
492
+ // now would claim the blind arrived before it did - and it may have been
493
+ // stopped on the way. The real value is one short read away, see
494
+ // collectTravellingChannels.
495
+ return undefined;
496
+ }
497
+ const ratio = Math.max(0, (now - start) / (end - start));
498
+ return from + (to - from) * ratio;
499
+ }
500
+ /**
501
+ * The channels of a device that are still travelling, with the moment their
502
+ * travel ends. They keep an interpolated value AND stay pending: only the answer
503
+ * after the travel carries the real final position.
504
+ *
505
+ * @param statusEntry one dsDeviceStatus entry
506
+ * @param now current time in ms
507
+ * @returns output id to the end of its travel
508
+ */
509
+ static collectTravellingChannels(statusEntry, now) {
510
+ const travelling = new Map();
511
+ const blocks = (statusEntry && statusEntry.attributes && statusEntry.attributes.functionBlocks) || [];
512
+ for (const block of blocks) {
513
+ for (const output of (block && block.outputs) || []) {
514
+ if (!output || typeof output.id !== 'string' || output.status !== 'moving') {
515
+ continue;
516
+ }
517
+ const end = Date.parse(output.terminatesAt);
518
+ // The grace period keeps the channel on the fast schedule for a moment
519
+ // after the announced end: the travel is over, the value is not in the
520
+ // answer yet, and asking again in two seconds beats waiting a full
521
+ // follow-up delay. It expires, so a dSS stuck on "moving" still runs
522
+ // into the normal follow-up budget.
523
+ if (isFinite(end) && end + TRAVEL_GRACE > now) {
524
+ travelling.set(output.id, end);
525
+ }
526
+ }
527
+ }
528
+ // The indoor shade channels are served from the outside ids (see
529
+ // collectOutputValues), so they travel with them
530
+ for (const [indoor, outside] of [
531
+ ['shadePositionIndoor', 'shadePositionOutside'],
532
+ ['shadeOpeningAngleIndoor', 'shadeOpeningAngleOutside'],
533
+ ]) {
534
+ if (!travelling.has(indoor) && travelling.has(outside)) {
535
+ travelling.set(indoor, travelling.get(outside));
536
+ }
537
+ }
538
+ return travelling;
539
+ }
540
+ /**
541
+ * Writes one value the way the classic read callback would have written it.
542
+ *
543
+ * @param dev device object of the structure
544
+ * @param outputType channel type
545
+ * @param value already in the ioBroker scale of the channel
546
+ */
547
+ applyValue(dev, outputType, value) {
548
+ const roleDef = dssConstants.outputChannelUnitRoleMap[outputType];
549
+ const stateId = dev.outputChannelList && dev.outputChannelList[outputType];
550
+ if (!roleDef || !stateId) {
551
+ return 'unsupported';
552
+ }
553
+ if (outputType === 'brightness' && typeof dev.applyNativeLightValue === 'function') {
554
+ // The light helper also maintains the boolean .state (switch threshold!),
555
+ // so the value goes back to the native 0..255 scale it expects
556
+ dev.applyNativeLightValue(Math.round(value * 2.55), { skipUnchanged: true });
557
+ return 'applied';
558
+ }
559
+ if (roleDef.type === 'boolean') {
560
+ return 'unsupported';
561
+ }
562
+ if (outputType === 'x' || outputType === 'y') {
563
+ // CIE x/y arrive as 0..1 in the channel scale (measured live: 0.2235/0.3921
564
+ // in the status), the states hold 0..10000 (max 10000 / nativeMax 65535) -
565
+ // the factor of the offset read. Without it Math.round collapsed every
566
+ // coordinate to 0 or 1 since 2.4.18.
567
+ value *= 10000;
568
+ }
569
+ // The classic read callbacks round to whole numbers in the ioBroker scale
570
+ const rounded = Math.round(value);
571
+ this.structure.setStateSafe(stateId, rounded, { skipUnchanged: true });
572
+ this.structure.initialObjectValues[stateId] = rounded;
573
+ return 'applied';
574
+ }
575
+ /**
576
+ * Classic reads for everything that is still pending. Only used while the status
577
+ * request itself fails or the sync pauses - then the classic path really IS in
578
+ * charge and its reads may report info.outputApi = classic.
579
+ */
580
+ fallBackAll() {
581
+ const entries = [...this.pending.values()];
582
+ this.pending.clear();
583
+ entries.forEach(entry => this.fallBackEntry(entry, true));
584
+ }
585
+ /**
586
+ * @param entry device and the channels still pending for it
587
+ * @param report whether the classic reads may flip info.outputApi
588
+ */
589
+ fallBackEntry(entry, report) {
590
+ entry.outputTypes.forEach(outputType => this.structure.queueClassicOutputRead(entry.dev, outputType, 'medium', { report }));
591
+ }
592
+ stop() {
593
+ if (this.flushTimer) {
594
+ clearTimeout(this.flushTimer);
595
+ this.flushTimer = null;
596
+ }
597
+ this.pending.clear();
598
+ }
599
+ }
600
+ exports.SmartHomeOutputSync = SmartHomeOutputSync;
601
+ //# sourceMappingURL=dssSmartHomeSync.js.map