iobroker.bshb 0.2.1 → 0.2.4

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 (66) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +14 -20
  3. package/admin/i18n/de/translations.json +3 -1
  4. package/admin/i18n/en/translations.json +3 -1
  5. package/admin/i18n/es/translations.json +3 -1
  6. package/admin/i18n/fr/translations.json +3 -1
  7. package/admin/i18n/it/translations.json +3 -1
  8. package/admin/i18n/nl/translations.json +3 -1
  9. package/admin/i18n/pl/translations.json +3 -1
  10. package/admin/i18n/pt/translations.json +3 -1
  11. package/admin/i18n/ru/translations.json +3 -1
  12. package/admin/i18n/uk/translations.json +12 -0
  13. package/admin/i18n/zh-cn/translations.json +3 -1
  14. package/admin/jsonConfig.json +8 -0
  15. package/build/bshb-controller.js +166 -156
  16. package/build/bshb-controller.js.map +1 -1
  17. package/build/bshb-definition.js +99 -99
  18. package/build/bshb-logger.js +70 -69
  19. package/build/bshb-logger.js.map +1 -1
  20. package/build/client-cert.js +30 -28
  21. package/build/client-cert.js.map +1 -1
  22. package/build/controller/handler/bshb-air-purity-guardian-handler.js +110 -124
  23. package/build/controller/handler/bshb-air-purity-guardian-handler.js.map +1 -1
  24. package/build/controller/handler/bshb-climate-handler.js +162 -0
  25. package/build/controller/handler/bshb-climate-handler.js.map +1 -0
  26. package/build/controller/handler/bshb-device-handler.js +417 -409
  27. package/build/controller/handler/bshb-device-handler.js.map +1 -1
  28. package/build/controller/handler/bshb-device-status-update-handler.js +30 -0
  29. package/build/controller/handler/bshb-device-status-update-handler.js.map +1 -0
  30. package/build/controller/handler/bshb-general-update-handler.js +36 -39
  31. package/build/controller/handler/bshb-general-update-handler.js.map +1 -1
  32. package/build/controller/handler/bshb-handler.js +167 -149
  33. package/build/controller/handler/bshb-handler.js.map +1 -1
  34. package/build/controller/handler/bshb-intrusion-detection-handler.js +211 -0
  35. package/build/controller/handler/bshb-intrusion-detection-handler.js.map +1 -0
  36. package/build/controller/handler/bshb-messages-handler.js +52 -57
  37. package/build/controller/handler/bshb-messages-handler.js.map +1 -1
  38. package/build/controller/handler/bshb-motion-lights-handler.js +93 -107
  39. package/build/controller/handler/bshb-motion-lights-handler.js.map +1 -1
  40. package/build/controller/handler/bshb-open-door-window-handler.js +175 -179
  41. package/build/controller/handler/bshb-open-door-window-handler.js.map +1 -1
  42. package/build/controller/handler/bshb-room-handler.js +128 -0
  43. package/build/controller/handler/bshb-room-handler.js.map +1 -0
  44. package/build/controller/handler/bshb-scenario-handler.js +106 -127
  45. package/build/controller/handler/bshb-scenario-handler.js.map +1 -1
  46. package/build/controller/handler/bshb-water-alarm-handler.js +119 -138
  47. package/build/controller/handler/bshb-water-alarm-handler.js.map +1 -1
  48. package/build/definition/function.js +19 -19
  49. package/build/definition/roles.js +191 -170
  50. package/build/definition/roles.js.map +1 -1
  51. package/build/definition/states.js +270 -247
  52. package/build/definition/states.js.map +1 -1
  53. package/build/definition/units.js +52 -45
  54. package/build/definition/units.js.map +1 -1
  55. package/build/definition/write.js +23 -20
  56. package/build/definition/write.js.map +1 -1
  57. package/build/log-level.js +18 -18
  58. package/build/main.js +421 -411
  59. package/build/main.js.map +1 -1
  60. package/build/migration.js +69 -69
  61. package/build/utils.js +81 -67
  62. package/build/utils.js.map +1 -1
  63. package/io-package.json +52 -39
  64. package/package.json +20 -24
  65. package/build/controller/handler/bshb-intrusion-detection.js +0 -111
  66. package/build/controller/handler/bshb-intrusion-detection.js.map +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Christopher Holomek <holomekc.github@gmail.com>
