iobroker.bshb 0.3.0 → 0.4.1
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 +45 -155
- package/admin/jsonConfig.json +24 -6
- package/build/bshb-controller.js +29 -17
- package/build/bshb-controller.js.map +1 -1
- package/build/bshb-definition.js +16 -16
- package/build/bshb-definition.js.map +1 -1
- package/build/bshb-logger.js +15 -15
- package/build/bshb-logger.js.map +1 -1
- package/build/client-cert.js.map +1 -1
- package/build/controller/handler/bshb-air-purity-guardian-handler.js +34 -24
- package/build/controller/handler/bshb-air-purity-guardian-handler.js.map +1 -1
- package/build/controller/handler/bshb-automation-handler.js +100 -89
- package/build/controller/handler/bshb-automation-handler.js.map +1 -1
- package/build/controller/handler/bshb-backup-handler.js +259 -0
- package/build/controller/handler/bshb-backup-handler.js.map +1 -0
- package/build/controller/handler/bshb-climate-handler.js +45 -38
- package/build/controller/handler/bshb-climate-handler.js.map +1 -1
- package/build/controller/handler/bshb-device-handler.js +145 -107
- package/build/controller/handler/bshb-device-handler.js.map +1 -1
- package/build/controller/handler/bshb-device-status-update-handler.js +10 -5
- package/build/controller/handler/bshb-device-status-update-handler.js.map +1 -1
- package/build/controller/handler/bshb-general-update-handler.js +14 -12
- package/build/controller/handler/bshb-general-update-handler.js.map +1 -1
- package/build/controller/handler/bshb-handler.js +29 -21
- package/build/controller/handler/bshb-handler.js.map +1 -1
- package/build/controller/handler/bshb-intrusion-detection-handler.js +64 -50
- package/build/controller/handler/bshb-intrusion-detection-handler.js.map +1 -1
- package/build/controller/handler/bshb-messages-handler.js +17 -14
- package/build/controller/handler/bshb-messages-handler.js.map +1 -1
- package/build/controller/handler/bshb-motion-lights-handler.js +35 -27
- package/build/controller/handler/bshb-motion-lights-handler.js.map +1 -1
- package/build/controller/handler/bshb-open-door-window-handler.js +78 -71
- package/build/controller/handler/bshb-open-door-window-handler.js.map +1 -1
- package/build/controller/handler/bshb-room-handler.js +29 -28
- package/build/controller/handler/bshb-room-handler.js.map +1 -1
- package/build/controller/handler/bshb-scenario-handler.js +31 -27
- package/build/controller/handler/bshb-scenario-handler.js.map +1 -1
- package/build/controller/handler/bshb-user-defined-states-handler.js +31 -25
- package/build/controller/handler/bshb-user-defined-states-handler.js.map +1 -1
- package/build/controller/handler/bshb-water-alarm-handler.js +46 -40
- package/build/controller/handler/bshb-water-alarm-handler.js.map +1 -1
- package/build/definition/function.js +14 -14
- package/build/definition/function.js.map +1 -1
- package/build/definition/roles.js +94 -94
- package/build/definition/roles.js.map +1 -1
- package/build/definition/states.js +155 -136
- package/build/definition/states.js.map +1 -1
- package/build/definition/units.js +20 -20
- package/build/definition/units.js.map +1 -1
- package/build/definition/write.js +6 -6
- package/build/definition/write.js.map +1 -1
- package/build/log-level.js.map +1 -1
- package/build/main.js +124 -95
- package/build/main.js.map +1 -1
- package/build/migration.js +21 -11
- package/build/migration.js.map +1 -1
- package/build/rate-limiter.js +6 -4
- package/build/rate-limiter.js.map +1 -1
- package/build/utils.js +9 -9
- package/build/utils.js.map +1 -1
- package/io-package.json +27 -54
- package/package.json +63 -40
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|

