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

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,267 @@
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.11 (2022-05-24)
55
+
56
+ * (theimo1221) Add processing of new token provided by ring.
57
+
58
+ ### 3.0.0-beta.10 (2022-05-24)
59
+
60
+ * (theimo1221) Add `lpd_v4` Doorbell
61
+
62
+ ### 3.0.0-beta.9 (2022-05-21)
63
+
64
+ * (theimo1221) For stability reasons, perform an active refresh every 2 hours.
65
+
66
+ ### 3.0.0-beta.8 (2022-05-17)
67
+
68
+ * (theimo1221) Fix writing to iobroker-data/files folder (thx to Apollon)
69
+
70
+ ### 3.0.0-beta.7 (2022-05-16)
71
+
72
+ * (theimo1221) Prevent Crashes on unsupported devices
73
+
74
+ ### 3.0.0-beta.6 (2022-05-16)
75
+
76
+ * (theimo1221) Record more events (without recording twice)
77
+ * (theimo1221) Improve snapshot deleting for initial snapshot after restart
78
+
79
+ ### 3.0.0-beta.5 (2022-05-14)
80
+
81
+ * (theimo1221) Prevent crashes during installation by clearer enforcing of node 16
82
+
83
+ ### 3.0.0-beta.4 (2022-05-14)
84
+
85
+ * (theimo1221) Changes in io-package.json for release workflow
86
+
87
+ ### 3.0.0-beta.3 (2022-05-14)
88
+ * (theimo1221) Rewrite V3 (Breaking Changes listed below)
89
+ * (theimo1221) Update packages
90
+ * (theimo1221) Fix in github release workflow
91
+
92
+ ### 2.0.0-beta.3 (2022-02-08)
93
+ * (theimo1221) Fix adapter checker issues
94
+
95
+ ### 2.0.0-beta.0 (2022-02-05)
96
+ * (theimo1221) Update packages
97
+ * (theimo1221) Add JS-Controller 4.0 dependency
73
98
  * (theimo1221) On ding --> First take snapshot then livestream
74
99
 
75
- ### 1.2.8 (2021-10-14)
100
+ ### 1.2.8 (2021-10-14)
76
101
  * (theimo1221) Update packages
77
102
 
78
- ### 1.2.6 (2021-09-05)
79
- * (theimo1221) Update packages
80
- * (theimo1221) Stop adapter on unhandled Error
103
+ ### 1.2.6 (2021-09-05)
104
+ * (theimo1221) Update packages
105
+ * (theimo1221) Stop adapter on unhandled Error
81
106
  * (theimo1221) Terminate adapter on invalid ring credentials
82
107
 
83
- ### 1.2.4-1 (2021-08-12)
108
+ ### 1.2.4-1 (2021-08-12)
84
109
  * (theimo1221) Update packages
85
110
 
86
- ### 1.2.4-0 (2021-08-07)
87
- * (theimo1221) Refactoring
111
+ ### 1.2.4-0 (2021-08-07)
112
+ * (theimo1221) Refactoring
88
113
  * (theimo1221) Update packages
89
114
 
90
- ### 1.2.3 (2021-07-30)
91
- * (theimo1221) Update packages
115
+ ### 1.2.3 (2021-07-30)
116
+ * (theimo1221) Update packages
92
117
  * (theimo1221) Fix compatibility issues with new ring api
93
118
 
94
- ### 1.2.2 (2021-05-05)
119
+ ### 1.2.2 (2021-05-05)
95
120
  * (theimo1221) Update packages due to security patches
96
121
 
97
- ### 1.2.1 (2021-04-09)
122
+ ### 1.2.1 (2021-04-09)
98
123
  * (theimo1221) Bump version
99
124
 
100
- ### 1.2.0 (2021-04-08)
101
- * (theimo1221) Add new device type spotlightw as doorbell
125
+ ### 1.2.0 (2021-04-08)
126
+ * (theimo1221) Add new device type spotlightw as doorbell
102
127
  * (theimo1221) Update dependencies (ringapi, node-schedule, etc.)
103
128
 