3
+ Copyright (c) 2023 Christopher Holomek <holomekc.github@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -35,6 +35,18 @@ If you want to support the work I would appreciate a small donation. This is 100
35
35
 
36
36
  ## Changelog
37
37
 
38
+ ### 0.2.4
39
+ * (holomekc) Update the adapter to the latest requirements
40
+
41
+ ### 0.2.3
42
+ * (holomekc) Update to api version 3.2
43
+ * (holomekc) Add support for climate schedules with two options to activate them
44
+ * (holomekc) Update intrusion detection so that more information is shown
45
+ * (holomekc) Update intrusion detection and climate schedule switches stay active now
46
+
47
+ ### 0.2.2
48
+ * (holomekc) Support for rooms. Configuration to ignore server certificates. Allow ttesting controller 2 and can prevent issues in case certificates expire. Less secure though.
49
+
38
50
  ### 0.2.1
39
51
  * (holomekc) Support for additional services
40
52
 
@@ -179,24 +191,6 @@ If you want to support the work I would appreciate a small donation. This is 100
179
191
 
180
192
  ## License
181
193
 
182
- MIT License
183
-
184
- Copyright (c) 2022 Christopher Holomek <holomekc.github@gmail.com>
185
-
186
- Permission is hereby granted, free of charge, to any person obtaining a copy
187
- of this software and associated documentation files (the "Software"), to deal
188
- in the Software without restriction, including without limitation the rights
189
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
190
- copies of the Software, and to permit persons to whom the Software is
191
- furnished to do so, subject to the following conditions:
192
-
193
- The above copyright notice and this permission notice shall be included in all
194
- copies or substantial portions of the Software.
194
+ The MIT License (MIT)
195
195
 
196
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
197
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
198
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
199
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
200
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
201
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
202
- SOFTWARE.
196
+ Copyright (c) 2023 Christopher Holomek <holomekc.github@gmail.com>
@@ -6,5 +6,7 @@
6
6
  "systemPassword-detail": "Kann nach dem Koppeln entfernt werden",
7
7
  "pairingDelay": "Verzögerung bei Kopplungsversuchen in ms",
8
8
  "pairingDelay-detail": "Wartezeit während des Kopplungsprozesses",
9
- "rateLimit": "Verzögerung zwischen Controller Aufrufen in ms"
9
+ "rateLimit": "Verzögerung zwischen Controller Aufrufen in ms",
10
+ "skipServerCertificateCheck": "Überprüfung des Serverzertifikats überspringen",
11
+ "skipServerCertificateCheck-detail": "Reduziert die Sicherheit der Verbindung. Nutzung auf eigene Gefahr."
10
12
  }
@@ -6,5 +6,7 @@
6
6
  "systemPassword-detail": "Can be removed after pairing",
7
7
  "pairingDelay": "Delay during pairing attempts in ms",
8
8
  "pairingDelay-detail": "Time waiting during pairing process attempts",
9
- "rateLimit": "Delay between controller calls in ms"
9
+ "rateLimit": "Delay between controller calls in ms",
10
+ "skipServerCertificateCheck": "Skip server certificate check",
11
+ "skipServerCertificateCheck-detail": "Reduces the security of the connection. Use at your own risk."
10
12
  }
@@ -6,5 +6,7 @@
6
6
  "systemPassword-detail": "Se puede quitar después del emparejamiento",
7
7
  "pairingDelay": "Retardo durante los intentos de emparejamiento en ms",
8
8
  "pairingDelay-detail": "Tiempo de espera durante los intentos de emparejamiento",
9
- "rateLimit": "Retraso entre llamadas del controlador en ms"
9
+ "rateLimit": "Retraso entre llamadas del controlador en ms",
10
+ "skipServerCertificateCheck": "Omitir la comprobación del certificado del servidor",
11
+ "skipServerCertificateCheck-detail": "Reduce la seguridad de la conexión. Utilícelo bajo su propia responsabilidad."
10
12
  }
@@ -6,5 +6,7 @@
6
6
  "systemPassword-detail": "Peut être retiré après l'appairage",
7
7
  "pairingDelay": "Délai pendant les tentatives d'appairage en ms",
