homebridge-smartsystem 6.1.5 → 6.2.2

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.
Files changed (71) hide show
  1. package/README.md +65 -43
  2. package/accessories/accessory.js +4 -4
  3. package/accessories/accessory.ts +1 -2
  4. package/accessories/dimmer.js +6 -6
  5. package/accessories/dimmer.ts +1 -1
  6. package/accessories/door.js +2 -2
  7. package/accessories/door.ts +1 -1
  8. package/accessories/garagedoor.js +5 -4
  9. package/accessories/garagedoor.ts +2 -1
  10. package/accessories/lock.js +6 -5
  11. package/accessories/lock.ts +2 -1
  12. package/accessories/mood.js +2 -1
  13. package/accessories/mood.ts +2 -1
  14. package/accessories/temperature.js +2 -2
  15. package/accessories/temperature.ts +1 -1
  16. package/accessories/windowcovering.js +8 -7
  17. package/accessories/windowcovering.ts +2 -1
  18. package/config.homebridge.json +3 -2
  19. package/config.json +519 -0
  20. package/config.p1.json +57 -4
  21. package/config.smappee.json +178 -2
  22. package/config.smartapp.json +63 -0
  23. package/config.system.json +234 -0
  24. package/duotecno/Q.js +8 -8
  25. package/duotecno/Q.ts +1 -1
  26. package/duotecno/api.js +73 -0
  27. package/duotecno/api.ts +61 -0
  28. package/duotecno/config.js +106 -0
  29. package/duotecno/config.ts +125 -0
  30. package/duotecno/logger.js +51 -0
  31. package/duotecno/logger.ts +41 -0
  32. package/duotecno/master.js +4 -6
  33. package/duotecno/master.ts +2 -4
  34. package/duotecno/protocol.js +10 -9
  35. package/duotecno/protocol.ts +2 -1
  36. package/duotecno/system.js +17 -41
  37. package/duotecno/system.ts +7 -34
  38. package/duotecno/types.js +58 -130
  39. package/duotecno/types.ts +76 -134
  40. package/index.spec.js +22 -35
  41. package/index.spec.ts +20 -30
  42. package/package.json +2 -2
  43. package/server/base.js +10 -38
  44. package/server/base.ts +9 -42
  45. package/server/p1.js +12 -9
  46. package/server/p1.ts +11 -9
  47. package/server/platform.js +66 -36
  48. package/server/platform.ts +47 -12
  49. package/server/powerbase.js +39 -42
  50. package/server/powerbase.ts +33 -38
  51. package/server/shelly.js +4 -4
  52. package/server/shelly.ts +3 -2
  53. package/server/smappee.js +9 -12
  54. package/server/smappee.ts +5 -8
  55. package/server/smartapp.js +99 -37
  56. package/server/smartapp.ts +79 -18
  57. package/server/socapp.js +6 -6
  58. package/server/socapp.ts +2 -1
  59. package/server/somfy.js +12 -12
  60. package/server/somfy.ts +2 -1
  61. package/server/support.js +13 -13
  62. package/server/support.ts +4 -4
  63. package/server/views/footer.ejs +6 -1
  64. package/server/views/login.ejs +57 -0
  65. package/server/views/style.ejs +1 -0
  66. package/server/views/switch-details.ejs +15 -5
  67. package/server/webapp.js +90 -6
  68. package/server/webapp.ts +87 -8
  69. package/config.groups.json +0 -8
  70. package/config.p1-dev.json +0 -6
  71. package/config.scenes.json +0 -15
package/README.md CHANGED
@@ -19,25 +19,25 @@ inherited versions of smartApp
19
19
  - v3.1 - include switches (only 1 type working) / september 2019
20
20
  - v3.1.1 - added unit-macro cmd status changes / september 2019
21
21
 
22
- ## v5.0.1, March 2020, Johan, first merge working
22
+ ### v5.0.1, March 2020, Johan, first merge working
23
23
  - new separate branch "v2.0"
24
24
 
25
- ## v5.0.2, May 2020, Johan, working version of
25
+ ### v5.0.2, May 2020, Johan, working version of
26
26
  - backup, restore
27
27
  - store scenes and execute them on status changes
28
28
  - add http switches (next to smappee - mqqt) like Shelly
29
29
 