104
- ### 1.1.6-3 (2021-03-29)
105
- * (theimo1221) Fix typo preventing Livestream recordings after motion detection
129
+ ### 1.1.6-3 (2021-03-29)
130
+ * (theimo1221) Fix typo preventing Livestream recordings after motion detection
106
131
  * (theimo1221) Reduce Levels of Log Messages, to not spam iobroker Log
107
132
 
108
- ### 1.1.6-2 (2021-03-29)
133
+ ### 1.1.6-2 (2021-03-29)
109
134
  * (theimo1221) Fixing some Issues while saving snapshots and place Snapshots within 'iobroker-data' Folder.
110
135
 
111
- ### 1.1.6-1 (2021-03-26)
112
- * (theimo1221) Support for Floodlight V2
136
+ ### 1.1.6-1 (2021-03-26)
137
+ * (theimo1221) Support for Floodlight V2
113
138
  * (theimo1221) Control Floodlight by Switch
114
139
 
115
- ### 1.1.5 (04.11.2020)
140
+ ### 1.1.5 (04.11.2020)
116
141
  * (Stübi) Add floodlight
117
142
 
118
- ### 1.1.4 (23.05.2020)
143
+ ### 1.1.4 (23.05.2020)
119
144
  * (Stübi) Add new libraries
120
145
 
121
- ### 1.1.3 (06.05.2020)
146
+ ### 1.1.3 (06.05.2020)
122
147
  * (Stübi) Fixed error of missing objects