8
8
  "pairingDelay-detail": "Temps d'attente pendant les tentatives de pairage",
9
- "rateLimit": "Délai entre les appels du contrôleur en ms"
9
+ "rateLimit": "Délai entre les appels du contrôleur en ms",
10
+ "skipServerCertificateCheck": "Ignorer la vérification du certificat du serveur",
11
+ "skipServerCertificateCheck-detail": "Réduit la sécurité de la connexion. A utiliser à vos risques et périls."
10
12
  }
@@ -6,5 +6,7 @@
6
6
  "systemPassword-detail": "Può essere rimosso dopo l'accoppiamento",
7
7
  "pairingDelay": "Ritardo durante i tentativi di accoppiamento in ms",
8
8
  "pairingDelay-detail": "Tempo di attesa durante i tentativi del processo di accoppiamento",
9
- "rateLimit": "Ritardo tra le chiamate del controllore in ms"
9
+ "rateLimit": "Ritardo tra le chiamate del controllore in ms",
10
+ "skipServerCertificateCheck": "Saltare la verifica del certificato del server",
11
+ "skipServerCertificateCheck-detail": "Riduce la sicurezza della connessione. Utilizzare a proprio rischio e pericolo."
10
12
  }
@@ -6,5 +6,7 @@
6
6
  "systemPassword-detail": "Kan na het koppelen worden verwijderd",
7
7
  "pairingDelay": "Vertraging tijdens koppelingspogingen in ms",
8
8
  "pairingDelay-detail": "Tijd die wacht tijdens de koppelingspogingen",
9
- "rateLimit": "Vertraging tussen controlleroproepen in ms"
9
+ "rateLimit": "Vertraging tussen controlleroproepen in ms",
10
+ "skipServerCertificateCheck": "Controle servercertificaat overslaan",
11
+ "skipServerCertificateCheck-detail": "Vermindert de veiligheid van de verbinding. Gebruik op eigen risico."
10
12
  }
@@ -6,5 +6,7 @@
6
6
  "systemPassword-detail": "Może być usunięty po sparowaniu.",
7
7
  "pairingDelay": "Opóźnienie podczas prób parowania w ms",
8
8
  "pairingDelay-detail": "Czas oczekiwania podczas prób parowania",
9
- "rateLimit": "Opóźnienie między wywołaniami kontrolera w ms"
9
+ "rateLimit": "Opóźnienie między wywołaniami kontrolera w ms",
10
+ "skipServerCertificateCheck": "Pomiń sprawdzanie certyfikatu serwera",
11
+ "skipServerCertificateCheck-detail": "Zmniejsza bezpieczeństwo połączenia. Używaj na własne ryzyko."
10
12
  }
@@ -6,5 +6,7 @@
6
6
  "systemPassword-detail": "Pode ser removido após o emparelhamento",
7
7
  "pairingDelay": "Atraso durante as tentativas de emparelhamento em ms",
8
8
  "pairingDelay-detail": "Tempo de espera durante as tentativas do processo de emparelhamento",
9
- "rateLimit": "Atraso entre as chamadas do controlador em ms"
9
+ "rateLimit": "Atraso entre as chamadas do controlador em ms",
10
+ "skipServerCertificateCheck": "Ignorar certificado do servidor de verificação",
11
+ "skipServerCertificateCheck-detail": "Reduz a segurança da ligação. Utilização por sua conta e risco."
10
12
  }
@@ -6,5 +6,7 @@
6
6
  "systemPassword-detail": "Может быть удален после сопряжения",
7
7
  "pairingDelay": "Задержка при попытках сопряжения в мс",
8
8
  "pairingDelay-detail": "Время ожидания во время попыток сопряжения",
9
- "rateLimit": "Задержка между вызовами контроллера в мс"
9
+ "rateLimit": "Задержка между вызовами контроллера в мс",
10
+ "skipServerCertificateCheck": "Пропустить проверку сертификата сервера",
11
+ "skipServerCertificateCheck-detail": "Снижает безопасность соединения. Используйте на свой страх и риск."
10
12
  }
