iobroker.ring 2.0.0-beta.3 → 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 +5 -5
- package/README.md +88 -33
- package/admin/admin.d.ts +93 -0
- package/admin/index_m.html +124 -207
- package/admin/style.css +32 -0
- package/admin/words.js +189 -208
- package/build/lib/constants.js +261 -0
- package/build/lib/constants.js.map +1 -0
- package/build/lib/lastAction.js +11 -0
- package/build/lib/lastAction.js.map +1 -0
- package/build/lib/ownRingDevice.js +459 -0
- package/build/lib/ownRingDevice.js.map +10 -0
- package/build/lib/ringApiClient.js +114 -0
- package/build/lib/ringApiClient.js.map +10 -0
- package/build/lib/services/file-service.js +118 -0
- package/build/lib/services/file-service.js.map +10 -0
- package/build/lib/tools.js +99 -0
- package/build/lib/tools.js.map +1 -0
- package/build/main.js +256 -0
- package/build/main.js.map +1 -0
- package/io-package.json +177 -240
- package/package.json +70 -40
- package/.eslintignore +0 -5
- package/.eslintrc.js +0 -39
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -33
- package/.github/dependabot.yml +0 -8
- package/.github/tsconfig.check.json +0 -15
- package/.github/tsconfig.json +0 -39
- package/.github/workflows/test-and-release.yml +0 -143
- package/.github/workflows/test-only.yml +0 -75
- package/docs/ring_admin_tab1.png +0 -0
- package/docs/ring_admin_tab2.png +0 -0
- package/docs/ring_objects.png +0 -0
- package/lib/datapoints.js +0 -344
- package/lib/ringapiclient.js +0 -436
- package/ring.js +0 -899
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
[](https://nodei.co/npm/iobroker.ring/)
|
|
11
11
|
|
|
12
|
-
Requires
|
|
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
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-

|
|
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,46 @@ 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
|
-
|
|
48
|
+
## Changelog
|
|
49
49
|
|
|
50
|
-
|
|
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
|
-
|
|
56
|
+
* (theimo1221) Add `lpd_v4` Doorbell
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
### 3.0.0-beta.9 (2022-05-21)
|
|
55
59
|
|
|
56
|
-
|
|
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
|
-
|
|
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
|
|
65
87
|
|
|
66
|
-
<!--
|
|
67
|
-
Placeholder for the next version (at the beginning of the line):
|
|
68
|
-
### __WORK IN PROGRESS__
|
|
69
|
-
-->
|
|
70
88
|
### 2.0.0-beta.3 (2022-02-08)
|
|
71
89
|
* (theimo1221) Fix adapter checker issues
|
|
72
90
|
|
|
@@ -125,7 +143,7 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
|
|
|
125
143
|
* (Stübi) Fixed error of missing objects
|
|
126
144
|
|
|
127
145
|
### 1.1.2 (02.05.2020)
|
|
128
|
-
* (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)
|
|
129
147
|
* (Stübi) Change error handling
|
|
130
148
|
* (Stübi) Providing Stick Up Cam (BETA)
|
|
131
149
|
* (Stübi) Using variables in the filename of the livestream or snapshot
|
|
@@ -136,12 +154,12 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
|
|
|
136
154
|
|
|
137
155
|
### 1.1.0 (01.05.2020)
|
|
138
156
|
* (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
|
|
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
|
|
140
158
|
* (Stübi) Snapshot link will be shown as https or http in state (Issue #18)
|
|
141
159
|
* (Stübi) Livestream link added and a request button added to get new livestream
|
|
142
160
|
* (Stübi) Old snapshots and livestreams can be deleted on the filesystem
|
|
143
161
|
* (Stübi) Sentry logging added
|
|
144
|
-
* (Stübi) Small improvements and bugfixing
|
|
162
|
+
* (Stübi) Small improvements and bugfixing
|
|
145
163
|
* (Stübi) Add a Two-Factor Auth (2fa) description (Issue #14, Issue #13, Issue #19)
|
|
146
164
|
|
|
147
165
|
### 1.0.7 (24.12.2019)
|
|
@@ -152,7 +170,7 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
|
|
|
152
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!
|
|
153
171
|
|
|
154
172
|
### 1.0.5 (18.04.2019)
|
|
155
|
-
* (Stübi) Bugfixing
|
|
173
|
+
* (Stübi) Bugfixing
|
|
156
174
|
* (Stübi) Using new API. With this API livestreaming and snapshots are possible (work still in progress and not supported in this version)
|
|
157
175
|
* (Stübi) Fixed an error with js-controller 2.0. You need at least this version with js-controller 2.0
|
|
158
176
|
* (Stübi) two face authentication
|
|
@@ -184,8 +202,45 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
|
|
|
184
202
|
### 0.1.0 (14.12.2018)
|
|
185
203
|
* (Stübi) First Version
|
|
186
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
|
+
|
|
187
242
|
## License
|
|
188
|
-
|
|
243
|
+
MIT License
|
|
189
244
|
|
|
190
245
|
Copyright (c) 2022 Thorsten <thorsten@stueben.de> / <https://github.com/schmupu>
|
|
191
246
|
|
|
@@ -196,13 +251,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
196
251
|
copies of the Software, and to permit persons to whom the Software is
|
|
197
252
|
furnished to do so, subject to the following conditions:
|
|
198
253
|
|
|
199
|
-
The above copyright notice and this permission notice shall be included in
|
|
200
|
-
|
|
254
|
+
The above copyright notice and this permission notice shall be included in all
|
|
255
|
+
copies or substantial portions of the Software.
|
|
201
256
|
|
|
202
257
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
203
258
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
204
259
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
205
260
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
206
261
|
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
|
-
|
|
262
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
263
|
+
SOFTWARE.
|
package/admin/admin.d.ts
ADDED
|
@@ -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
|
+
}
|