|
|
2
|
+
|
|
2
3
|
# ioBroker.bshb
|
|
3
4
|
|
|
4
5
|
[](https://www.paypal.com/donate?business=holomekc%40googlemail.com¤cy_code=EUR)
|
|
@@ -18,8 +19,9 @@ This adapter allows to communicate with Bosch Smart Home devices.
|
|
|
18
19
|
|
|
19
20
|
[Bosch Smart Home Controller](https://www.bosch-smarthome.com/de/de/produkte/smart-system-solutions/smart-home-controller)
|
|
20
21
|
|
|
21
|
-
To achieve that it uses the [bosch-smart-home-bridge](https://github.com/holomekc/bosch-smart-home-bridge) library
|
|
22
|
-
which uses the information from
|
|
22
|
+
To achieve that it uses the [bosch-smart-home-bridge](https://github.com/holomekc/bosch-smart-home-bridge) library
|
|
23
|
+
which uses the information from
|
|
24
|
+
official [Bosch Smart Home Controller Local REST API](https://github.com/BoschSmartHome/bosch-shc-api-docs).
|
|
23
25
|
|
|
24
26
|
IoBroker Forum Discussion for the BSHB Adapter:
|
|
25
27
|
https://forum.iobroker.net/topic/25370/test-adapter-bshb-bosch-smart-home-v0-0-x/
|
|
@@ -29,179 +31,67 @@ https://github.com/holomekc/ioBroker.bshb/wiki/Examples
|
|
|
29
31
|
|
|
30
32
|
Work in progress. Feedback appreciated.
|
|
31
33
|
|
|
32
|
-
If you want to support the work I would appreciate a small donation. This is 100% voluntary and not necessary for the
|
|
34
|
+
If you want to support the work I would appreciate a small donation. This is 100% voluntary and not necessary for the
|
|
35
|
+
use of the adapter. You find a link at the top.
|
|
33
36
|
|
|
34
37
|
## Changelog
|
|
35
38
|
|
|
39
|
+
## 0.4.1
|
|
40
|
+
|
|
41
|
+
* Dependencies updated
|
|
42
|
+
|
|
43
|
+
### 0.4.0
|
|
44
|
+
|
|
45
|
+
* (holomekc) Minor bug fixes
|
|
46
|
+
* (holomekc) Support for backups.
|
|
47
|
+
* (holomekc) If you want to use the backup feature make sure that the systempassword is set in the adapter config.
|
|
48
|
+
Furthermore, in the Bosch app set the client permissions to „Operate and manage“. „More“ ➤ „Mobile Devices“ ➤ „OSS
|
|
49
|
+
ioBroker.bshb“
|
|
50
|
+
|
|
36
51
|
### 0.3.0
|
|
52
|
+
|
|
37
53
|
* (holomekc) Support for user automations
|
|
38
54
|
|
|
39
55
|
### 0.2.8
|
|
40
|
-
|
|
56
|
+
|
|
57
|
+
* (holomekc) Improve stability and update dependencies
|
|
41
58
|
|
|
42
59
|
### 0.2.7
|
|
60
|
+
|
|
43
61
|
* (holomekc) Update dependencies and fix rate limiting
|
|
44
62
|
|
|
45
63
|
### 0.2.6
|
|
46
|
-
* (holomekc) Support for user defined states
|
|
47
64
|
|
|
48
|
-
### 0.2.5
|
|
49
65
|
* (holomekc) Support for user defined states
|
|
50
66
|
|
|
51
|
-
### 0.2.
|
|
52
|
-
* (holomekc) Update the adapter to the latest requirements
|
|
53
|
-
|
|
54
|
-
### 0.2.3
|
|
55
|
-
* (holomekc) Update to api version 3.2
|
|
56
|
-
* (holomekc) Add support for climate schedules with two options to activate them
|
|
57
|
-
* (holomekc) Update intrusion detection so that more information is shown
|
|
58
|
-
* (holomekc) Update intrusion detection and climate schedule switches stay active now
|
|
59
|
-
* (holomekc) Support for rooms. Configuration to ignore server certificates. Allow ttesting controller 2 and can prevent issues in case certificates expire. Less secure though.
|
|
60
|
-
|
|
61
|
-
### 0.2.1
|
|
62
|
-
* (holomekc) Support for additional services
|
|
63
|
-
|
|
64
|
-
### 0.1.20
|
|
65
|
-
* (holomekc) Fixed problems with openDoorsAndWindows
|
|
66
|
-
|
|
67
|
-
### 0.1.19
|
|
68
|
-
* (holomekc) problems with initial setup fixed
|
|
69
|
-
|
|
70
|
-
### 0.1.18
|
|
71
|
-
* (holomekc) rateLimit added so that not too many request are executed against controller
|
|
72
|
-
|
|
73
|
-
### 0.1.17
|
|
74
|
-
* (holomekc) add yale values for door lock
|
|
75
|
-
* (holomekc) update states on startup
|
|
76
|
-
|
|
77
|
-
### 0.1.16
|
|
78
|
-
* (holomekc) when scenarioTriggered received the adapter will shortly update the scenario state to true and after 1s back to false. This allows to directly listen to triggered scenarios even when not triggered from iobroker.
|
|
79
|
-
Behavior if triggered from iobroker:
|
|
80
|
-
- state: true, ack: false
|
|
81
|
-
- state: true, ack: true
|
|
82
|
-
- state: false, ack: true
|
|
83
|
-
|
|
84
|
-
Behavior if triggered from somewhere else:
|
|
85
|
-
- state: true, ack: true
|
|
86
|
-
- state: false, ack: true
|
|
87
|
-
* (holomekc) all updates received from controller are send to a new iobroker state "updates". This provides more flexibility and allow more complex logics. Each update is handled one by one even when a list of multiple update from controller received.
|
|
88
|
-
|
|
89
|
-
### 0.1.15
|
|
90
|
-
* (holomekc) Restore cache also possible without controller connection to internet. Device services endpoint fails in this case. These failures during detection are ignored now with a warning that e.g. detection of new devices is not possible in this case. Nevertheless, controlling Bosch devices will still work.
|
|
91
|
-
* (holomekc) Fix tests and add "simple" integration test
|
|
92
|
-
* (holomekc) Update structure of project
|
|
93
|
-
* (holomekc) Code formatting
|
|
94
|
-
|
|
95
|
-
### 0.1.14
|
|
96
|
-
* (holomekc) RoomControlMode types added.
|
|
97
|
-
* (holomekc) Update for js-controller 3.x.x. This serializes objects and arrays. Please check your logics.
|
|
98
|
-
|
|
99
|
-
### 0.1.13
|
|
100
|
-
* (holomekc) update to api-version 2.1
|
|
101
|
-
* (holomekc) add intrusionDetectionControl folder which contains trigger for alarm system
|
|
102
|
-
|
|
103
|
-
### 0.1.12
|
|
104
|
-
* (holomekc) states and units
|
|
105
|
-
* (holomekc) update license and copyright
|
|
106
|
-
* (holomekc) fix typo in connectionType
|
|
107
|
-
|
|
108
|
-
### 0.1.11
|
|
109
|
-
* (holomekc) update dependencies
|
|
110
|
-
* (holomekc) changes due to new ioBroker lib
|
|
111
|
-
* (holomekc) add connection indicator
|
|
112
|
-
* (holomekc) increase delay for timeout for longpolling to 2s
|
|
113
|
-
* (holomekc) low not set as lowbat role in ioBroker anymore
|
|
114
|
-
|
|
115
|
-
### 0.1.10
|
|
116
|
-
* (holomekc) Add .npmignore to cleanup installation files
|
|
117
|
-
|
|
118
|
-
### 0.1.9
|
|
119
|
-
* (holomekc) Error in scenario handling fixed
|
|
120
|
-
|
|
121
|
-
### 0.1.8
|
|
122
|
-
* (holomekc) Minor improvements
|
|
123
|
-
|
|
124
|
-
### 0.1.7
|
|
125
|
-
* (holomekc) Improved error handling
|
|
126
|
-
|
|
127
|
-
### 0.1.6
|
|
128
|
-
* (holomekc) Added open doors and windows feature
|
|
129
|
-
|
|
130
|
-
### 0.1.5
|
|
131
|
-
* (holomekc) functions and rooms are only added for new channels
|
|
132
|
-
* (holomekc) increase timeout for requests which expect to contain more data
|
|
133
|
-
|
|
134
|
-
### 0.1.4
|
|
135
|
-
* (holomekc) issue fixed in loading configuration
|
|
136
|
-
* (holomekc) minor restructuring
|
|
137
|
-
|
|
138
|
-
### 0.1.3
|
|
139
|
-
* (holomekc) restructure of handling device detection and updates iobroker <-> bshc via BshbHandler
|
|
140
|
-
* (holomekc) added handler for devices, scenarios and messages
|
|
141
|
-
* (holomekc) messages and scenarios are updated when adapter is running
|
|
142
|
-
|
|
143
|
-
### 0.1.2
|
|
144
|
-
* (holomekc) Adapter core library updated
|
|
145
|
-
|
|
146
|
-
### 0.1.1
|
|
147
|
-
* (holomekc) update to new bridge version
|
|
148
|
-
* (holomekc) allows adapter to reconnect in case bshc is restarting
|
|
149
|
-
* (holomekc) remove not needed configuration
|
|
150
|
-
* (holomekc) faults added to all service (channels)
|
|
151
|
-
* (holomekc) faults are always a list: [] = no faults, \[{source: {rootDeviceId: string, deviceServiceId: string, deviceId: string}, type: string, category: INFO | WARNING | ERROR}, ...\] = faults
|
|
152
|
-
|
|
153
|
-
### 0.1.0
|
|
154
|
-
* (holomekc) certificate and private key are handled in ioBroker and can be content or file reference
|
|
155
|
-
* (holomekc) update to newer bridge version
|
|
156
|
-
|
|
157
|
-
### 0.0.14
|
|
158
|
-
* (holomekc) optimizations and cleanup
|
|
159
|
-
|
|
160
|
-
### 0.0.13
|
|
161
|
-
* (holomekc) added more definitions
|
|
162
|
-
* (holomekc) optimizations and cleanup
|
|
163
|
-
|
|
164
|
-
### 0.0.12
|
|
165
|
-
* (holomekc) scenario support. Scenarios are listed as group 'scenarios' and can only be triggered
|
|
166
|
-
* (holomekc) added definitions for Twinguard
|
|
167
|
-
|
|
168
|
-
### 0.0.11
|
|
169
|
-
* (holomekc) rooms and functions added for known channels
|
|
170
|
-
* (holomekc) trim whitespaces from configuration values
|
|
171
|
-
|
|
172
|
-
### 0.0.10
|
|
173
|
-
* (holomekc) try to improve configuration description in application itself
|
|
174
|
-
* (holomekc) change id so that it is valid regarding Bosch T&C
|
|
175
|
-
* (holomekc) update to newest bosch-smart-home-bridge version for same reason
|
|
176
|
-
|
|
177
|
-
### 0.0.9
|
|
178
|
-
* (holomekc) update travis.yml due to jscontroller requires node dependency >=8.0
|
|
179
|
-
|
|
180
|
-
### 0.0.8
|
|
181
|
-
* (holomekc) fix client name is: ioBroker.bshb
|
|
182
|
-
|
|
183
|
-
### 0.0.7
|
|
184
|
-
* (holomekc) make sure that bosch-smart-home-bridge version >= 0.0.4
|
|
185
|
-
|
|
186
|
-
### 0.0.6
|
|
187
|
-
* (holomekc) Just io-package.json changes
|
|
188
|
-
* (holomekc) cleanup
|
|
67
|
+
### 0.2.5
|
|
189
68
|
|
|
190
|
-
|
|
191
|
-
* (holomekc) Just do the steps adapter-check is telling me
|
|
192
|
-
* (holomekc) Therefore, build files are part of git repo. So install via Github should be possible now
|
|
69
|
+
* (holomekc) Support for user defined states
|
|
193
70
|
|
|
194
|
-
###
|
|
195
|
-
* (holomekc) Long polling added to reduce load
|
|
196
|
-
* (holomekc) Set of state values is possible now
|
|
197
|
-
* (holomekc) Code cleanup
|
|
71
|
+
### Older entries
|
|
198
72
|
|
|
199
|
-
|
|
200
|
-
* (holomekc) certificate generation added
|
|
201
|
-
* (holomekc) first attempts to creat ioBroker objects, states, etc.
|
|
73
|
+
[here](CHANGELOG_OLD.md)
|
|
202
74
|
|
|
203
75
|
## License
|
|
204
76
|
|
|
205
77
|
The MIT License (MIT)
|
|
206
78
|
|
|
207
|
-
Copyright (c)
|
|
79
|
+
Copyright (c) 2025 Christopher Holomek <holomekc.github@gmail.com>
|
|
80
|
+
|
|
81
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
82
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
83
|
+
in the Software without restriction, including without limitation the rights
|
|
84
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
85
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
86
|
+
furnished to do so, subject to the following conditions:
|
|
87
|
+
|
|
88
|
+
The above copyright notice and this permission notice shall be included in
|
|
89
|
+
all copies or substantial portions of the Software.
|
|
90
|
+
|
|
91
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
92
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
93
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
94
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
95
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
96
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
97
|
+
THE SOFTWARE.
|
package/admin/jsonConfig.json
CHANGED
|
@@ -6,16 +6,22 @@
|
|
|
6
6
|
"type": "text",
|
|
7
7
|
"label": "host",
|
|
8
8
|
"newLine": false,
|
|
9
|
+
"xs": 12,
|
|
9
10
|
"sm": 12,
|
|
10
|
-
"md": 6
|
|
11
|
+
"md": 6,
|
|
12
|
+
"lg": 4,
|
|
13
|
+
"xl": 4
|
|
11
14
|
},
|
|
12
15
|
"identifier": {
|
|
13
16
|
"type": "text",
|
|
14
17
|
"label": "identifier",
|
|
15
18
|
"newLine": false,
|
|
16
19
|
"help": "identifier-detail",
|
|
20
|
+
"xs": 12,
|
|
17
21
|
"sm": 12,
|
|
18
|
-
"md": 6
|
|
22
|
+
"md": 6,
|
|
23
|
+
"lg": 4,
|
|
24
|
+
"xl": 4
|
|
19
25
|
},
|
|
20
26
|
"systemPassword": {
|
|
21
27
|
"type": "password",
|
|
@@ -23,8 +29,11 @@
|
|
|
23
29
|
"newLine": true,
|
|
24
30
|
"help": "systemPassword-detail",
|
|
25
31
|
"visible": true,
|
|
32
|
+
"xs": 12,
|
|
26
33
|
"sm": 12,
|
|
27
|
-
"md": 6
|
|
34
|
+
"md": 6,
|
|
35
|
+
"lg": 4,
|
|
36
|
+
"xl": 4
|
|
28
37
|
},
|
|
29
38
|
"pairingDelay": {
|
|
30
39
|
"type": "number",
|
|
@@ -32,24 +41,33 @@
|
|
|
32
41
|
"newLine": false,
|
|
33
42
|
"help": "pairingDelay-detail",
|
|
34
43
|
"min": 1000,
|
|
44
|
+
"xs": 12,
|
|
35
45
|
"sm": 12,
|
|
36
|
-
"md": 6
|
|
46
|
+
"md": 6,
|
|
47
|
+
"lg": 4,
|
|
48
|
+
"xl": 4
|
|
37
49
|
},
|
|
38
50
|
"rateLimit": {
|
|
39
51
|
"type": "number",
|
|
40
52
|
"label": "rateLimit",
|
|
41
53
|
"newLine": true,
|
|
42
54
|
"min": 0,
|
|
55
|
+
"xs": 12,
|
|
43
56
|
"sm": 12,
|
|
44
|
-
"md": 6
|
|
57
|
+
"md": 6,
|
|
58
|
+
"lg": 4,
|
|
59
|
+
"xl": 4
|
|
45
60
|
},
|
|
46
61
|
"skipServerCertificateCheck": {
|
|
47
62
|
"type": "checkbox",
|
|
48
63
|
"label": "skipServerCertificateCheck",
|
|
49
64
|
"help": "skipServerCertificateCheck-detail",
|
|
50
65
|
"newLine": true,
|
|
66
|
+
"xs": 12,
|
|
51
67
|
"sm": 12,
|
|
52
|
-
"md": 6
|
|
68
|
+
"md": 6,
|
|
69
|
+
"lg": 4,
|
|
70
|
+
"xl": 4
|
|
53
71
|
}
|
|
54
72
|
}
|
|
55
73
|
}
|
package/build/bshb-controller.js
CHANGED
|
@@ -21,6 +21,7 @@ const bshb_climate_handler_1 = require("./controller/handler/bshb-climate-handle
|
|
|
21
21
|
const bshb_user_defined_states_handler_1 = require("./controller/handler/bshb-user-defined-states-handler");
|
|
22
22
|
const rate_limiter_1 = require("./rate-limiter");
|
|
23
23
|
const bshb_automation_handler_1 = require("./controller/handler/bshb-automation-handler");
|
|
24
|
+
const bshb_backup_handler_1 = require("./controller/handler/bshb-backup-handler");
|
|
24
25
|
/**
|
|
25
26
|
* This controller encapsulates bosch-smart-home-bridge and provides it to iobroker.bshb
|
|
26
27
|
*
|
|
@@ -30,7 +31,7 @@ const bshb_automation_handler_1 = require("./controller/handler/bshb-automation-
|
|
|
30
31
|
class BshbController {
|
|
31
32
|
bshb;
|
|
32
33
|
boschSmartHomeBridge;
|
|
33
|
-
clientName =
|
|
34
|
+
clientName = "ioBroker.bshb";
|
|
34
35
|
$rateLimit = new rxjs_1.Subject();
|
|
35
36
|
alive = new rxjs_1.Subject();
|
|
36
37
|
handlers;
|
|
@@ -69,22 +70,25 @@ class BshbController {
|
|
|
69
70
|
this.handlers.push(new bshb_device_handler_1.BshbDeviceHandler(this.bshb, this.boschSmartHomeBridge));
|
|
70
71
|
this.handlers.push(new bshb_open_door_window_handler_1.BshbOpenDoorWindowHandler(this.bshb, this.boschSmartHomeBridge));
|
|
71
72
|
this.handlers.push(new bshb_climate_handler_1.BshbClimateHandler(this.bshb, this.boschSmartHomeBridge));
|
|
72
|
-
this
|
|
73
|
+
this.handlers.push(new bshb_backup_handler_1.BshbBackupHandler(this.bshb, this.boschSmartHomeBridge));
|
|
74
|
+
this.$rateLimit
|
|
75
|
+
.pipe((0, rate_limiter_1.rateLimit)(this.bshb.config.rateLimit, this.bshb), (0, rxjs_1.concatMap)((data) => {
|
|
73
76
|
const observables = [];
|
|
74
77
|
for (let i = 0; i < this.handlers.length; i++) {
|
|
75
78
|
observables.push(this.handlers[i].sendUpdateToBshc(data.id, data.state).pipe(
|
|
76
79
|
// Protect controller
|
|
77
|
-
(0, operators_1.catchError)(err => {
|
|
80
|
+
(0, operators_1.catchError)((err) => {
|
|
78
81
|
this.bshb.log.silly(`Handler "${this.handlers[i].constructor.name}" failed with ${err}. This might happen when the controller answers with an error.`);
|
|
79
82
|
return (0, rxjs_1.of)(true);
|
|
80
|
-
}), (0, operators_1.tap)(handled => {
|
|
83
|
+
}), (0, operators_1.tap)((handled) => {
|
|
81
84
|
if (handled) {
|
|
82
85
|
this.bshb.log.silly(`Handler "${this.handlers[i].constructor.name}" send message to controller with state id=${data.id} and value=${data.state.val}`);
|
|
83
86
|
}
|
|
84
87
|
})));
|
|
85
88
|
}
|
|
86
89
|
return (0, rxjs_1.merge)(...observables);
|
|
87
|
-
}), (0, operators_1.takeUntil)(this.alive))
|
|
90
|
+
}), (0, operators_1.takeUntil)(this.alive))
|
|
91
|
+
.subscribe();
|
|
88
92
|
}
|
|
89
93
|
catch (e) {
|
|
90
94
|
if (e instanceof Error) {
|
|
@@ -115,25 +119,33 @@ class BshbController {
|
|
|
115
119
|
// Here we retry the pairIfNeeded without attempts configured. So we try once. If something is not ok we wait
|
|
116
120
|
// for pairing delay before we try again. We use takeUntil to make sure that we stop streams if adapter shuts-down
|
|
117
121
|
// takeUntil must be last in pipe to prevent issues.
|
|
118
|
-
return new rxjs_1.Observable(subscriber => {
|
|
122
|
+
return new rxjs_1.Observable((subscriber) => {
|
|
119
123
|
const retry = new rxjs_1.BehaviorSubject(true);
|
|
120
|
-
retry
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
retry
|
|
125
|
+
.pipe((0, operators_1.catchError)((err) => err.pipe((0, operators_1.delay)(pairingDelay))), (0, operators_1.tap)(() => {
|
|
126
|
+
this.boschSmartHomeBridge
|
|
127
|
+
.pairIfNeeded(this.clientName, this.bshb.config.identifier, systemPassword, pairingDelay, -1)
|
|
128
|
+
.pipe((0, operators_1.takeUntil)(this.bshb.alive))
|
|
129
|
+
.subscribe({
|
|
130
|
+
next: (response) => {
|
|
123
131
|
// Everything is ok. We can stop all.
|
|
124
|
-
this.bshb.log.info(
|
|
132
|
+
this.bshb.log.info("Ok with pairing");
|
|
125
133
|
subscriber.next(response);
|
|
126
134
|
subscriber.complete();
|
|
127
135
|
retry.complete();
|
|
128
|
-
},
|
|
136
|
+
},
|
|
137
|
+
error: (err) => {
|
|
129
138
|
this.bshb.log.error(err);
|
|
130
139
|
// Something went wrong. Already logged by lib. We just wait and retry.
|
|
131
|
-
(0, rxjs_1.timer)(pairingDelay)
|
|
140
|
+
(0, rxjs_1.timer)(pairingDelay)
|
|
141
|
+
.pipe((0, operators_1.takeUntil)(this.bshb.alive))
|
|
142
|
+
.subscribe(() => {
|
|
132
143
|
retry.next(true);
|
|
133
144
|
});
|
|
134
|
-
}
|
|
145
|
+
},
|
|
135
146
|
});
|
|
136
|
-
}), (0, operators_1.takeUntil)(this.bshb.alive))
|
|
147
|
+
}), (0, operators_1.takeUntil)(this.bshb.alive))
|
|
148
|
+
.subscribe(() => {
|
|
137
149
|
// We do not care
|
|
138
150
|
});
|
|
139
151
|
});
|
|
@@ -144,8 +156,8 @@ class BshbController {
|
|
|
144
156
|
* @return observable with no content
|
|
145
157
|
*/
|
|
146
158
|
startDetection() {
|
|
147
|
-
this.bshb.log.info(
|
|
148
|
-
return (0, rxjs_1.concat)(...this.handlers.map(value => value.handleDetection())).pipe((0, rxjs_1.last)(undefined, void 0));
|
|
159
|
+
this.bshb.log.info("Start detection");
|
|
160
|
+
return (0, rxjs_1.concat)(...this.handlers.map((value) => value.handleDetection())).pipe((0, rxjs_1.last)(undefined, void 0));
|
|
149
161
|
}
|
|
150
162
|
/**
|
|
151
163
|
* Changes on a state which results in a call to bshc controller
|
|
@@ -166,7 +178,7 @@ class BshbController {
|
|
|
166
178
|
*/
|
|
167
179
|
setStateAck(resultEntry) {
|
|
168
180
|
for (let i = 0; i < this.handlers.length; i++) {
|
|
169
|
-
|
|
181
|
+
const handled = this.handlers[i].handleBshcUpdate(resultEntry);
|
|
170
182
|
if (handled) {
|
|
171
183
|
this.bshb.log.silly(`Handler "${this.handlers[i].constructor.name}" handled update form controller with result entry: ${JSON.stringify(resultEntry)} `);
|
|
172
184
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bshb-controller.js","sourceRoot":"","sources":["../src/bshb-controller.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"bshb-controller.js","sourceRoot":"","sources":["../src/bshb-controller.ts"],"names":[],"mappings":";;;AAAA,qEAGiC;AAEjC,+CAA2C;AAC3C,+BAUc;AACd,8CAAmE;AACnE,mCAAgC;AAEhC,sFAAiF;AACjF,kFAA6E;AAC7E,sFAAiF;AACjF,sGAA+F;AAC/F,4GAAsG;AACtG,kGAA4F;AAC5F,4GAAqG;AACrG,gGAA0F;AAC1F,4FAAsF;AACtF,8EAAyE;AACzE,8GAAuG;AACvG,oFAA+E;AAC/E,4GAAqG;AACrG,iDAA2C;AAC3C,0FAAqF;AACrF,kFAA6E;AAE7E;;;;;GAKG;AACH,MAAa,cAAc;IAoBf;IAnBO,oBAAoB,CAAuB;IACpD,UAAU,GAAG,eAAe,CAAC;IAE7B,UAAU,GAAG,IAAI,cAAO,EAAyC,CAAC;IACnE,KAAK,GAAG,IAAI,cAAO,EAAW,CAAC;IAE9B,QAAQ,CAAgB;IAEhC;;;;;;;;;OASG;IACH,YACU,IAAU,EAClB,UAAkB,EAClB,gBAAwB;QAFhB,SAAI,GAAJ,IAAI,CAAM;QAIlB,IAAI,CAAC;YACH,IAAI,CAAC,oBAAoB,GAAG,qDAA2B,CAAC,OAAO,EAAE;iBAC9D,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,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC;iBACvE,KAAK,EAAE,CAAC;YAEX,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAChB,IAAI,sD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C,CAAC,WAAW,CAAC,IAAI,uDAAuD,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CACnI,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;CACF;AArOD,wCAqOC"}
|
package/build/bshb-definition.js
CHANGED
|
@@ -15,7 +15,7 @@ const write_1 = require("./definition/write");
|
|
|
15
15
|
class BshbDefinition {
|
|
16
16
|
static determineFunction(value) {
|
|
17
17
|
const func = function_1.FUNCTIONS[value];
|
|
18
|
-
if (func !== null && typeof func !==
|
|
18
|
+
if (func !== null && typeof func !== "undefined") {
|
|
19
19
|
return func;
|
|
20
20
|
}
|
|
21
21
|
return undefined;
|
|
@@ -30,24 +30,24 @@ class BshbDefinition {
|
|
|
30
30
|
*/
|
|
31
31
|
static determineWrite(type, key) {
|
|
32
32
|
const writeType = write_1.WRITE[type];
|
|
33
|
-
if (writeType !== null && typeof writeType !==
|
|
33
|
+
if (writeType !== null && typeof writeType !== "undefined") {
|
|
34
34
|
const write = writeType[key];
|
|
35
|
-
if (write !== null && typeof write !==
|
|
35
|
+
if (write !== null && typeof write !== "undefined") {
|
|
36
36
|
return write;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
return true;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* Get type of
|
|
42
|
+
* Get the type of the specified value from bsh
|
|
43
43
|
*
|
|
44
44
|
* @param value value to determine type for
|
|
45
45
|
*/
|
|
46
46
|
static determineType(value) {
|
|
47
47
|
if (Array.isArray(value)) {
|
|
48
|
-
return
|
|
48
|
+
return "array";
|
|
49
49
|
}
|
|
50
|
-
return
|
|
50
|
+
return typeof value;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Get role of bsh device state
|
|
@@ -60,26 +60,26 @@ class BshbDefinition {
|
|
|
60
60
|
*/
|
|
61
61
|
static determineRole(type, key, value) {
|
|
62
62
|
// faults are always a list. Does not matter which service.
|
|
63
|
-
if (key ===
|
|
64
|
-
return
|
|
63
|
+
if (key === "faults") {
|
|
64
|
+
return "list";
|
|
65
65
|
}
|
|
66
66
|
const roleType = roles_1.ROLES[type];
|
|
67
|
-
if (roleType !== null && typeof roleType !==
|
|
67
|
+
if (roleType !== null && typeof roleType !== "undefined") {
|
|
68
68
|
const role = roleType[key];
|
|
69
|
-
if (role !== null && typeof role !==
|
|
69
|
+
if (role !== null && typeof role !== "undefined") {
|
|
70
70
|
return role;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
if (Array.isArray(value)) {
|
|
74
|
-
return
|
|
74
|
+
return "list";
|
|
75
75
|
}
|
|
76
|
-
return
|
|
76
|
+
return "state";
|
|
77
77
|
}
|
|
78
78
|
static determineUnit(type, key) {
|
|
79
79
|
const unitType = units_1.UNITS[type];
|
|
80
|
-
if (unitType !== null && typeof unitType !==
|
|
80
|
+
if (unitType !== null && typeof unitType !== "undefined") {
|
|
81
81
|
const unit = unitType[key];
|
|
82
|
-
if (unit !== null && typeof unit !==
|
|
82
|
+
if (unit !== null && typeof unit !== "undefined") {
|
|
83
83
|
return unit;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -87,9 +87,9 @@ class BshbDefinition {
|
|
|
87
87
|
}
|
|
88
88
|
static determineStates(type, key) {
|
|
89
89
|
const stateType = states_1.STATES[type];
|
|
90
|
-
if (stateType !== null && typeof stateType !==
|
|
90
|
+
if (stateType !== null && typeof stateType !== "undefined") {
|
|
91
91
|
const state = stateType[key];
|
|
92
|
-
if (state !== null && typeof state !==
|
|
92
|
+
if (state !== null && typeof state !== "undefined") {
|
|
93
93
|
return state;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bshb-definition.js","sourceRoot":"","sources":["../src/bshb-definition.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"bshb-definition.js","sourceRoot":"","sources":["../src/bshb-definition.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,8CAA2C;AAC3C,oDAAkD;AAClD,8CAA2C;AAC3C,gDAA6C;AAC7C,8CAA2C;AAE3C,MAAa,cAAc;IAClB,MAAM,CAAC,iBAAiB,CAAC,KAAa;QAC3C,MAAM,IAAI,GAAG,oBAAS,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;YACjD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,SAA8B,CAAC;IACxC,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,cAAc,CAAC,IAAY,EAAE,GAAW;QACpD,MAAM,SAAS,GAAG,aAAK,CAAC,IAAI,CAAC,CAAC;QAE9B,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;YAC3D,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;YAE7B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;gBACnD,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,aAAa,CACzB,KAAU;QAEV,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,OAAO,OAAO,KAMH,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,aAAa,CAAC,IAAY,EAAE,GAAW,EAAE,KAAU;QAC/D,2DAA2D;QAC3D,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;YACrB,OAAO,MAAM,CAAC;QAChB,CAA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}
|
package/build/bshb-logger.js
CHANGED
|
@@ -13,32 +13,32 @@ class BshbLogger {
|
|
|
13
13
|
this.adapter = adapter;
|
|
14
14
|
}
|
|
15
15
|
fine(message, ...optionalParams) {
|
|
16
|
-
this.log(
|
|
16
|
+
this.log("silly", message, optionalParams);
|
|
17
17
|
}
|
|
18
18
|
debug(message, ...optionalParams) {
|
|
19
|
-
this.log(
|
|
19
|
+
this.log("debug", message, optionalParams);
|
|
20
20
|
}
|
|
21
21
|
info(message, ...optionalParams) {
|
|
22
|
-
this.log(
|
|
22
|
+
this.log("info", message, optionalParams);
|
|
23
23
|
}
|
|
24
24
|
error(message, ...optionalParams) {
|
|
25
25
|
// debug may look strange here, but we do not care about the logs of errors during http calls because we handle
|
|
26
26
|
// them in the adapter. Errors would only confuse users.
|
|
27
|
-
this.log(
|
|
27
|
+
this.log("debug", message, optionalParams);
|
|
28
28
|
}
|
|
29
29
|
warn(message, ...optionalParams) {
|
|
30
|
-
this.log(
|
|
30
|
+
this.log("warn", message, optionalParams);
|
|
31
31
|
}
|
|
32
32
|
log(msgType, message, ...optionalParams) {
|
|
33
33
|
if (message) {
|
|
34
34
|
if (optionalParams[0].length > 0) {
|
|
35
35
|
let concatMessage = message;
|
|
36
|
-
optionalParams.forEach(value => {
|
|
37
|
-
if (typeof value ===
|
|
38
|
-
concatMessage +=
|
|
36
|
+
optionalParams.forEach((value) => {
|
|
37
|
+
if (typeof value === "object") {
|
|
38
|
+
concatMessage += " - " + JSON.stringify(value);
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
concatMessage +=
|
|
41
|
+
concatMessage += " - " + value;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
this.adapter.log[msgType](concatMessage);
|
|
@@ -49,19 +49,19 @@ class BshbLogger {
|
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
if (optionalParams[0].length > 0) {
|
|
52
|
-
let concatMessage =
|
|
53
|
-
optionalParams.forEach(value => {
|
|
54
|
-
if (typeof value ===
|
|
55
|
-
concatMessage +=
|
|
52
|
+
let concatMessage = "";
|
|
53
|
+
optionalParams.forEach((value) => {
|
|
54
|
+
if (typeof value === "object") {
|
|
55
|
+
concatMessage += " - " + JSON.stringify(value);
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
|
-
concatMessage +=
|
|
58
|
+
concatMessage += " - " + value;
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
this.adapter.log[msgType](concatMessage);
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
|
-
this.adapter.log[msgType](
|
|
64
|
+
this.adapter.log[msgType]("");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
package/build/bshb-logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bshb-logger.js","sourceRoot":"","sources":["../src/bshb-logger.ts"],"names":[],"mappings":";;;AAGA;;;;;GAKG;AACH,MAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"bshb-logger.js","sourceRoot":"","sources":["../src/bshb-logger.ts"],"names":[],"mappings":";;;AAGA;;;;;GAKG;AACH,MAAa,UAAU;IACD;IAApB,YAAoB,OAAa;QAAb,YAAO,GAAP,OAAO,CAAM;IAAG,CAAC;IAErC,IAAI,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC1C,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC3C,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC1C,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC3C,+GAA+G;QAC/G,wDAAw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