iobroker.ring 2.0.0-beta.3 → 3.0.0-beta.8

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,4 +1,4 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
3
  Copyright (c) 2022 Thorsten Stueben <thorsten@stueben.de>
4
4
 
@@ -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,38 @@ 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.8 (2022-05-17)
51
55
 
52
- ![Ring Admin 2](docs/ring_objects.png)
56
+ * (theimo1221) Fix writing to iobroker-data/files folder (thx to Apollon)
53
57
 
54
- ## Example
58
+ ### 3.0.0-beta.7 (2022-05-16)
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) Prevent Crashes on unsupported devices
63
61
 
64
- ## Changelog
62
+ ### 3.0.0-beta.6 (2022-05-16)
63
+
64
+ * (theimo1221) Record more events (without recording twice)
65
+ * (theimo1221) Improve snapshot deleting for initial snapshot after restart
66
+
67
+ ### 3.0.0-beta.5 (2022-05-14)
68
+
69
+ * (theimo1221) Prevent crashes during installation by clearer enforcing of node 16
70
+
71
+ ### 3.0.0-beta.4 (2022-05-14)
72
+
73
+ * (theimo1221) Changes in io-package.json for release workflow
74
+
75
+ ### 3.0.0-beta.3 (2022-05-14)
76
+ * (theimo1221) Rewrite V3 (Breaking Changes listed below)
77
+ * (theimo1221) Update packages
78
+ * (theimo1221) Fix in github release workflow
65
79
 
66
- <!--
67
- Placeholder for the next version (at the beginning of the line):
68
- ### __WORK IN PROGRESS__
69
- -->
70
80
  ### 2.0.0-beta.3 (2022-02-08)
71
81
  * (theimo1221) Fix adapter checker issues
72
82
 
@@ -125,7 +135,7 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
125
135
  * (Stübi) Fixed error of missing objects
126
136
 
127
137
  ### 1.1.2 (02.05.2020)
128
- * (Stübi) Fixed health info like missing battery status (Issue #22, Issue #25)
138
+ * (Stübi) Fixed health info like missing battery status (Issue #22, Issue #25)
129
139
  * (Stübi) Change error handling
130
140
  * (Stübi) Providing Stick Up Cam (BETA)
131
141
  * (Stübi) Using variables in the filename of the livestream or snapshot
@@ -136,12 +146,12 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
136
146
 
137
147
  ### 1.1.0 (01.05.2020)
138
148
  * (Stübi) Node 10 is now required, Node 12 recommended. If you use Node 8 or less, the adapter will stop immediately.
139
- * (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
149
+ * (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
140
150
  * (Stübi) Snapshot link will be shown as https or http in state (Issue #18)
141
151
  * (Stübi) Livestream link added and a request button added to get new livestream
142
152
  * (Stübi) Old snapshots and livestreams can be deleted on the filesystem
143
153
  * (Stübi) Sentry logging added
144
- * (Stübi) Small improvements and bugfixing
154
+ * (Stübi) Small improvements and bugfixing
145
155
  * (Stübi) Add a Two-Factor Auth (2fa) description (Issue #14, Issue #13, Issue #19)
146
156
 
147
157
  ### 1.0.7 (24.12.2019)
@@ -152,7 +162,7 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
152
162
  * (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!
153
163
 
154
164
  ### 1.0.5 (18.04.2019)
155
- * (Stübi) Bugfixing
165
+ * (Stübi) Bugfixing
156
166
  * (Stübi) Using new API. With this API livestreaming and snapshots are possible (work still in progress and not supported in this version)
157
167
  * (Stübi) Fixed an error with js-controller 2.0. You need at least this version with js-controller 2.0
158
168
  * (Stübi) two face authentication
@@ -184,8 +194,45 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
184
194
  ### 0.1.0 (14.12.2018)
185
195
  * (Stübi) First Version
186
196
 
197
+ ### V3 Rewrite Breaking Changes
198
+ 1. The Device Names got extended by their description (e.g. from `Device 1234567` to `Device 1234567 ("Floodlight Garden")`)
199
+ 2. Snapshot/Livestream Data is now in a respective channel, containing the other data points.
200
+ 3. The snapshot/livestream object got changed from type meta to state with type file.
201
+ 4. Events (Motion, Ding, etc.) are now in a respective channel.
202
+ 5. Due to `ring-api` dropping the support for node before `v16.x` this adapter needs `node v16.x`
203
+
204
+
205
+ ### Scripts in `package.json`
206
+ Several npm scripts are predefined for your convenience. You can run them using `npm run <scriptname>`
207
+ | Script name | Description |
208
+ |-------------|-------------|
209
+ | `build:ts` | Compile the TypeScript sources. |
210
+ | `watch:ts` | Compile the TypeScript sources and watch for changes. |
211
+ | `watch` | Shortcut for `npm run watch:ts` |
212
+ | `test:ts` | Executes the tests you defined in `*.test.ts` files. |
213
+ | `test:package` | Ensures your `package.json` and `io-package.json` are valid. |
214
+ | `test:unit` | Tests the adapter startup with unit tests (fast, but might require module mocks to work). |
215
+ | `test:integration` | Tests the adapter startup with an actual instance of ioBroker. |
216
+ | `test` | Performs a minimal test run on package files and your tests. |
217
+ | `check` | Performs a type-check on your code (without compiling anything). |
218
+ | `coverage` | Generates code coverage using your test files. |
219
+ | `lint` | Runs `ESLint` to check your code for formatting errors and potential bugs. |
220
+ | `release` | Creates a new release, see [`@alcalzone/release-script`](https://github.com/AlCalzone/release-script#usage) for more details. |
221
+
222
+ ### Writing tests
223
+ When done right, testing code is invaluable, because it gives you the
224
+ confidence to change your code while knowing exactly if and when
225
+ something breaks. A good read on the topic of test-driven development
226
+ is https://hackernoon.com/introduction-to-test-driven-development-tdd-61a13bc92d92.
227
+ Although writing tests before the code might seem strange at first, but it has very
228
+ clear upsides.
229
+
230
+ The template provides you with basic tests for the adapter startup and package files.
231
+ It is recommended that you add your own tests into the mix.
232
+
233
+
187
234
  ## License
188
- The MIT License (MIT)
235
+ MIT License
189
236
 
190
237
  Copyright (c) 2022 Thorsten <thorsten@stueben.de> / <https://github.com/schmupu>
191
238
 
@@ -196,13 +243,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
196
243
  copies of the Software, and to permit persons to whom the Software is
197
244
  furnished to do so, subject to the following conditions:
198
245
 
199
- The above copyright notice and this permission notice shall be included in
200
- all copies or substantial portions of the Software.
246
+ The above copyright notice and this permission notice shall be included in all
247
+ copies or substantial portions of the Software.
201
248
 
202
249
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
203
250
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
204
251
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
205
252
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
206
253
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
207
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
208
- THE SOFTWARE.
254
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
255
+ 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
+ }