30
- ## v5.0.5, June 2020, Johan, feature release
30
+ ### v5.0.5, June 2020, Johan, feature release
31
31
  - added "Condition" moods
32
32
  - sort on logical unit address
33
33
  - added: #, *, ! type modifiers
34
34
 
35
- ## v5.0.6, .7, .8
35
+ ### v5.0.6, .7, .8
36
36
  - (6,7) Fixed small reported issues
37
37
  - (8) Bug fixes for saving switches
38
38
  - (8) added new app
39
39
 
40
- ## v5.1.0b1
40
+ ### v5.1.0b1
41
41
  - add nr-devices in webpage of services
42
42
  - change display name (sfeer)
43
43
  - feedback of plugs
@@ -136,125 +136,142 @@ switch =>
136
136
  - removed: logicalReqNodeAddress (never used)
137
137
  - removed test configs from repo
138
138
 
139
- ## v5.6.8/9
139
+ ### v5.6.8/9
140
140
  - trying to fix connection loss
141
141
 
142
- ## v5.6.10
142
+ ### v5.6.10
143
143
  - add heartbeat to master to prevent connection loss
144
144
 
145
- ## v5.6.11
145
+ ### v5.6.11
146
146
  - fix PIR and other stuff like values for virtual units / macro's
147
147
 
148
- ## v5.6.12
148
+ ### v5.6.12
149
149
  - added logging for files
150
150
  - R2: added new version of the app v2.3.4 B2
151
151
  - R3: keep heartbeat if socket closes unexpectedly
152
152
  - R4: added not ready message
153
153
  - R5: support for short url's /node/unit/value
154
154
 
155
- ## v5.7.1
155
+ ### v5.7.1
156
156
  - smappee channel rules now accept 3+2+7 format for a channel
157
157
 
158
- ## v5.7.2
158
+ ### v5.7.2
159
159
  - smappee now has "sun" rules: low == (production < consumption>)
160
160
 
161
- ## v5.8.0
161
+ ### v5.8.0
162
162
  - Added API calls /masters/list & services /units/set & get
163
163
 
164
- ## v5.9.0
164
+ ### v5.9.0
165
165
  - added extended type selection in master->node->unit->detail page (not yet tested !!)
166
166
 
167
- ## v5.9.1
167
+ ### v5.9.1
168
168
  - added stubs for openHAB switch/dimmer/updown
169
169
 
170
- ## v5.9.2
170
+ ### v5.9.2
171
171
  - added active / used unit flag, allowing more units in the gateway, only those "actice" are sent to Homebridge
172
172
 
173
- ## v5.10.0
173
+ ### v5.10.0
174
174
  - openHAB support for up/downs, dimmers en switches. copied from smartapp.js file of Pieter Becu <pieter@bqnet.be>
175
175
 
176
- ## v5.10.1
176
+ ### v5.10.1
177
177
  - added git user.name/email to update.sh
178
178
 
179
- ## v5.10.2
179
+ ### v5.10.2
180
180
  - better upgrade to new config layout (used - active units)
181
181
 
182
- ## v5.10.3
182
+ ### v5.10.3
183
183
  - waiting for active config units (not total units)
184
184
 
185
- ## v5.10.4
185
+ ### v5.10.4
186
186
  - Extended saved type was not used on restart
187
187
 
188
- ## v5.10.5 - R1/2/3
188
+ ### v5.10.5 - R1/2/3
189
189
  - Added $T (0-511) for bindings (Hue)
190
190
  - trying to fix up/down - windowcovering
191
191
  - trying to fix ready state (nr units in systems versus in config)
192
- ## v5.10.5 - R4
192
+ ### v5.10.5 - R4
193
193
  - changed mood-press(true) to (-1)
194
- ## v5.10.5 - R5 - 26/02/2021
194
+ ### v5.10.5 - R5 - 26/02/2021
195
195
  - send "stop" to openHAB for status = 0
196
- ## v5.10.5 - R6 - 27/02/2021
196
+ ### v5.10.5 - R6 - 27/02/2021
197
197
  - app upgrade to 2.3.7
198
- ## v5.10.6 - 08/04/2021
198
+ ### v5.10.6 - 08/04/2021
199
199
  - delete spaces from backup names