@@ -0,0 +1,12 @@
1
+ {
2
+ "host": "IP-адреса контролера розумного будинку Bosch",
3
+ "identifier": "Унікальний ідентифікатор створеного клієнта",
4
+ "identifier-detail": "рекомендується uuidv4",
5
+ "systemPassword": "Системний пароль контролера розумного будинку Bosch",
6
+ "systemPassword-detail": "Можна зняти після створення пари",
7
+ "pairingDelay": "Затримка під час спроб сполучення в мс",
8
+ "pairingDelay-detail": "Час очікування під час спроб створення пари",
9
+ "rateLimit": "Затримка між викликами контролера в мс",
10
+ "skipServerCertificateCheck": "Пропустити перевірку сертифіката сервера",
11
+ "skipServerCertificateCheck-detail": "Знижує безпеку з'єднання. Використовуйте на свій страх і ризик."
12
+ }
@@ -6,5 +6,7 @@
6
6
  "systemPassword-detail": "配对后即可移除",
7
7
  "pairingDelay": "配对尝试期间的延迟(毫秒",
8
8
  "pairingDelay-detail": "配对过程中的等待时间",
9
- "rateLimit": "控制器调用之间的延迟,单位为ms"
9
+ "rateLimit": "控制器调用之间的延迟,单位为ms",
10
+ "skipServerCertificateCheck": "跳过检查服务器证书",
11
+ "skipServerCertificateCheck-detail": "降低了连接的安全性。使用时风险自负。"
10
12
  }
@@ -42,6 +42,14 @@
42
42
  "min": 1000,
43
43
  "sm": 12,
44
44
  "md": 6
45
+ },
46
+ "skipServerCertificateCheck": {
47
+ "type": "checkbox",
48
+ "label": "skipServerCertificateCheck",
49
+ "help": "skipServerCertificateCheck-detail",
50
+ "newLine": true,
51
+ "sm": 12,
52
+ "md": 6
45
53
  }
46
54
  }
47
55
  }