123
148
 
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)
149
+ ### 1.1.2 (02.05.2020)
150
+ * (Stübi) Fixed health info like missing battery status (Issue #22, Issue #25)
151
+ * (Stübi) Change error handling
152
+ * (Stübi) Providing Stick Up Cam (BETA)
128
153
  * (Stübi) Using variables in the filename of the livestream or snapshot
129
154
 
130
- ### 1.1.1 (02.05.2020)
131
- * (Stübi) Bugfixing
155
+ ### 1.1.1 (02.05.2020)
156
+ * (Stübi) Bugfixing
132
157
  * (Stübi) User can enable/disable external sentry logging
133
158
 
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
159
+ ### 1.1.0 (01.05.2020)
160
+ * (Stübi) Node 10 is now required, Node 12 recommended. If you use Node 8 or less, the adapter will stop immediately.
161
+ * (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
162
+ * (Stübi) Snapshot link will be shown as https or http in state (Issue #18)
163
+ * (Stübi) Livestream link added and a request button added to get new livestream
164
+ * (Stübi) Old snapshots and livestreams can be deleted on the filesystem
165
+ * (Stübi) Sentry logging added
166
+ * (Stübi) Small improvements and bugfixing
142
167
  * (Stübi) Add a Two-Factor Auth (2fa) description (Issue #14, Issue #13, Issue #19)
143
168
 
144
- ### 1.0.7 (24.12.2019)
169
+ ### 1.0.7 (24.12.2019)
145
170
  * (Stübi) Bugfixing
146
171
 
147
- ### 1.0.6 (20.12.2019)
148
- * (Stübi) Bugfixing: Login with username and password changed
172
+ ### 1.0.6 (20.12.2019)
173
+ * (Stübi) Bugfixing: Login with username and password changed
149
174
  * (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
175
 
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
176
+ ### 1.0.5 (18.04.2019)
177
+ * (Stübi) Bugfixing
178
+ * (Stübi) Using new API. With this API livestreaming and snapshots are possible (work still in progress and not supported in this version)
179
+ * (Stübi) Fixed an error with js-controller 2.0. You need at least this version with js-controller 2.0
155
180
  * (Stübi) two face authentication
156
181
 
157
- ### 1.0.4 (17.04.2019)
182
+ ### 1.0.4 (17.04.2019)
158
183
  * (Stübi) Bugfixing for Ring Pro
159
184
 
160
- ### 1.0.3 (09.03.2019)
185
+ ### 1.0.3 (09.03.2019)
161
186
  * (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
187
 
163
- ### 1.0.2 (01.02.2019)
188
+ ### 1.0.2 (01.02.2019)
164
189
  * (Stübi) More debug information
165
190
 
166
- ### 1.0.1 (05.01.2019)
191
+ ### 1.0.1 (05.01.2019)
167
192
  * (Stübi) Support js-controller compact mode
168
193
 
169
- ### 1.0.0 (04.01.2018)
194
+ ### 1.0.0 (04.01.2018)
170
195
  * (Stübi) Add camera device. For this reason, the device name changed from doorbot to doorbell.
171
196
 
172
- ### 0.1.3 (20.12.2018)
197
+ ### 0.1.3 (20.12.2018)
173
198
  * (Stübi) Update error handling
174
199
 
175
- ### 0.1.2 (17.12.2018)
200
+ ### 0.1.2 (17.12.2018)
176
201
  * (Stübi) Update error handling
177
202
 
178
- ### 0.1.1 (15.12.2018)
203
+ ### 0.1.1 (15.12.2018)
179
204
  * (Stübi) Improvements
180
205
 
181
- ### 0.1.0 (14.12.2018)
206
+ ### 0.1.0 (14.12.2018)
182
207
  * (Stübi) First Version
183
208
 
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.
209
+ ### V3 Rewrite Breaking Changes
210
+ 1. The Device Names got extended by their description (e.g. from `Device 1234567` to `Device 1234567 ("Floodlight Garden")`)
211
+ 2. Snapshot/Livestream Data is now in a respective channel, containing the other data points.
212
+ 3. The snapshot/livestream object got changed from type meta to state with type file.
213
+ 4. Events (Motion, Ding, etc.) are now in a respective channel.
214
+ 5. Due to `ring-api` dropping the support for node before `v16.x` this adapter needs `node v16.x`
215
+ 6. Active refreshes are reduced to once every 2 hours, as we are listening/reacting on events.
216
+
217
+ ### Scripts in `package.json`
218
+ Several npm scripts are predefined for your convenience. You can run them using `npm run <scriptname>`
219
+ | Script name | Description |
220
+ |-------------|-------------|
221
+ | `build:ts` | Compile the TypeScript sources. |
222
+ | `watch:ts` | Compile the TypeScript sources and watch for changes. |
223
+ | `watch` | Shortcut for `npm run watch:ts` |
224
+ | `test:ts` | Executes the tests you defined in `*.test.ts` files. |
225
+ | `test:package` | Ensures your `package.json` and `io-package.json` are valid. |
226
+ | `test:unit` | Tests the adapter startup with unit tests (fast, but might require module mocks to work). |
227
+ | `test:integration` | Tests the adapter startup with an actual instance of ioBroker. |
228
+ | `test` | Performs a minimal test run on package files and your tests. |
229
+ | `check` | Performs a type-check on your code (without compiling anything). |
230
+ | `coverage` | Generates code coverage using your test files. |
231
+ | `lint` | Runs `ESLint` to check your code for formatting errors and potential bugs. |
232
+ | `release` | Creates a new release, see [`@alcalzone/release-script`](https://github.com/AlCalzone/release-script#usage) for more details. |
233
+
234
+ ### Writing tests
235
+ When done right, testing code is invaluable, because it gives you the
236
+ confidence to change your code while knowing exactly if and when
237
+ something breaks. A good read on the topic of test-driven development
238
+ is https://hackernoon.com/introduction-to-test-driven-development-tdd-61a13bc92d92.
239
+ Although writing tests before the code might seem strange at first, but it has very
240
+ clear upsides.
241
+
242
+ The template provides you with basic tests for the adapter startup and package files.
243
+ It is recommended that you add your own tests into the mix.
244
+
245
+
246
+ ## License
247
+ MIT License
248
+
249
+ Copyright (c) 2022 Thorsten <thorsten@stueben.de> / <https://github.com/schmupu>
250
+
251
+ Permission is hereby granted, free of charge, to any person obtaining a copy
252
+ of this software and associated documentation files (the "Software"), to deal
253
+ in the Software without restriction, including without limitation the rights
254
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
255
+ copies of the Software, and to permit persons to whom the Software is
256
+ furnished to do so, subject to the following conditions:
257
+
258
+ The above copyright notice and this permission notice shall be included in all
259
+ copies or substantial portions of the Software.
260
+
261
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
262
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
263
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
264
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
265
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
266
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
267
+ 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
+ }