200
200
  - updated files on the server: for f in *\ *.json ; do mv "$f" ${f//\ /}; done
201
201
 
202
- ## v5.11.0 - 04/06/2021
202
+ ### v5.11.0 - 04/06/2021
203
203
  - fixed bug in sun/power selection of rule
204
204
  - changed power rule functionality (now: compare channels with "sun-consumption")
205
- ## v5.11.0 - R2 - 04/06/2021
205
+ ### v5.11.0 - R2 - 04/06/2021
206
206
  - change name of master does not generate new master anymore
207
- ## v5.11.1 - 04/06/2021
207
+ ### v5.11.1 - 04/06/2021
208
208
  - turn of debug -> production
209
- ## v5.11.2 - 04/06/2021
209
+ ### v5.11.2 - 04/06/2021
210
210
  - Fixed Long standing rule editing bug: kEmptyRule included an array
211
- ## v5.11.3 - 16/08/2021
211
+ ### v5.11.3 - 16/08/2021
212
212
  - don't do request status of clicking an up/down in the web interface
213
213
  - added extra logging for heartbeats
214
- ## v5.11.5 - 17/08/2021
214
+ ### v5.11.5 - 17/08/2021
215
215
  - tryout for "no-macro" on a switch
216
216
  - fixes no-macro "save" bug
217
217
  - added send-no-stop for up/downs
218
218
 
219
- ## v5.12.0 - 18/08/2021
219
+ ### v5.12.0 - 18/08/2021
220
220
  - added reconnect in the master conf file
221
221
  - cleaned up a lot of logging
222
222
  - auto read config file in constructor
223
- ## v5.12.1 - 27-08-2021
223
+ ### v5.12.1 - 27-08-2021
224
224
  - use heartbeat to reconnect after network connection lost. Needs last version op ip master soft, in previous versions the heartbeat was broken.
225
- ## v5.12.2 - 09-01-2022
225
+ ### v5.12.2 - 09-01-2022
226
226
  - fixed problem when checking smappee switch (only used nr, not type)
227
- ## v5.12.3 - 10-01-2022
227
+ ### v5.12.3 - 10-01-2022
228
228
  - added reboot command -> in the homebridge page or as an url: /reboot
229
229
 
230
- ## v5.13.0 - 23-05-2022
230
+ ### v5.13.0 - 23-05-2022
231
231
  - added "power" bindings -> set 1/10th of value of unit to power of channels. Visualisation is done in the Pro and Lite app.
232
- ## v5.13.1 - 24-05-2022
232
+ ### v5.13.1 - 24-05-2022
233
233
  - Display nr devices on HomeBridge
234
234
 
235
- ## v5.14.0 - 19-06-2022
235
+ ### v5.14.0 - 19-06-2022
236
236
  - network settings + reboot
237
- ## v5.14.1 - todo
237
+ ### v5.14.1 - todo
238
238
  - listen on gpio pin
239
239
 
240
240
  ## v6.0.x - 01-07-2022
241
- - .1: first version running on Homebridge UI
241
+ Homebridge UI version
242
+ - .1: first working version
242
243
  - .9: read version from package.json
243
244
  - .10: removed "homekit" nav tab,
244
245
  added "restart plugin" to settings,
245
246
  set lock target state to "locked"
246
247
 
247
- ## v6.1.0 - 15-07-2022
248
+ ### v6.1.0 - 15-07-2022
248
249
  - global debug, log, err functions in types.ts
249
250
  - split smappee.ts in PowerBase + smappee/p1/shelly
250
251
 
251
- ## v6.1.x - 21-07-2022 - P1 release
252
+ ### v6.1.x - 21-07-2022 - P1 release
252
253
  - 0: implemented P1 power meter telegram
253
254
  - 1: bugfixes, timeout mgt, etc...
254
255
  - 2: try fixing logfunction errors
255
256
  - 3: reverting to console.log
256
257
  - 4: errors when starting power mgrs from platform.ts
257
258
  - 5: v6.1.3 changes were gone... restored them.
259
+ - 6: added login with pw in config + http.get with on-error
260
+ - 6: allow + and - in power rules expressions
261
+ - 7: allow NaN in bindings compare for update
262
+
263
+ ### v6.2.0 - 10-08-2022 - fully use Homebridge UI (login, config)
264
+ - receive config through Platform on startup,
265
+ - moved all config to global variable, keep in sync through API of HB-UI
266
+ - implemented login page, use HB-UI api -> bearer jwt token
267
+ - added upgrade method from 6.1.x to v6.2.x (adding files from /home/homebridge/duotecno/config.*.json to global config.*)
268
+ - homebridge config is saved by UI in: /var/lib/homebridge/config.json (as well as the logfile: homebridge.log)
269
+ - smartapp calls Homebridge UI API to save changes
270
+
271
+ ### v6.2.x - 11-08-2022 - P1 release
272
+ - 1: always write config to file too (next to sending through the HB-UI API)
273
+ - 2: added headers to http calls from switches, dimmers and up/down's (including OH stuff)
274
+
258
275
 
259
276
  ## Hardware
260
277
  A Raspberry Pi that connects to a Duotecno IP Node
@@ -355,6 +372,11 @@ sudo raspi-config
355
372
  curl -sSfL https://repo.homebridge.io/KEY.gpg | sudo gpg --dearmor | sudo tee /usr/share/keyrings/homebridge.gpg > /dev/null
356
373
  echo "deb [signed-by=/usr/share/keyrings/homebridge.gpg] https://repo.homebridge.io stable main" | sudo tee /etc/apt/sources.list.d/homebridge.list > /dev/null
357
374
 
375
+ # Deinstall old version running through pm2
376
+ pm2 stop homebridge
377
+ pm2 delete homebridge
378
+ pm2 save
379
+
358
380
  # Install Homebridge
359
381
  sudo apt-get update
360
382
  sudo apt-get --yes install homebridge
@@ -384,7 +406,7 @@ sudo npm install --save homebridge-smartsystem
384
406
              "manufacturer": "Duotecno-Coppieters",
385
407
              "name": "Duotecno",
386
408
              "platform": "DuotecnoPlatform",
387
-             "smappee": true,
409
+             "smappee": true, "shelly": false, "p1": false,
388
410
              "smartapp": true,
389
411
              "system": true,
390
412
              "socapp": false
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Accessory = void 0;
4
- const types_1 = require("../duotecno/types");
4
+ const logger_1 = require("../duotecno/logger");
5
5
  // Johan Coppieters Jan 2019
6
6
  //
7
7
  // base class for all kind of accessories on our platform
@@ -17,7 +17,7 @@ class Accessory {
17
17
  this.services.push(this.getInformationService());
18
18
  }
19
19
  makeService(service) {
20
- (0, types_1.log)("accessory", "accessory - Making service: " + this.name + ", serial: " + this.uuid_base);
20
+ (0, logger_1.log)("accessory", "accessory - Making service: " + this.name + ", serial: " + this.uuid_base);
21
21
  this.me = new service(this.name);
22
22
  return this.me;
23
23
  }
@@ -50,7 +50,7 @@ class Accessory {
50
50
  if (this.unit) {
51
51
  this.unit.reqState(unit => {
52
52
  next(null, unit.status);
53
- (0, types_1.log)("accessory", "getState was called for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> " + this.unit.status);
53
+ (0, logger_1.log)("accessory", "getState was called for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> " + this.unit.status);
54
54
  }).catch(err => next(err));
55
55
  }
56
56
  else {
@@ -61,7 +61,7 @@ class Accessory {
61
61
  if (this.unit) {
62
62
  this.unit.reqState(unit => {
63
63
  next(null, unit.value);
64
- (0, types_1.log)("accessory", "getValue was called for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> " + this.unit.value);
64
+ (0, logger_1.log)("accessory", "getValue was called for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> " + this.unit.value);
65
65
  }).catch(err => next(err));
66
66
  }
67
67
  else {
@@ -1,4 +1,4 @@
1
- import { log } from "../duotecno/types";
1
+ import { log } from "../duotecno/logger";
2
2
  import { Unit } from "../duotecno/protocol";
3
3
  import { API, HAP, Service } from "homebridge";
4
4
 
@@ -10,7 +10,6 @@ import { API, HAP, Service } from "homebridge";
10
10
  export class Accessory {
11
11
  homebridge: HAP; // homebridge api endpoint
12
12
  unit: Unit;
13
- config: any; // all config params
14
13
  name: string;
15
14
  uuid_base: string;
16
15
  services: Array<Service>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Dimmer = void 0;
4
4
  const accessory_1 = require("./accessory");
5
- const types_1 = require("../duotecno/types");
5
+ const logger_1 = require("../duotecno/logger");
6
6
  // Johan Coppieters Jan 2019
7
7
  //
8
8
  // Dimmer
@@ -31,7 +31,7 @@ class Dimmer extends accessory_1.Accessory {
31
31
  if (this.unit) {
32
32
  this.unit.reqState(unit => {
33
33
  next(null, unit.value);
34
- (0, types_1.log)("accessory", "getBrightness was called for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> " + this.unit.value);
34
+ (0, logger_1.log)("accessory", "getBrightness was called for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> " + this.unit.value);
35
35
  }).catch(err => next(err));
36
36
  }
37
37
  else {
@@ -40,10 +40,10 @@ class Dimmer extends accessory_1.Accessory {
40
40
  }
41
41
  setPower(powerOn, next) {
42
42
  this.waitingSetPower = true;
43
- (0, types_1.log)("accessory", "setPower: *** waiting *** " + powerOn);
43
+ (0, logger_1.log)("accessory", "setPower: *** waiting *** " + powerOn);
44
44
  setTimeout(() => {
45
45
  if (!this.preventSetPower) {
46
- (0, types_1.log)("accessory", "setPower: " + powerOn);
46
+ (0, logger_1.log)("accessory", "setPower: " + powerOn);
47
47
  this.unit.setState(powerOn)
48
48
  .then(() => next())
49
49
  .catch(err => next(err));
@@ -60,9 +60,9 @@ class Dimmer extends accessory_1.Accessory {
60
60
  // crush set on/off requests, bug in homekit / homebridge
61
61
  if (this.waitingSetPower) {
62
62
  this.preventSetPower = true;
63
- (0, types_1.log)("accessory", "setBrightness -> setPower: *** cancelled ***");
63
+ (0, logger_1.log)("accessory", "setBrightness -> setPower: *** cancelled ***");
64
64
  }
65
- (0, types_1.log)("accessory", "setBrightness " + value);
65
+ (0, logger_1.log)("accessory", "setBrightness " + value);
66
66
  this.unit.setState(value)
67
67
  .then(() => next())
68
68
  .catch(err => next(err));
@@ -1,7 +1,7 @@
1
1
  import { Accessory } from "./accessory";
2
2
  import { Unit } from "../duotecno/protocol";
3
3
  import { API } from "homebridge";
4
- import { log } from "../duotecno/types";
4
+ import { log } from "../duotecno/logger";
5
5
 
6
6
  // Johan Coppieters Jan 2019
7
7
  //
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Door = void 0;
4
- const types_1 = require("../duotecno/types");
4
+ const logger_1 = require("../duotecno/logger");
5
5
  const windowcovering_1 = require("./windowcovering");
6
6
  // Johan Coppieters Jun 2020
7
7
  //
@@ -68,7 +68,7 @@ class Door extends windowcovering_1.WindowCovering {
68
68
  // in response to Duotecno status messages
69
69
  updateState() {
70
70
  const value = this.DT2HB(this.unit.status);
71
- (0, types_1.log)("accessory", "Received updateState -> Homekit Door for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> " + this.unit.status + " / " + this.unit.value + " -> passing to HB: " + value);
71
+ (0, logger_1.log)("accessory", "Received updateState -> Homekit Door for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> " + this.unit.status + " / " + this.unit.value + " -> passing to HB: " + value);
72
72
  this.me.getCharacteristic(this.homebridge.Characteristic.CurrentPosition).updateValue(value);
73
73
  }
74
74
  }
@@ -1,4 +1,4 @@
1
- import { log } from "../duotecno/types";
1
+ import { log } from "../duotecno/logger";
2
2
  import { WindowCovering } from "./windowcovering";
3
3
  import { Unit } from "../duotecno/protocol";
4
4
  import { API } from "homebridge";
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GarageDoor = void 0;
4
4
  const types_1 = require("../duotecno/types");
5
+ const logger_1 = require("../duotecno/logger");
5
6
  const accessory_1 = require("./accessory");
6
7
  // Johan Coppieters Jun 2020
7
8
  //
@@ -55,7 +56,7 @@ class GarageDoor extends accessory_1.Accessory {
55
56
  try {
56
57
  this.unit.reqState(unit => {
57
58
  const hb = this.DT2HB(unit.status);
58
- (0, types_1.log)("accessory", "Get TargetDoorState of " + this.name + " = " + unit.status + " -> " + hb);
59
+ (0, logger_1.log)("accessory", "Get TargetDoorState of " + this.name + " = " + unit.status + " -> " + hb);
59
60
  next(null, hb);
60
61
  });
61
62
  }
@@ -69,18 +70,18 @@ class GarageDoor extends accessory_1.Accessory {
69
70
  this.targetState = value;
70
71
  let cmd = this.HB2DT(value);
71
72
  if (cmd) {
72
- (0, types_1.log)("accessory", "Set TargetDoorState of " + this.name + ", value =" + value + " -> cmd=" + cmd);
73
+ (0, logger_1.log)("accessory", "Set TargetDoorState of " + this.name + ", value =" + value + " -> cmd=" + cmd);
73
74
  this.unit.setState(cmd)
74
75
  .then(() => next())
75
76
  .catch(err => next(err));
76
77
  }
77
78
  else {
78
- (0, types_1.log)("accessory", "Set TargetDoorState of " + this.name + " -> failed for : " + value);
79
+ (0, logger_1.log)("accessory", "Set TargetDoorState of " + this.name + " -> failed for : " + value);
79
80
  next(new Error("TargetDoorState of " + this.name + " -> failed"));
80
81
  }
81
82
  }
82
83
  getTargetDoorState(next) {
83
- (0, types_1.log)("accessory", "Characteristic.TargetDoorState.get was called of " + this.name + " = " + this.targetState);
84
+ (0, logger_1.log)("accessory", "Characteristic.TargetDoorState.get was called of " + this.name + " = " + this.targetState);
84
85
  next(null, this.targetState);
85
86
  }
86
87
  // in response to Duotecno status messages
@@ -1,6 +1,7 @@
1
1
  import { API } from "homebridge";
2
2
  import { Unit } from "../duotecno/protocol";
3
- import { log, UnitMotorCmd, UnitState } from "../duotecno/types";
3
+ import { UnitMotorCmd, UnitState } from "../duotecno/types";
4
+ import { log } from "../duotecno/logger";
4
5
  import { Accessory } from "./accessory";
5
6
 
6
7
  // Johan Coppieters Jun 2020
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Lock = void 0;
4
4
  const types_1 = require("../duotecno/types");
5
+ const logger_1 = require("../duotecno/logger");
5
6
  const accessory_1 = require("./accessory");
6
7
  // Johan Coppieters Jun 2020
7
8
  //
@@ -14,7 +15,7 @@ class Lock extends accessory_1.Accessory {
14
15
  constructor(homebridge, unit) {
15
16
  super(homebridge, unit);
16
17
  this.targetState = 1; // locked
17
- (0, types_1.log)("accessory", "created Lock -> " + unit.getDescription());
18
+ (0, logger_1.log)("accessory", "created Lock -> " + unit.getDescription());
18
19
  // set default for Unlocked to Locked
19
20
  if (this.unit.getType() === types_1.UnitExtendedType.kUnlocker)
20
21
  unit.setState(1);
@@ -36,7 +37,7 @@ class Lock extends accessory_1.Accessory {
36
37
  this.targetState = value;
37
38
  // unlocker is a mood, a lock is a switch
38
39
  const dtVal = (this.unit.getType() === types_1.UnitExtendedType.kUnlocker) ? -1 : value;
39
- (0, types_1.log)("accessory", "HB setting target state of lock: to " + value + " of " + this.unit.getDescription() + " (duotecno: " + dtVal + ")");
40
+ (0, logger_1.log)("accessory", "HB setting target state of lock: to " + value + " of " + this.unit.getDescription() + " (duotecno: " + dtVal + ")");
40
41
  this.unit.setState(dtVal)
41
42
  .then(() => {
42
43
  //bypass ip node update mechanism of Duotecno
@@ -45,7 +46,7 @@ class Lock extends accessory_1.Accessory {
45
46
  if (this.unit.getType() === types_1.UnitExtendedType.kUnlocker) {
46
47
  // always set to "locked" after sending the request.
47
48
  this.unit.resetTimer = setTimeout(() => {
48
- (0, types_1.log)("accessory", "Autolock for an unlocker after 2 secs of " + this.unit.getDescription());
49
+ (0, logger_1.log)("accessory", "Autolock for an unlocker after 2 secs of " + this.unit.getDescription());
49
50
  this.targetState = 1;
50
51
  this.me.getCharacteristic(this.homebridge.Characteristic.LockTargetState).updateValue(1);
51
52
  this.unit.status = 1;
@@ -57,12 +58,12 @@ class Lock extends accessory_1.Accessory {
57
58
  .catch(err => next(err));
58
59
  }
59
60
  getTarget(next) {
60
- (0, types_1.log)("accessory", "HB getting target state of lock = " + this.unit.status + " of " + this.unit.getDescription());
61
+ (0, logger_1.log)("accessory", "HB getting target state of lock = " + this.unit.status + " of " + this.unit.getDescription());
61
62
  next(null, this.targetState);
62
63
  }
63
64
  getCurrent(next) {
64
65
  this.unit.reqState(unit => {
65
- (0, types_1.log)("accessory", "HB getting current state of lock = " + this.unit.status + " of " + this.unit.getDescription());
66
+ (0, logger_1.log)("accessory", "HB getting current state of lock = " + this.unit.status + " of " + this.unit.getDescription());
66
67
  next(null, !!this.unit.status);
67
68
  });
68
69
  }
@@ -1,6 +1,7 @@
1
1
  import { API } from "homebridge";
2
2
  import { Unit } from "../duotecno/protocol";
3
- import { log, UnitExtendedType } from "../duotecno/types";
3
+ import { UnitExtendedType } from "../duotecno/types";
4
+ import { log } from "../duotecno/logger";
4
5
  import { Accessory } from "./accessory";
5
6
 
6
7
  // Johan Coppieters Jun 2020
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Mood = void 0;
4
4
  const accessory_1 = require("./accessory");
5
5
  const types_1 = require("../duotecno/types");
6
+ const logger_1 = require("../duotecno/logger");
6
7
  // Johan Coppieters Jan 2019
7
8
  //
8
9
  // Mood
@@ -22,7 +23,7 @@ class Mood extends accessory_1.Accessory {
22
23
  return [moodService];
23
24
  }
24
25
  getMood(next) {
25
- (0, types_1.log)("accessory", "getMood was called for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> false");
26
+ (0, logger_1.log)("accessory", "getMood was called for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> false");
26
27
  next(null, !!this.unit.value);
27
28
  }
28
29
  setMood(value, next) {
@@ -1,5 +1,6 @@
1
1
  import { Accessory } from "./accessory";
2
- import { log, UnitExtendedType } from "../duotecno/types";
2
+ import { UnitExtendedType } from "../duotecno/types";
3
+ import { log } from "../duotecno/logger";
3
4
  import { Unit } from "../duotecno/protocol";
4
5
  import { API } from "homebridge";
5
6
 
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Temperature = void 0;
4
4
  const accessory_1 = require("./accessory");
5
- const types_1 = require("../duotecno/types");
5
+ const logger_1 = require("../duotecno/logger");
6
6
  // Johan Coppieters Jan 2019
7
7
  //
8
8
  // Temperature Sensor
@@ -23,7 +23,7 @@ class Temperature extends accessory_1.Accessory {
23
23
  getTemperature(next) {
24
24
  if (this.unit) {
25
25
  this.unit.reqState(unit => {
26
- (0, types_1.log)("accessory", "reqState/getTemperature returned a value for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> " + this.unit.value);
26
+ (0, logger_1.log)("accessory", "reqState/getTemperature returned a value for " + this.unit.node.getName() + " - " + this.unit.getName() + " -> " + this.unit.value);
27
27
  next(null, unit.value / 10.0);
28
28
  })
29
29
  .catch(err => next(err));
@@ -1,5 +1,5 @@
1
1
  import { Accessory } from "./accessory";
2
- import { log } from "../duotecno/types";
2
+ import { log } from "../duotecno/logger";
3
3
  import { Unit } from "../duotecno/protocol";
4
4
  import { API } from "homebridge";
5
5
 
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WindowCovering = void 0;
4
4
  const accessory_1 = require("./accessory");
5
5
  const types_1 = require("../duotecno/types");
6
+ const logger_1 = require("../duotecno/logger");
6
7
  // Johan Coppieters v1: Jan 2019, v2: Jun 2020
7
8
  //
8
9
  // WindowCovering
@@ -86,11 +87,11 @@ class WindowCovering extends accessory_1.Accessory {
86
87
  return 50;
87
88
  }
88
89
  getPositionState(next) {
89
- (0, types_1.log)("accessory", "get PositionState was called of " + this.name + " -> " + this.targetState);
90
+ (0, logger_1.log)("accessory", "get PositionState was called of " + this.name + " -> " + this.targetState);
90
91
  next(null, this.targetState);
91
92
  }
92
93
  getCurrentPosition(next) {
93
- (0, types_1.log)("accessory", "get CurrentPosition was called of " + this.name);
94
+ (0, logger_1.log)("accessory", "get CurrentPosition was called of " + this.name);
94
95
  this.unit.reqState(unit => {
95
96
  if (unit.status == types_1.UnitState.kOpen)
96
97
  next(null, 100);
@@ -103,7 +104,7 @@ class WindowCovering extends accessory_1.Accessory {
103
104
  setTargetPosition(value, next) {
104
105
  // homekit is giving 0-100 for windows
105
106
  // the smartbox -> 5=down, 4=up, 3=stop
106
- (0, types_1.log)("accessory", "set Characteristic.TargetPosition was called with value = " + value);
107
+ (0, logger_1.log)("accessory", "set Characteristic.TargetPosition was called with value = " + value);
107
108
  let cmd = 0;
108
109
  if (value == 100) {
109
110
  cmd = types_1.UnitMotorCmd.kOpen;
@@ -114,13 +115,13 @@ class WindowCovering extends accessory_1.Accessory {
114
115
  else {
115
116
  cmd = types_1.UnitMotorCmd.kStop;
116
117
  }
117
- (0, types_1.log)("accessory", "setUpDown, value =" + value + " -> cmd=" + cmd);
118
+ (0, logger_1.log)("accessory", "setUpDown, value =" + value + " -> cmd=" + cmd);
118
119
  this.unit.setState(cmd)
119
120
  .then(() => next())
120
121
  .catch(err => next(err));
121
122
  }
122
123
  getTargetPosition(next) {
123
- (0, types_1.log)("accessory", "get Characteristic.TargetPosition was called");
124
+ (0, logger_1.log)("accessory", "get Characteristic.TargetPosition was called");
124
125
  this.unit.reqState(unit => {
125
126
  if (this.unit.status == types_1.UnitState.kOpen)
126
127
  next(null, 100);
@@ -137,11 +138,11 @@ class WindowCovering extends accessory_1.Accessory {
137
138
  this.me.getCharacteristic(this.homebridge.Characteristic.CurrentPosition).updateValue(value);
138
139
  if (this.unit.status == types_1.UnitState.kClosing) {
139
140
  this.me.getCharacteristic(this.homebridge.Characteristic.TargetPosition).updateValue(0);
140
- (0, types_1.log)("accessory", "Setting targetposition to 0");
141
+ (0, logger_1.log)("accessory", "Setting targetposition to 0");
141
142
  }
142
143
  else if (this.unit.status == types_1.UnitState.kOpening) {
143
144
  this.me.getCharacteristic(this.homebridge.Characteristic.TargetPosition).updateValue(100);
144
- (0, types_1.log)("accessory", "Setting targetposition to 100");
145
+ (0, logger_1.log)("accessory", "Setting targetposition to 100");
145
146
  }
146
147
  }
147
148
  }
@@ -1,5 +1,6 @@
1
1
  import { Accessory } from "./accessory";
2
- import { log, UnitMotorCmd, UnitState } from "../duotecno/types";
2
+ import { UnitMotorCmd, UnitState } from "../duotecno/types";
3
+ import { log } from "../duotecno/logger";
3
4
  import { Unit } from "../duotecno/protocol";
4
5
  import { API } from "homebridge";
5
6
 
@@ -12,10 +12,11 @@
12
12
  "platform": "DuotecnoPlatform",
13
13
  "smappee": true,
14
14
  "p1": true,
15
- "shelly": true,
15
+ "shelly": false,
16
16
  "smartapp": true,
17
17
  "system": true,
18
- "socapp": false
18
+ "socapp": false,
19
+ "password": "Tester"
19
20
  }
20
21
  ],
21
22
  "accessories": []