iobroker.bshb 0.2.1 → 0.2.3
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/LICENSE +1 -1
- package/README.md +9 -0
- package/admin/i18n/de/translations.json +3 -1
- package/admin/i18n/en/translations.json +3 -1
- package/admin/i18n/es/translations.json +3 -1
- package/admin/i18n/fr/translations.json +3 -1
- package/admin/i18n/it/translations.json +3 -1
- package/admin/i18n/nl/translations.json +3 -1
- package/admin/i18n/pl/translations.json +3 -1
- package/admin/i18n/pt/translations.json +3 -1
- package/admin/i18n/ru/translations.json +3 -1
- package/admin/i18n/zh-cn/translations.json +3 -1
- package/admin/jsonConfig.json +8 -0
- package/build/bshb-controller.js +166 -156
- package/build/bshb-controller.js.map +1 -1
- package/build/bshb-definition.js +99 -99
- package/build/bshb-logger.js +70 -69
- package/build/bshb-logger.js.map +1 -1
- package/build/client-cert.js +30 -28
- package/build/client-cert.js.map +1 -1
- package/build/controller/handler/bshb-air-purity-guardian-handler.js +110 -124
- package/build/controller/handler/bshb-air-purity-guardian-handler.js.map +1 -1
- package/build/controller/handler/bshb-climate-handler.js +162 -0
- package/build/controller/handler/bshb-climate-handler.js.map +1 -0
- package/build/controller/handler/bshb-device-handler.js +417 -409
- package/build/controller/handler/bshb-device-handler.js.map +1 -1
- package/build/controller/handler/bshb-device-status-update-handler.js +30 -0
- package/build/controller/handler/bshb-device-status-update-handler.js.map +1 -0
- package/build/controller/handler/bshb-general-update-handler.js +36 -39
- package/build/controller/handler/bshb-general-update-handler.js.map +1 -1
- package/build/controller/handler/bshb-handler.js +167 -149
- package/build/controller/handler/bshb-handler.js.map +1 -1
- package/build/controller/handler/bshb-intrusion-detection-handler.js +211 -0
- package/build/controller/handler/bshb-intrusion-detection-handler.js.map +1 -0
- package/build/controller/handler/bshb-messages-handler.js +52 -57
- package/build/controller/handler/bshb-messages-handler.js.map +1 -1
- package/build/controller/handler/bshb-motion-lights-handler.js +93 -107
- package/build/controller/handler/bshb-motion-lights-handler.js.map +1 -1
- package/build/controller/handler/bshb-open-door-window-handler.js +175 -179
- package/build/controller/handler/bshb-open-door-window-handler.js.map +1 -1
- package/build/controller/handler/bshb-room-handler.js +128 -0
- package/build/controller/handler/bshb-room-handler.js.map +1 -0
- package/build/controller/handler/bshb-scenario-handler.js +106 -127
- package/build/controller/handler/bshb-scenario-handler.js.map +1 -1
- package/build/controller/handler/bshb-water-alarm-handler.js +119 -138
- package/build/controller/handler/bshb-water-alarm-handler.js.map +1 -1
- package/build/definition/function.js +19 -19
- package/build/definition/roles.js +191 -170
- package/build/definition/roles.js.map +1 -1
- package/build/definition/states.js +270 -247
- package/build/definition/states.js.map +1 -1
- package/build/definition/units.js +52 -45
- package/build/definition/units.js.map +1 -1
- package/build/definition/write.js +23 -20
- package/build/definition/write.js.map +1 -1
- package/build/log-level.js +18 -18
- package/build/main.js +421 -411
- package/build/main.js.map +1 -1
- package/build/migration.js +69 -69
- package/build/utils.js +81 -67
- package/build/utils.js.map +1 -1
- package/io-package.json +27 -26
- package/package.json +20 -20
- package/build/controller/handler/bshb-intrusion-detection.js +0 -111
- 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)
|
|
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,15 @@ 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.3
|
|
39
|
+
* (holomekc) Update to api version 3.2
|
|
40
|
+
* (holomekc) Add support for climate schedules with two options to activate them
|
|
41
|
+
* (holomekc) Update intrusion detection so that more information is shown
|
|
42
|
+
* (holomekc) Update intrusion detection and climate schedule switches stay active now
|
|
43
|
+
|
|
44
|
+
### 0.2.2
|
|
45
|
+
* (holomekc) Support for rooms. Configuration to ignore server certificates. Allow ttesting controller 2 and can prevent issues in case certificates expire. Less secure though.
|
|
46
|
+
|
|
38
47
|
### 0.2.1
|
|
39
48
|
* (holomekc) Support for additional services
|
|
40
49
|
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
package/admin/jsonConfig.json
CHANGED
|
@@ -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
|
}
|
package/build/bshb-controller.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.handlers
|
|
54
|
-
this.handlers.push(new
|
|
55
|
-
this.handlers.push(new
|
|
56
|
-
this
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* @
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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,
|
|
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,4GAAoG;AACpG,kGAA0F;AAC1F,4GAAmG;AACnG,gGAAwF;AACxF,4FAAoF;AACpF,8EAAuE;AACvE,8GAAqG;AACrG,oFAA6E;AAE7E;;;;;GAKG;AACH,MAAa,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