@@ -1,157 +1,167 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BshbController = void 0;
4
- const bosch_smart_home_bridge_1 = require("bosch-smart-home-bridge");
5
- const bshb_logger_1 = require("./bshb-logger");
6
- const rxjs_1 = require("rxjs");
7
- const operators_1 = require("rxjs/operators");
8
- const utils_1 = require("./utils");
9
- const bshb_scenario_handler_1 = require("./controller/handler/bshb-scenario-handler");
10
- const bshb_device_handler_1 = require("./controller/handler/bshb-device-handler");
11
- const bshb_messages_handler_1 = require("./controller/handler/bshb-messages-handler");
12
- const bshb_open_door_window_handler_1 = require("./controller/handler/bshb-open-door-window-handler");
13
- const bshb_intrusion_detection_1 = require("./controller/handler/bshb-intrusion-detection");
14
- const bshb_general_update_handler_1 = require("./controller/handler/bshb-general-update-handler");
15
- const bshb_air_purity_guardian_handler_1 = require("./controller/handler/bshb-air-purity-guardian-handler");
16
- const bshb_motion_lights_handler_1 = require("./controller/handler/bshb-motion-lights-handler");
17
- const bshb_water_alarm_handler_1 = require("./controller/handler/bshb-water-alarm-handler");
18
- /**
19
- * This controller encapsulates bosch-smart-home-bridge and provides it to iobroker.bshb
20
- *
21
- * @author Christopher Holomek
22
- * @since 27.09.2019
23
- */
24
- class BshbController {
25
- /**
26
- * Create a new instance of {@link BshbController}
27
- *
28
- * @param bshb
29
- * instance of {@link Bshb}
30
- * @param clientCert
31
- * client certificate
32
- * @param clientPrivateKey
33
- * client private key
34
- */
35
- constructor(bshb, clientCert, clientPrivateKey) {
36
- this.bshb = bshb;
37
- this.clientName = 'ioBroker.bshb';
38
- this.$rateLimit = new rxjs_1.Subject();
39
- try {
40
- this.boschSmartHomeBridge = bosch_smart_home_bridge_1.BoschSmartHomeBridgeBuilder.builder()
41
- .withHost(bshb.config.host)
42
- .withClientCert(clientCert)
43
- .withClientPrivateKey(clientPrivateKey)
44
- .withLogger(new bshb_logger_1.BshbLogger(bshb))
45
- .build();
46
- this.handlers = [];
47
- this.handlers.push(new bshb_general_update_handler_1.BshbGeneralUpdateHandler(this.bshb, this.boschSmartHomeBridge));
48
- this.handlers.push(new bshb_scenario_handler_1.BshbScenarioHandler(this.bshb, this.boschSmartHomeBridge));
49
- this.handlers.push(new bshb_messages_handler_1.BshbMessagesHandler(this.bshb, this.boschSmartHomeBridge));
50
- this.handlers.push(new bshb_intrusion_detection_1.BshbIntrusionDetection(this.bshb, this.boschSmartHomeBridge));
51
- this.handlers.push(new bshb_air_purity_guardian_handler_1.BshbAirPurityGuardianHandler(this.bshb, this.boschSmartHomeBridge));
52
- this.handlers.push(new bshb_motion_lights_handler_1.BshbMotionLightsHandler(this.bshb, this.boschSmartHomeBridge));
53
- this.handlers.push(new bshb_water_alarm_handler_1.BshbWaterAlarmHandler(this.bshb, this.boschSmartHomeBridge));
54
- this.handlers.push(new bshb_device_handler_1.BshbDeviceHandler(this.bshb, this.boschSmartHomeBridge));
55
- this.handlers.push(new bshb_open_door_window_handler_1.BshbOpenDoorWindowHandler(this.bshb, this.boschSmartHomeBridge));
56
- this.$rateLimit.pipe((0, rxjs_1.concatMap)(data => {
57
- if (this.bshb.config.rateLimit === 0) {
58
- return (0, rxjs_1.of)(data);
59
- }
60
- return (0, rxjs_1.of)(data).pipe((0, operators_1.delay)(this.bshb.config.rateLimit));
61
- })).subscribe(fnc => {
62
- fnc();
63
- });
64
- }
65
- catch (e) {
66
- if (e instanceof Error) {
67
- throw utils_1.Utils.createError(bshb.log, e.message);
68
- }
69
- else {
70
- throw utils_1.Utils.createError(bshb.log, e);
71
- }
72
- }
73
- }
74
- getBshcClient() {
75
- return this.boschSmartHomeBridge.getBshcClient();
76
- }
77
- /**
78
- * Pair devices if needed
79
- *
80
- * @param systemPassword
81
- * system password of BSHC
82
- */
83
- pairDeviceIfNeeded(systemPassword) {
84
- let pairingDelay = 5000;
85
- if (this.bshb.config.pairingDelay && this.bshb.config.pairingDelay > 5000) {
86
- pairingDelay = this.bshb.config.pairingDelay;
87
- }
88
- // Retry pairIfNeeded logic. It is a bit more complicated compared to before because pairIfNeeded completes stream after attempts.
89
- // Community wants that it reconnects all the time. But pairIfNeeded might not be suitable because client may be paired already but
90
- // connection is broken. Then pairIfNeeded never goes back to test if client is paired and is stuck.
91
- // Here we retry the pairIfNeeded without attempts configured. So we try once. If something is not ok we wait
92
- // for pairing delay before we try again. We use takeUntil to make sure that we stop streams if adapter shuts-down
93
- // takeUntil must be last in pipe to prevent issues.
94
- return new rxjs_1.Observable(subscriber => {
95
- const retry = new rxjs_1.BehaviorSubject(true);
96
- retry.pipe((0, operators_1.catchError)(err => err.pipe((0, operators_1.delay)(pairingDelay))), (0, operators_1.tap)(() => {
97
- this.boschSmartHomeBridge.pairIfNeeded(this.clientName, this.bshb.config.identifier, systemPassword, pairingDelay, -1).pipe((0, operators_1.takeUntil)(this.bshb.alive)).subscribe({
98
- next: response => {
99
- // Everything is ok. We can stop all.
100
- subscriber.next(response);
101
- subscriber.complete();
102
- retry.complete();
103
- }, error: () => {
104
- // Something went wrong. Already logged by lib. We just wait and retry.
105
- (0, rxjs_1.timer)(pairingDelay).pipe((0, operators_1.takeUntil)(this.bshb.alive)).subscribe(() => {
106
- retry.next(true);
107
- });
108
- }
109
- });
110
- }), (0, operators_1.takeUntil)(this.bshb.alive)).subscribe(() => {
111
- // We do not care
112
- });
113
- });
114
- }
115
- /**
116
- * Start overall detection
117
- *
118
- * @return observable with no content
119
- */
120
- startDetection() {
121
- return (0, rxjs_1.concat)(...this.handlers.map(value => value.handleDetection())).pipe((0, rxjs_1.last)(undefined, void 0));
122
- }
123
- /**
124
- * Changes on a state which results in a call to bshc controller
125
- *
126
- * @param id
127
- * id of state which changed
128
- * @param state
129
- * state itself
130
- */
131
- setState(id, state) {
132
- this.$rateLimit.next(() => {
133
- for (let i = 0; i < this.handlers.length; i++) {
134
- let handled = this.handlers[i].sendUpdateToBshc(id, state);
135
- if (handled) {
136
- this.bshb.log.silly(`Handler "${this.handlers[i].constructor.name}" send message to controller with state id=${id} and value=${state.val}`);
137
- }
138
- }
139
- });
140
- }
141
- /**
142
- * Changes from bshc controller which results in updates on ioBroker state
143
- *
144
- * @param resultEntry
145
- * entry of changes which will be mapped to a state
146
- */
147
- setStateAck(resultEntry) {
148
- for (let i = 0; i < this.handlers.length; i++) {
149
- let handled = this.handlers[i].handleBshcUpdate(resultEntry);
150
- if (handled) {
151
- this.bshb.log.silly(`Handler "${this.handlers[i].constructor.name}" handled update form controller with result entry: ${JSON.stringify(resultEntry)} `);
152
- }
153
- }
154
- }
155
- }
156
- exports.BshbController = BshbController;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BshbController = void 0;
4
+ const bosch_smart_home_bridge_1 = require("bosch-smart-home-bridge");
5
+ const bshb_logger_1 = require("./bshb-logger");
6
+ const rxjs_1 = require("rxjs");
7
+ const operators_1 = require("rxjs/operators");
8
+ const utils_1 = require("./utils");
9
+ const bshb_scenario_handler_1 = require("./controller/handler/bshb-scenario-handler");
10
+ const bshb_device_handler_1 = require("./controller/handler/bshb-device-handler");
11
+ const bshb_messages_handler_1 = require("./controller/handler/bshb-messages-handler");
12
+ const bshb_open_door_window_handler_1 = require("./controller/handler/bshb-open-door-window-handler");
13
+ const bshb_intrusion_detection_handler_1 = require("./controller/handler/bshb-intrusion-detection-handler");
14
+ const bshb_general_update_handler_1 = require("./controller/handler/bshb-general-update-handler");
15
+ const bshb_air_purity_guardian_handler_1 = require("./controller/handler/bshb-air-purity-guardian-handler");
16
+ const bshb_motion_lights_handler_1 = require("./controller/handler/bshb-motion-lights-handler");
17
+ const bshb_water_alarm_handler_1 = require("./controller/handler/bshb-water-alarm-handler");
18
+ const bshb_room_handler_1 = require("./controller/handler/bshb-room-handler");
19
+ const bshb_device_status_update_handler_1 = require("./controller/handler/bshb-device-status-update-handler");
20
+ const bshb_climate_handler_1 = require("./controller/handler/bshb-climate-handler");
21
+ /**
22
+ * This controller encapsulates bosch-smart-home-bridge and provides it to iobroker.bshb
23
+ *
24
+ * @author Christopher Holomek
25
+ * @since 27.09.2019
26
+ */
27
+ class BshbController {
28
+ bshb;
29
+ boschSmartHomeBridge;
30
+ clientName = 'ioBroker.bshb';
31
+ $rateLimit = new rxjs_1.Subject();
32
+ handlers;
33
+ /**
34
+ * Create a new instance of {@link BshbController}
35
+ *
36
+ * @param bshb
37
+ * instance of {@link Bshb}
38
+ * @param clientCert
39
+ * client certificate
40
+ * @param clientPrivateKey
41
+ * client private key
42
+ */
43
+ constructor(bshb, clientCert, clientPrivateKey) {
44
+ this.bshb = bshb;
45
+ try {
46
+ this.boschSmartHomeBridge = bosch_smart_home_bridge_1.BoschSmartHomeBridgeBuilder.builder()
47
+ .withHost(bshb.config.host)
48
+ .withClientCert(clientCert)
49
+ .withClientPrivateKey(clientPrivateKey)
50
+ .withLogger(new bshb_logger_1.BshbLogger(bshb))
51
+ .withIgnoreCertificateCheck(this.bshb.config.skipServerCertificateCheck)
52
+ .build();
53
+ this.handlers = [];
54
+ this.handlers.push(new bshb_general_update_handler_1.BshbGeneralUpdateHandler(this.bshb, this.boschSmartHomeBridge));
55
+ this.handlers.push(new bshb_scenario_handler_1.BshbScenarioHandler(this.bshb, this.boschSmartHomeBridge));
56
+ this.handlers.push(new bshb_device_status_update_handler_1.BshbDeviceStatusUpdateHandler(this.bshb, this.boschSmartHomeBridge));
57
+ this.handlers.push(new bshb_messages_handler_1.BshbMessagesHandler(this.bshb, this.boschSmartHomeBridge));
58
+ this.handlers.push(new bshb_intrusion_detection_handler_1.BshbIntrusionDetectionHandler(this.bshb, this.boschSmartHomeBridge));
59
+ this.handlers.push(new bshb_air_purity_guardian_handler_1.BshbAirPurityGuardianHandler(this.bshb, this.boschSmartHomeBridge));
60
+ this.handlers.push(new bshb_motion_lights_handler_1.BshbMotionLightsHandler(this.bshb, this.boschSmartHomeBridge));
61
+ this.handlers.push(new bshb_water_alarm_handler_1.BshbWaterAlarmHandler(this.bshb, this.boschSmartHomeBridge));
62
+ this.handlers.push(new bshb_room_handler_1.BshbRoomHandler(this.bshb, this.boschSmartHomeBridge));
63
+ this.handlers.push(new bshb_device_handler_1.BshbDeviceHandler(this.bshb, this.boschSmartHomeBridge));
64
+ this.handlers.push(new bshb_open_door_window_handler_1.BshbOpenDoorWindowHandler(this.bshb, this.boschSmartHomeBridge));
65
+ this.handlers.push(new bshb_climate_handler_1.BshbClimateHandler(this.bshb, this.boschSmartHomeBridge));
66
+ this.$rateLimit.pipe((0, rxjs_1.concatMap)(data => {
67
+ if (this.bshb.config.rateLimit === 0) {
68
+ return (0, rxjs_1.of)(data);
69
+ }
70
+ return (0, rxjs_1.of)(data).pipe((0, operators_1.delay)(this.bshb.config.rateLimit));
71
+ })).subscribe(fnc => {
72
+ fnc();
73
+ });
74
+ }
75
+ catch (e) {
76
+ if (e instanceof Error) {
77
+ throw utils_1.Utils.createError(bshb.log, e.message);
78
+ }
79
+ else {
80
+ throw utils_1.Utils.createError(bshb.log, e);
81
+ }
82
+ }
83
+ }
84
+ getBshcClient() {
85
+ return this.boschSmartHomeBridge.getBshcClient();
86
+ }
87
+ /**
88
+ * Pair devices if needed
89
+ *
90
+ * @param systemPassword
91
+ * system password of BSHC
92
+ */
93
+ pairDeviceIfNeeded(systemPassword) {
94
+ let pairingDelay = 5000;
95
+ if (this.bshb.config.pairingDelay && this.bshb.config.pairingDelay > 5000) {
96
+ pairingDelay = this.bshb.config.pairingDelay;
97
+ }
98
+ // Retry pairIfNeeded logic. It is a bit more complicated compared to before because pairIfNeeded completes stream after attempts.
99
+ // Community wants that it reconnects all the time. But pairIfNeeded might not be suitable because client may be paired already but
100
+ // connection is broken. Then pairIfNeeded never goes back to test if client is paired and is stuck.
101
+ // Here we retry the pairIfNeeded without attempts configured. So we try once. If something is not ok we wait
102
+ // for pairing delay before we try again. We use takeUntil to make sure that we stop streams if adapter shuts-down
103
+ // takeUntil must be last in pipe to prevent issues.
104
+ return new rxjs_1.Observable(subscriber => {
105
+ const retry = new rxjs_1.BehaviorSubject(true);
106
+ retry.pipe((0, operators_1.catchError)(err => err.pipe((0, operators_1.delay)(pairingDelay))), (0, operators_1.tap)(() => {
107
+ this.boschSmartHomeBridge.pairIfNeeded(this.clientName, this.bshb.config.identifier, systemPassword, pairingDelay, -1).pipe((0, operators_1.takeUntil)(this.bshb.alive)).subscribe({
108
+ next: response => {
109
+ // Everything is ok. We can stop all.
110
+ subscriber.next(response);
111
+ subscriber.complete();
112
+ retry.complete();
113
+ }, error: () => {
114
+ // Something went wrong. Already logged by lib. We just wait and retry.
115
+ (0, rxjs_1.timer)(pairingDelay).pipe((0, operators_1.takeUntil)(this.bshb.alive)).subscribe(() => {
116
+ retry.next(true);
117
+ });
118
+ }
119
+ });
120
+ }), (0, operators_1.takeUntil)(this.bshb.alive)).subscribe(() => {
121
+ // We do not care
122
+ });
123
+ });
124
+ }
125
+ /**
126
+ * Start overall detection
127
+ *
128
+ * @return observable with no content
129
+ */
130
+ startDetection() {
131
+ return (0, rxjs_1.concat)(...this.handlers.map(value => value.handleDetection())).pipe((0, rxjs_1.last)(undefined, void 0));
132
+ }
133
+ /**
134
+ * Changes on a state which results in a call to bshc controller
135
+ *
136
+ * @param id
137
+ * id of state which changed
138
+ * @param state
139
+ * state itself
140
+ */
141
+ setState(id, state) {
142
+ this.$rateLimit.next(() => {
143
+ for (let i = 0; i < this.handlers.length; i++) {
144
+ let handled = this.handlers[i].sendUpdateToBshc(id, state);
145
+ if (handled) {
146
+ this.bshb.log.silly(`Handler "${this.handlers[i].constructor.name}" send message to controller with state id=${id} and value=${state.val}`);
147
+ }
148
+ }
149
+ });
150
+ }
151
+ /**
152
+ * Changes from bshc controller which results in updates on ioBroker state
153
+ *
154
+ * @param resultEntry
155
+ * entry of changes which will be mapped to a state
156
+ */
157
+ setStateAck(resultEntry) {
158
+ for (let i = 0; i < this.handlers.length; i++) {
159
+ let handled = this.handlers[i].handleBshcUpdate(resultEntry);
160
+ if (handled) {
161
+ this.bshb.log.silly(`Handler "${this.handlers[i].constructor.name}" handled update form controller with result entry: ${JSON.stringify(resultEntry)} `);
162
+ }
163
+ }
164
+ }
165
+ }
166
+ exports.BshbController = BshbController;
157
167
  //# sourceMappingURL=bshb-controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bshb-controller.js","sourceRoot":"","sources":["../src/bshb-controller.ts"],"names":[],"mappings":";;;AAAA,qEAA0F;AAE1F,+CAAyC;AACzC,+BAA8F;AAC9F,8CAAiE;AACjE,mCAA8B;AAE9B,sFAA+E;AAC/E,kFAA2E;AAC3E,sFAA+E;AAC/E,sGAA6F;AAC7F,4FAAqF;AACrF,kGAA0F;AAC1F,4GAAmG;AACnG,gGAAwF;AACxF,4FAAoF;AAEpF;;;;;GAKG;AACH,MAAa,cAAc;IASvB;;;;;;;;;OASG;IACH,YAAoB,IAAU,EAAE,UAAkB,EAAE,gBAAwB;QAAxD,SAAI,GAAJ,IAAI,CAAM;QAhBtB,eAAU,GAAG,eAAe,CAAC;QAE7B,eAAU,GAAG,IAAI,cAAO,EAAc,CAAC;QAe3C,IAAI;YACA,IAAI,CAAC,oBAAoB,GAAG,qDAA2B,CAAC,OAAO,EAAE;iBAC5D,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;iBAC1B,cAAc,CAAC,UAAU,CAAC;iBAC1B,oBAAoB,CAAC,gBAAgB,CAAC;iBACtC,UAAU,CAAC,IAAI,wBAAU,CAAC,IAAI,CAAC,CAAC;iBAChC,KAAK,EAAE,CAAC;YAEb,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI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