iobroker.ring 2.0.0-beta.0 → 3.0.0-beta.7

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 CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 Thorsten Stueben <thorsten@stueben.de>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Thorsten Stueben <thorsten@stueben.de>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,205 +1,251 @@
1
- ![Logo](admin/ring.png)
2
-
3
- # Ring Adapter
4
-
5
- [![Travis CI Build Status](https://travis-ci.org/iobroker-community-adapters/ioBroker.ring.svg?branch=master)](https://travis-ci.org/iobroker-community-adapters/ioBroker.ring)
6
- [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/iobroker-community-adapters/ioBroker.ring?branch=master&svg=true)](https://ci.appveyor.com/project/schmupu/ioBroker-ring/)
7
- ![Number of Installations](http://iobroker.live/badges/ring-installed.svg) ![Number of Installations](http://iobroker.live/badges/ring-stable.svg) [![NPM version](http://img.shields.io/npm/v/iobroker.ring.svg)](https://www.npmjs.com/package/iobroker.ring)
8
- [![Downloads](https://img.shields.io/npm/dm/iobroker.ring.svg)](https://www.npmjs.com/package/iobroker.ring)
9
-
10
- [![NPM](https://nodei.co/npm/iobroker.ring.png?downloads=true)](https://nodei.co/npm/iobroker.ring/)
11
-
12
- Requires node.js 10.0 or higher and Admin v3.
13
-
14
- The Ring adapter works with Ring devices like the Ring Video Doorbell and Ring Cam and shows if somenone rings the doorbell or if motion is detected. The Ring Video Doorbell or Cam sends a videostream if a motion or doorbell ist detected or you use the SIP Information for a SIP Video Conference with your SIP client.
15
- Unfortunately the snapshot and livestream function does not work properly. Unfortunately I have no influence on it. Please consider this before you create an issue.
16
- The adapter will not provide all ring devices because the used API do not includes all ring devices.
17
-
18
- You can use for example the Blink SIP client on [http://icanblink.com/](http://icanblink.com/). To get video working go into Blink's Preferences and under "Accounts", switch the tab to "Media" and deselect "Encrypt audio and video" under "RTP Options". Be careful the SIP information expire after a few seconds!
19
- Hopefully I will able to support a video stream soon. Unfortunatly [ring.com](https://ring.com) does not have an official API that support this feature.
20
- If you press the livestreamrequest button you get new SIP Information for building up a SIP Video Call session. If you are using the [ring.com](https://ring.com) cloud you find under history a http link to your last motion / door bell recorded video.
21
-
22
-
23
- ## Install & Configuration
24
-
25
- After installing the Adapter you have to enter your Email and Password of your [ring.com](https://ring.com) Account and a Token. Ring now requires the use of Two-Factor Auth (2fa) for all accounts. For getting the token please do following on your shell.
26
- ```
27
- npx -p ring-client-api ring-auth-cli
28
- ```
29
- or
30
- ```
31
- # Unix
32
- cd /opt/iobroker/node_modules/iobroker.ring/
33
- npm i ring-client-api
34
-
35
- cd /opt/iobroker/node_modules/iobroker.ring/node_modules/ring-client-api
36
- node ring-auth-cli
37
- ```
38
-
39
- ![Ring Admin 1](docs/ring_admin_tab1.png)
40
-
41
- You can use special variables for your livestream and snapshort path and filename. This variables will be replaced with a counter, timestamp, ring id or kind of ring.
42
-
43
- * %d : Unix timestamp. Example: test_%d -> test_1588331430061
44
- * %i : Id of your ring device: Example: test_%i -> test_234567890
45
- * %n : Counter since ring instance start. Example: test_%n -> test_1
46
- * %k : Kind of your ring device: Example: test_%k -> test_doorbel
47
-
48
- ![Ring Admin 2](docs/ring_admin_tab2.png)
49
-
50
- ## Objects
51
-
52
- ![Ring Admin 2](docs/ring_objects.png)
53
-
54
- ## Example
55
-
56
- An example to get changes if a motion or door ring is detected:
57
- ```
58
- on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
59
- if(obj.state.val == 'ding') console.log("Someone is at the door");
60
- if(obj.state.val == 'motion') console.log("Motion detected");
61
- });
62
- ```
63
-
64
- ## Changelog
65
-
66
- <!--
67
- Placeholder for the next version (at the beginning of the line):
68
- ### __WORK IN PROGRESS__
1
+ ![Logo](admin/ring.png)
2
+
3
+ # Ring Adapter
4
+
5
+ [![Travis CI Build Status](https://travis-ci.org/iobroker-community-adapters/ioBroker.ring.svg?branch=master)](https://travis-ci.org/iobroker-community-adapters/ioBroker.ring)
6
+ [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/iobroker-community-adapters/ioBroker.ring?branch=master&svg=true)](https://ci.appveyor.com/project/schmupu/ioBroker-ring/)
7
+ ![Number of Installations](http://iobroker.live/badges/ring-installed.svg) ![Number of Installations](http://iobroker.live/badges/ring-stable.svg) [![NPM version](http://img.shields.io/npm/v/iobroker.ring.svg)](https://www.npmjs.com/package/iobroker.ring)
8
+ [![Downloads](https://img.shields.io/npm/dm/iobroker.ring.svg)](https://www.npmjs.com/package/iobroker.ring)
9
+
10
+ [![NPM](https://nodei.co/npm/iobroker.ring.png?downloads=true)](https://nodei.co/npm/iobroker.ring/)
11
+
12
+ Requires Admin v4 and ``node 16.x``.
13
+
14
+ The Ring adapter works with Ring devices like the Ring Video Doorbell and Ring Cam and shows if somenone rings the doorbell or if motion is detected. The Ring Video Doorbell or Cam sends a videostream if a motion or doorbell ist detected.
15
+
16
+ ### SIP (before Version 3.x)
17
+ You can use the SIP Information for a SIP Video Conference with your SIP client.
18
+ The adapter will not provide all ring devices because the used API do not includes all ring devices.
19
+
20
+ You can use for example the Blink SIP client on [http://icanblink.com/](http://icanblink.com/). To get video working go into Blink's Preferences and under "Accounts", switch the tab to "Media" and deselect "Encrypt audio and video" under "RTP Options". Be careful the SIP information expire after a few seconds!
21
+ Hopefully I will able to support a video stream soon. Unfortunatly [ring.com](https://ring.com) does not have an official API that support this feature.
22
+ If you press the livestreamrequest button you get new SIP Information for building up a SIP Video Call session. If you are using the [ring.com](https://ring.com) cloud you find under history a http link to your last motion / door bell recorded video.
23
+
24
+
25
+ ## Install & Configuration
26
+
27
+ After installing the Adapter you have to enter your Email and Password of your [ring.com](https://ring.com) Account and a Token. Ring now requires the use of Two-Factor Auth (2fa) for all accounts. For getting the token please do following on your shell.
28
+ ```
29
+ npx -p ring-client-api ring-auth-cli
30
+ ```
31
+ or
32
+ ```
33
+ # Unix
34
+ cd /opt/iobroker/node_modules/iobroker.ring/
35
+ npm i ring-client-api
36
+
37
+ cd /opt/iobroker/node_modules/iobroker.ring/node_modules/ring-client-api
38
+ node ring-auth-cli
39
+ ```
40
+
41
+ You can use special variables for your livestream and snapshort path and filename. This variables will be replaced with a counter, timestamp, ring id or kind of ring.
42
+
43
+ * %d : Unix timestamp. Example: test_%d -> test_1588331430061
44
+ * %i : Id of your ring device: Example: test_%i -> test_234567890
45
+ * %n : Counter since ring instance start. Example: test_%n -> test_1
46
+ * %k : Kind of your ring device: Example: test_%k -> test_doorbel
47
+
48
+ ## Changelog
49
+
50
+ <!--
51
+ Placeholder for the next version (at the beginning of the line):
52
+ ### **WORK IN PROGRESS**
69
53
  -->
70
- ### 2.0.0-beta.0 (2022-02-05)
71
- * (theimo1221) Update packages
72
- * (theimo1221) Add JS-Controller 4.0 dependency
54
+ ### 3.0.0-beta.7 (2022-05-16)
55
+
56
+ * (theimo1221) Prevent Crashes on unsupported devices
57
+
58
+ ### 3.0.0-beta.6 (2022-05-16)
59
+
60
+ * (theimo1221) Record more events (without recording twice)
61
+ * (theimo1221) Improve snapshot deleting for initial snapshot after restart
62
+
63
+ ### 3.0.0-beta.5 (2022-05-14)
64
+
65
+ * (theimo1221) Prevent crashes during installation by clearer enforcing of node 16
66
+
67
+ ### 3.0.0-beta.4 (2022-05-14)
68
+
69
+ * (theimo1221) Changes in io-package.json for release workflow
70
+
71
+ ### 3.0.0-beta.3 (2022-05-14)
72
+ * (theimo1221) Rewrite V3 (Breaking Changes listed below)
73
+ * (theimo1221) Update packages
74
+ * (theimo1221) Fix in github release workflow
75
+
76
+ ### 2.0.0-beta.3 (2022-02-08)
77
+ * (theimo1221) Fix adapter checker issues
78
+
79
+ ### 2.0.0-beta.0 (2022-02-05)
80
+ * (theimo1221) Update packages
81
+ * (theimo1221) Add JS-Controller 4.0 dependency
73
82
  * (theimo1221) On ding --> First take snapshot then livestream
74
83
 
75
- ### 1.2.8 (2021-10-14)
84
+ ### 1.2.8 (2021-10-14)
76
85
  * (theimo1221) Update packages
77
86
 
78
- ### 1.2.6 (2021-09-05)
79
- * (theimo1221) Update packages
80
- * (theimo1221) Stop adapter on unhandled Error
87
+ ### 1.2.6 (2021-09-05)
88
+ * (theimo1221) Update packages
89
+ * (theimo1221) Stop adapter on unhandled Error
81
90
  * (theimo1221) Terminate adapter on invalid ring credentials
82
91
 
83
- ### 1.2.4-1 (2021-08-12)
92
+ ### 1.2.4-1 (2021-08-12)
84
93
  * (theimo1221) Update packages
85
94
 
86
- ### 1.2.4-0 (2021-08-07)
87
- * (theimo1221) Refactoring
95
+ ### 1.2.4-0 (2021-08-07)
96
+ * (theimo1221) Refactoring
88
97
  * (theimo1221) Update packages
89
98
 
90
- ### 1.2.3 (2021-07-30)
91
- * (theimo1221) Update packages
99
+ ### 1.2.3 (2021-07-30)
100
+ * (theimo1221) Update packages
92
101
  * (theimo1221) Fix compatibility issues with new ring api
93
102
 
94
- ### 1.2.2 (2021-05-05)
103
+ ### 1.2.2 (2021-05-05)
95
104
  * (theimo1221) Update packages due to security patches
96
105
 
97
- ### 1.2.1 (2021-04-09)
106
+ ### 1.2.1 (2021-04-09)
98
107
  * (theimo1221) Bump version
99
108
 
100
- ### 1.2.0 (2021-04-08)
101
- * (theimo1221) Add new device type spotlightw as doorbell
109
+ ### 1.2.0 (2021-04-08)
110
+ * (theimo1221) Add new device type spotlightw as doorbell
102
111
  * (theimo1221) Update dependencies (ringapi, node-schedule, etc.)
103
112
 
104
- ### 1.1.6-3 (2021-03-29)
105
- * (theimo1221) Fix typo preventing Livestream recordings after motion detection
113
+ ### 1.1.6-3 (2021-03-29)
114
+ * (theimo1221) Fix typo preventing Livestream recordings after motion detection
106
115
  * (theimo1221) Reduce Levels of Log Messages, to not spam iobroker Log
107
116
 
108
- ### 1.1.6-2 (2021-03-29)
117
+ ### 1.1.6-2 (2021-03-29)
109
118
  * (theimo1221) Fixing some Issues while saving snapshots and place Snapshots within 'iobroker-data' Folder.
110
119
 
111
- ### 1.1.6-1 (2021-03-26)
112
- * (theimo1221) Support for Floodlight V2
120
+ ### 1.1.6-1 (2021-03-26)
121
+ * (theimo1221) Support for Floodlight V2
113
122
  * (theimo1221) Control Floodlight by Switch
114
123
 
115
- ### 1.1.5 (04.11.2020)
124
+ ### 1.1.5 (04.11.2020)
116
125
  * (Stübi) Add floodlight
117
126
 
118
- ### 1.1.4 (23.05.2020)
127
+ ### 1.1.4 (23.05.2020)
119
128
  * (Stübi) Add new libraries
120
129
 
121
- ### 1.1.3 (06.05.2020)
130
+ ### 1.1.3 (06.05.2020)
122
131
  * (Stübi) Fixed error of missing objects
123
132
 
124
- ### 1.1.2 (02.05.2020)
125
- * (Stübi) Fixed health info like missing battery status (Issue #22, Issue #25)
126
- * (Stübi) Change error handling
127
- * (Stübi) Providing Stick Up Cam (BETA)
133
+ ### 1.1.2 (02.05.2020)
134
+ * (Stübi) Fixed health info like missing battery status (Issue #22, Issue #25)
135
+ * (Stübi) Change error handling
136
+ * (Stübi) Providing Stick Up Cam (BETA)
128
137
  * (Stübi) Using variables in the filename of the livestream or snapshot
129
138
 
130
- ### 1.1.1 (02.05.2020)
131
- * (Stübi) Bugfixing
139
+ ### 1.1.1 (02.05.2020)
140
+ * (Stübi) Bugfixing
132
141
  * (Stübi) User can enable/disable external sentry logging
133
142
 
134
- ### 1.1.0 (01.05.2020)
135
- * (Stübi) Node 10 is now required, Node 12 recommended. If you use Node 8 or less, the adapter will stop immediately.
136
- * (Stübi) Tested with js-controller 3. I recommend using js-controller 3 or higher because of sentry logging and more features in the future
137
- * (Stübi) Snapshot link will be shown as https or http in state (Issue #18)
138
- * (Stübi) Livestream link added and a request button added to get new livestream
139
- * (Stübi) Old snapshots and livestreams can be deleted on the filesystem
140
- * (Stübi) Sentry logging added
141
- * (Stübi) Small improvements and bugfixing
143
+ ### 1.1.0 (01.05.2020)
144
+ * (Stübi) Node 10 is now required, Node 12 recommended. If you use Node 8 or less, the adapter will stop immediately.
145
+ * (Stübi) Tested with js-controller 3. I recommend using js-controller 3 or higher because of sentry logging and more features in the future
146
+ * (Stübi) Snapshot link will be shown as https or http in state (Issue #18)
147
+ * (Stübi) Livestream link added and a request button added to get new livestream
148
+ * (Stübi) Old snapshots and livestreams can be deleted on the filesystem
149
+ * (Stübi) Sentry logging added
150
+ * (Stübi) Small improvements and bugfixing
142
151
  * (Stübi) Add a Two-Factor Auth (2fa) description (Issue #14, Issue #13, Issue #19)
143
152
 
144
- ### 1.0.7 (24.12.2019)
153
+ ### 1.0.7 (24.12.2019)
145
154
  * (Stübi) Bugfixing
146
155
 
147
- ### 1.0.6 (20.12.2019)
148
- * (Stübi) Bugfixing: Login with username and password changed
156
+ ### 1.0.6 (20.12.2019)
157
+ * (Stübi) Bugfixing: Login with username and password changed
149
158
  * (Stübi) New feature (BETA): Now you can make snapshots in jpg and a livestream in mp4 format. Unfortunately the snapshot / livestream does not work always!
150
159
 
151
- ### 1.0.5 (18.04.2019)
152
- * (Stübi) Bugfixing
153
- * (Stübi) Using new API. With this API livestreaming and snapshots are possible (work still in progress and not supported in this version)
154
- * (Stübi) Fixed an error with js-controller 2.0. You need at least this version with js-controller 2.0
160
+ ### 1.0.5 (18.04.2019)
161
+ * (Stübi) Bugfixing
162
+ * (Stübi) Using new API. With this API livestreaming and snapshots are possible (work still in progress and not supported in this version)
163
+ * (Stübi) Fixed an error with js-controller 2.0. You need at least this version with js-controller 2.0
155
164
  * (Stübi) two face authentication
156
165
 
157
- ### 1.0.4 (17.04.2019)
166
+ ### 1.0.4 (17.04.2019)
158
167
  * (Stübi) Bugfixing for Ring Pro
159
168
 
160
- ### 1.0.3 (09.03.2019)
169
+ ### 1.0.3 (09.03.2019)
161
170
  * (Stübi) Major change! I had to change the used ring.com API to an other API. The old one did not work anymore. For this reason, a lot has to be redesigned.
162
171
 
163
- ### 1.0.2 (01.02.2019)
172
+ ### 1.0.2 (01.02.2019)
164
173
  * (Stübi) More debug information
165
174
 
166
- ### 1.0.1 (05.01.2019)
175
+ ### 1.0.1 (05.01.2019)
167
176
  * (Stübi) Support js-controller compact mode
168
177
 
169
- ### 1.0.0 (04.01.2018)
178
+ ### 1.0.0 (04.01.2018)
170
179
  * (Stübi) Add camera device. For this reason, the device name changed from doorbot to doorbell.
171
180
 
172
- ### 0.1.3 (20.12.2018)
181
+ ### 0.1.3 (20.12.2018)
173
182
  * (Stübi) Update error handling
174
183
 
175
- ### 0.1.2 (17.12.2018)
184
+ ### 0.1.2 (17.12.2018)
176
185
  * (Stübi) Update error handling
177
186
 
178
- ### 0.1.1 (15.12.2018)
187
+ ### 0.1.1 (15.12.2018)
179
188
  * (Stübi) Improvements
180
189
 
181
- ### 0.1.0 (14.12.2018)
190
+ ### 0.1.0 (14.12.2018)
182
191
  * (Stübi) First Version
183
192
 
184
- ## License
185
- The MIT License (MIT)
186
-
187
- Copyright (c) 2020 Thorsten <thorsten@stueben.de> / <https://github.com/schmupu>
188
-
189
- Permission is hereby granted, free of charge, to any person obtaining a copy
190
- of this software and associated documentation files (the "Software"), to deal
191
- in the Software without restriction, including without limitation the rights
192
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
193
- copies of the Software, and to permit persons to whom the Software is
194
- furnished to do so, subject to the following conditions:
195
-
196
- The above copyright notice and this permission notice shall be included in
197
- all copies or substantial portions of the Software.
198
-
199
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
200
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
201
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
202
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
203
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
204
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
205
- THE SOFTWARE.
193
+ ### V3 Rewrite Breaking Changes
194
+ 1. The Device Names got extended by their description (e.g. from `Device 1234567` to `Device 1234567 ("Floodlight Garden")`)
195
+ 2. Snapshot/Livestream Data is now in a respective channel, containing the other data points.
196
+ 3. The snapshot/livestream object got changed from type meta to state with type file.
197
+ 4. Events (Motion, Ding, etc.) are now in a respective channel.
198
+ 5. Due to `ring-api` dropping the support for node before `v16.x` this adapter needs `node v16.x`
199
+
200
+
201
+ ### Scripts in `package.json`
202
+ Several npm scripts are predefined for your convenience. You can run them using `npm run <scriptname>`
203
+ | Script name | Description |
204
+ |-------------|-------------|
205
+ | `build:ts` | Compile the TypeScript sources. |
206
+ | `watch:ts` | Compile the TypeScript sources and watch for changes. |
207
+ | `watch` | Shortcut for `npm run watch:ts` |
208
+ | `test:ts` | Executes the tests you defined in `*.test.ts` files. |
209
+ | `test:package` | Ensures your `package.json` and `io-package.json` are valid. |
210
+ | `test:unit` | Tests the adapter startup with unit tests (fast, but might require module mocks to work). |
211
+ | `test:integration` | Tests the adapter startup with an actual instance of ioBroker. |
212
+ | `test` | Performs a minimal test run on package files and your tests. |
213
+ | `check` | Performs a type-check on your code (without compiling anything). |
214
+ | `coverage` | Generates code coverage using your test files. |
215
+ | `lint` | Runs `ESLint` to check your code for formatting errors and potential bugs. |
216
+ | `release` | Creates a new release, see [`@alcalzone/release-script`](https://github.com/AlCalzone/release-script#usage) for more details. |
217
+
218
+ ### Writing tests
219
+ When done right, testing code is invaluable, because it gives you the
220
+ confidence to change your code while knowing exactly if and when
221
+ something breaks. A good read on the topic of test-driven development
222
+ is https://hackernoon.com/introduction-to-test-driven-development-tdd-61a13bc92d92.
223
+ Although writing tests before the code might seem strange at first, but it has very
224
+ clear upsides.
225
+
226
+ The template provides you with basic tests for the adapter startup and package files.
227
+ It is recommended that you add your own tests into the mix.
228
+
229
+
230
+ ## License
231
+ MIT License
232
+
233
+ Copyright (c) 2022 Thorsten <thorsten@stueben.de> / <https://github.com/schmupu>
234
+
235
+ Permission is hereby granted, free of charge, to any person obtaining a copy
236
+ of this software and associated documentation files (the "Software"), to deal
237
+ in the Software without restriction, including without limitation the rights
238
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
239
+ copies of the Software, and to permit persons to whom the Software is
240
+ furnished to do so, subject to the following conditions:
241
+
242
+ The above copyright notice and this permission notice shall be included in all
243
+ copies or substantial portions of the Software.
244
+
245
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
246
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
247
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
248
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
249
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
250
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
251
+ SOFTWARE.
@@ -0,0 +1,93 @@
1
+ declare let systemDictionary: Record<string, Record<string, string>>;
2
+
3
+ declare let load: (settings: Record<string, unknown>, onChange: (hasChanges: boolean) => void) => void;
4
+ declare let save: (callback: (settings: Record<string, unknown>) => void) => void;
5
+
6
+ // make load and save exist on the window object
7
+ interface Window {
8
+ load: typeof load;
9
+ save: typeof save;
10
+ }
11
+
12
+ declare const instance: number;
13
+ declare const adapter: string;
14
+ /** Translates text */
15
+ declare function _(text: string, arg1?: string, arg2?: string, arg3?: string): string;
16
+ declare const socket: ioBrokerSocket;
17
+ declare function sendTo(
18
+ instance: any | null,
19
+ command: string,
20
+ message: any,
21
+ callback: (result: SendToResult) => void | Promise<void>,
22
+ ): void;
23
+
24
+ interface SendToResult {
25
+ error?: string | Error;
26
+ result?: any;
27
+ }
28
+
29
+ // tslint:disable-next-line:class-name
30
+ interface ioBrokerSocket {
31
+ emit(
32
+ command: "subscribeObjects",
33
+ pattern: string,
34
+ callback?: (err?: string) => void | Promise<void>,
35
+ ): void;
36
+ emit(
37
+ command: "subscribeStates",
38
+ pattern: string,
39
+ callback?: (err?: string) => void | Promise<void>,
40
+ ): void;
41
+ emit(
42
+ command: "unsubscribeObjects",
43
+ pattern: string,
44
+ callback?: (err?: string) => void | Promise<void>,
45
+ ): void;
46
+ emit(
47
+ command: "unsubscribeStates",
48
+ pattern: string,
49
+ callback?: (err?: string) => void | Promise<void>,
50
+ ): void;
51
+
52
+ emit(
53
+ event: "getObjectView",
54
+ view: "system",
55
+ type: "device",
56
+ options: ioBroker.GetObjectViewParams,
57
+ callback: (
58
+ err: string | undefined,
59
+ result?: any,
60
+ ) => void | Promise<void>,
61
+ ): void;
62
+ emit(
63
+ event: "getStates",
64
+ callback: (
65
+ err: string | undefined,
66
+ result?: Record<string, any>,
67
+ ) => void,
68
+ ): void;
69
+ emit(
70
+ event: "getState",
71
+ id: string,
72
+ callback: (err: string | undefined, result?: ioBroker.State) => void,
73
+ ): void;
74
+ emit(
75
+ event: "setState",
76
+ id: string,
77
+ state: unknown,
78
+ callback: (err: string | undefined, result?: any) => void,
79
+ ): void;
80
+
81
+ on(event: "objectChange", handler: ioBroker.ObjectChangeHandler): void;
82
+ on(event: "stateChange", handler: ioBroker.StateChangeHandler): void;
83
+ removeEventHandler(
84
+ event: "objectChange",
85
+ handler: ioBroker.ObjectChangeHandler,
86
+ ): void;
87
+ removeEventHandler(
88
+ event: "stateChange",
89
+ handler: ioBroker.StateChangeHandler,
90
+ ): void;
91
+
92
+ // TODO: other events
93
+ }