iobroker.ring 1.2.8 → 3.0.0-beta.10

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,6 +1,6 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (c) 2020 Thorsten Stueben <thorsten@stueben.de>
3
+ Copyright (c) 2022 Thorsten Stueben <thorsten@stueben.de>
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
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
9
  copies of the Software, and to permit persons to whom the Software is
10
10
  furnished to do so, subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
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.
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -9,15 +9,17 @@
9
9
 
10
10
  [![NPM](https://nodei.co/npm/iobroker.ring.png?downloads=true)](https://nodei.co/npm/iobroker.ring/)
11
11
 
12
- Requires node.js 10.0 or higher and Admin v3.
12
+ Requires Admin v4 and ``node 16.x``.
13
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.
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.
17
19
 
18
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!
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
+ 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.
21
23
 
22
24
 
23
25
  ## Install & Configuration
@@ -36,8 +38,6 @@ cd /opt/iobroker/node_modules/iobroker.ring/node_modules/ring-client-api
36
38
  node ring-auth-cli
37
39
  ```
38
40
 
39
- ![Ring Admin 1](docs/ring_admin_tab1.png)
40
-
41
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
42
 
43
43
  * %d : Unix timestamp. Example: test_%d -> test_1588331430061
@@ -45,28 +45,54 @@ You can use special variables for your livestream and snapshort path and filenam
45
45
  * %n : Counter since ring instance start. Example: test_%n -> test_1
46
46
  * %k : Kind of your ring device: Example: test_%k -> test_doorbel
47
47
 
48
- ![Ring Admin 2](docs/ring_admin_tab2.png)
48
+ ## Changelog
49
49
 
50
- ## Objects
50
+ <!--
51
+ Placeholder for the next version (at the beginning of the line):
52
+ ### **WORK IN PROGRESS**
53
+ -->
54
+ ### 3.0.0-beta.10 (2022-05-24)
51
55
 
52
- ![Ring Admin 2](docs/ring_objects.png)
56
+ * (theimo1221) Add `lpd_v4` Doorbell
53
57
 
54
- ## Example
58
+ ### 3.0.0-beta.9 (2022-05-21)
55
59
 
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
- ```
60
+ * (theimo1221) For stability reasons, perform an active refresh every 2 hours.
63
61
 
64
- ## Changelog
62
+ ### 3.0.0-beta.8 (2022-05-17)
63
+
64
+ * (theimo1221) Fix writing to iobroker-data/files folder (thx to Apollon)
65
+
66
+ ### 3.0.0-beta.7 (2022-05-16)
67
+
68
+ * (theimo1221) Prevent Crashes on unsupported devices
69
+
70
+ ### 3.0.0-beta.6 (2022-05-16)
71
+
72
+ * (theimo1221) Record more events (without recording twice)
73
+ * (theimo1221) Improve snapshot deleting for initial snapshot after restart
74
+
75
+ ### 3.0.0-beta.5 (2022-05-14)
76
+
77
+ * (theimo1221) Prevent crashes during installation by clearer enforcing of node 16
78
+
79
+ ### 3.0.0-beta.4 (2022-05-14)
80
+
81
+ * (theimo1221) Changes in io-package.json for release workflow
82
+
83
+ ### 3.0.0-beta.3 (2022-05-14)
84
+ * (theimo1221) Rewrite V3 (Breaking Changes listed below)
85
+ * (theimo1221) Update packages
86
+ * (theimo1221) Fix in github release workflow
87
+
88
+ ### 2.0.0-beta.3 (2022-02-08)
89
+ * (theimo1221) Fix adapter checker issues
90
+
91
+ ### 2.0.0-beta.0 (2022-02-05)
92
+ * (theimo1221) Update packages
93
+ * (theimo1221) Add JS-Controller 4.0 dependency
94
+ * (theimo1221) On ding --> First take snapshot then livestream
65
95
 
66
- <!--
67
- Placeholder for the next version (at the beginning of the line):
68
- ### __WORK IN PROGRESS__
69
- -->
70
96
  ### 1.2.8 (2021-10-14)
71
97
  * (theimo1221) Update packages
72
98
 
@@ -117,7 +143,7 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
117
143
  * (Stübi) Fixed error of missing objects
118
144
 
119
145
  ### 1.1.2 (02.05.2020)
120
- * (Stübi) Fixed health info like missing battery status (Issue #22, Issue #25)
146
+ * (Stübi) Fixed health info like missing battery status (Issue #22, Issue #25)
121
147
  * (Stübi) Change error handling
122
148
  * (Stübi) Providing Stick Up Cam (BETA)
123
149
  * (Stübi) Using variables in the filename of the livestream or snapshot
@@ -128,12 +154,12 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
128
154
 
129
155
  ### 1.1.0 (01.05.2020)
130
156
  * (Stübi) Node 10 is now required, Node 12 recommended. If you use Node 8 or less, the adapter will stop immediately.
131
- * (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
157
+ * (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
132
158
  * (Stübi) Snapshot link will be shown as https or http in state (Issue #18)
133
159
  * (Stübi) Livestream link added and a request button added to get new livestream
134
160
  * (Stübi) Old snapshots and livestreams can be deleted on the filesystem
135
161
  * (Stübi) Sentry logging added
136
- * (Stübi) Small improvements and bugfixing
162
+ * (Stübi) Small improvements and bugfixing
137
163
  * (Stübi) Add a Two-Factor Auth (2fa) description (Issue #14, Issue #13, Issue #19)
138
164
 
139
165
  ### 1.0.7 (24.12.2019)
@@ -144,7 +170,7 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
144
170
  * (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!
145
171
 
146
172
  ### 1.0.5 (18.04.2019)
147
- * (Stübi) Bugfixing
173
+ * (Stübi) Bugfixing
148
174
  * (Stübi) Using new API. With this API livestreaming and snapshots are possible (work still in progress and not supported in this version)
149
175
  * (Stübi) Fixed an error with js-controller 2.0. You need at least this version with js-controller 2.0
150
176
  * (Stübi) two face authentication
@@ -176,10 +202,47 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
176
202
  ### 0.1.0 (14.12.2018)
177
203
  * (Stübi) First Version
178
204
 
205
+ ### V3 Rewrite Breaking Changes
206
+ 1. The Device Names got extended by their description (e.g. from `Device 1234567` to `Device 1234567 ("Floodlight Garden")`)
207
+ 2. Snapshot/Livestream Data is now in a respective channel, containing the other data points.
208
+ 3. The snapshot/livestream object got changed from type meta to state with type file.
209
+ 4. Events (Motion, Ding, etc.) are now in a respective channel.
210
+ 5. Due to `ring-api` dropping the support for node before `v16.x` this adapter needs `node v16.x`
211
+ 6. Active refreshes are reduced to once every 2 hours, as we are listening/reacting on events.
212
+
213
+ ### Scripts in `package.json`
214
+ Several npm scripts are predefined for your convenience. You can run them using `npm run <scriptname>`
215
+ | Script name | Description |
216
+ |-------------|-------------|
217
+ | `build:ts` | Compile the TypeScript sources. |
218
+ | `watch:ts` | Compile the TypeScript sources and watch for changes. |
219
+ | `watch` | Shortcut for `npm run watch:ts` |
220
+ | `test:ts` | Executes the tests you defined in `*.test.ts` files. |
221
+ | `test:package` | Ensures your `package.json` and `io-package.json` are valid. |
222
+ | `test:unit` | Tests the adapter startup with unit tests (fast, but might require module mocks to work). |
223
+ | `test:integration` | Tests the adapter startup with an actual instance of ioBroker. |
224
+ | `test` | Performs a minimal test run on package files and your tests. |
225
+ | `check` | Performs a type-check on your code (without compiling anything). |
226
+ | `coverage` | Generates code coverage using your test files. |
227
+ | `lint` | Runs `ESLint` to check your code for formatting errors and potential bugs. |
228
+ | `release` | Creates a new release, see [`@alcalzone/release-script`](https://github.com/AlCalzone/release-script#usage) for more details. |
229
+
230
+ ### Writing tests
231
+ When done right, testing code is invaluable, because it gives you the
232
+ confidence to change your code while knowing exactly if and when
233
+ something breaks. A good read on the topic of test-driven development
234
+ is https://hackernoon.com/introduction-to-test-driven-development-tdd-61a13bc92d92.
235
+ Although writing tests before the code might seem strange at first, but it has very
236
+ clear upsides.
237
+
238
+ The template provides you with basic tests for the adapter startup and package files.
239
+ It is recommended that you add your own tests into the mix.
240
+
241
+
179
242
  ## License
180
- The MIT License (MIT)
243
+ MIT License
181
244
 
182
- Copyright (c) 2020 Thorsten <thorsten@stueben.de> / <https://github.com/schmupu>
245
+ Copyright (c) 2022 Thorsten <thorsten@stueben.de> / <https://github.com/schmupu>
183
246
 
184
247
  Permission is hereby granted, free of charge, to any person obtaining a copy
185
248
  of this software and associated documentation files (the "Software"), to deal
@@ -188,13 +251,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
188
251
  copies of the Software, and to permit persons to whom the Software is
189
252
  furnished to do so, subject to the following conditions:
190
253
 
191
- The above copyright notice and this permission notice shall be included in
192
- all copies or substantial portions of the Software.
254
+ The above copyright notice and this permission notice shall be included in all
255
+ copies or substantial portions of the Software.
193
256
 
194
257
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
195
258
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
196
259
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
197
260
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
198
261
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
199
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
200
- THE SOFTWARE.
262
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
263
+ 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
+ }