iobroker.ring 1.2.4-1 → 2.0.0-beta.3
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/.github/workflows/test-and-release.yml +2 -2
- package/LICENSE +1 -1
- package/README.md +26 -14
- package/io-package.json +53 -35
- package/package.json +17 -17
- package/ring.js +104 -68
- package/.commitmessage +0 -4
|
@@ -12,7 +12,7 @@ on:
|
|
|
12
12
|
# pre-releases
|
|
13
13
|
- "v[0-9]+.[0-9]+.[0-9]+-**"
|
|
14
14
|
pull_request: { }
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
jobs:
|
|
17
17
|
# Performs quick checks before the expensive test runs
|
|
18
18
|
check-and-lint:
|
|
@@ -50,7 +50,7 @@ jobs:
|
|
|
50
50
|
runs-on: ${{ matrix.os }}
|
|
51
51
|
strategy:
|
|
52
52
|
matrix:
|
|
53
|
-
node-version: [12.x, 14.x]
|
|
53
|
+
node-version: [12.x, 14.x, 16.x]
|
|
54
54
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
55
55
|
|
|
56
56
|
steps:
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
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
|
package/README.md
CHANGED
|
@@ -67,6 +67,22 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
|
|
|
67
67
|
Placeholder for the next version (at the beginning of the line):
|
|
68
68
|
### __WORK IN PROGRESS__
|
|
69
69
|
-->
|
|
70
|
+
### 2.0.0-beta.3 (2022-02-08)
|
|
71
|
+
* (theimo1221) Fix adapter checker issues
|
|
72
|
+
|
|
73
|
+
### 2.0.0-beta.0 (2022-02-05)
|
|
74
|
+
* (theimo1221) Update packages
|
|
75
|
+
* (theimo1221) Add JS-Controller 4.0 dependency
|
|
76
|
+
* (theimo1221) On ding --> First take snapshot then livestream
|
|
77
|
+
|
|
78
|
+
### 1.2.8 (2021-10-14)
|
|
79
|
+
* (theimo1221) Update packages
|
|
80
|
+
|
|
81
|
+
### 1.2.6 (2021-09-05)
|
|
82
|
+
* (theimo1221) Update packages
|
|
83
|
+
* (theimo1221) Stop adapter on unhandled Error
|
|
84
|
+
* (theimo1221) Terminate adapter on invalid ring credentials
|
|
85
|
+
|
|
70
86
|
### 1.2.4-1 (2021-08-12)
|
|
71
87
|
* (theimo1221) Update packages
|
|
72
88
|
|
|
@@ -92,10 +108,8 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
|
|
|
92
108
|
* (theimo1221) Fix typo preventing Livestream recordings after motion detection
|
|
93
109
|
* (theimo1221) Reduce Levels of Log Messages, to not spam iobroker Log
|
|
94
110
|
|
|
95
|
-
|
|
96
|
-
|
|
97
111
|
### 1.1.6-2 (2021-03-29)
|
|
98
|
-
* (theimo1221) Fixing some Issues while saving snapshots and place Snapshots within 'iobroker-data' Folder.
|
|
112
|
+
* (theimo1221) Fixing some Issues while saving snapshots and place Snapshots within 'iobroker-data' Folder.
|
|
99
113
|
|
|
100
114
|
### 1.1.6-1 (2021-03-26)
|
|
101
115
|
* (theimo1221) Support for Floodlight V2
|
|
@@ -105,16 +119,16 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
|
|
|
105
119
|
* (Stübi) Add floodlight
|
|
106
120
|
|
|
107
121
|
### 1.1.4 (23.05.2020)
|
|
108
|
-
* (Stübi) Add new libraries
|
|
122
|
+
* (Stübi) Add new libraries
|
|
109
123
|
|
|
110
124
|
### 1.1.3 (06.05.2020)
|
|
111
|
-
* (Stübi) Fixed error of missing objects
|
|
125
|
+
* (Stübi) Fixed error of missing objects
|
|
112
126
|
|
|
113
127
|
### 1.1.2 (02.05.2020)
|
|
114
128
|
* (Stübi) Fixed health info like missing battery status (Issue #22, Issue #25)
|
|
115
129
|
* (Stübi) Change error handling
|
|
116
130
|
* (Stübi) Providing Stick Up Cam (BETA)
|
|
117
|
-
* (Stübi) Using variables in the filename of the livestream or snapshot
|
|
131
|
+
* (Stübi) Using variables in the filename of the livestream or snapshot
|
|
118
132
|
|
|
119
133
|
### 1.1.1 (02.05.2020)
|
|
120
134
|
* (Stübi) Bugfixing
|
|
@@ -135,7 +149,7 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
|
|
|
135
149
|
|
|
136
150
|
### 1.0.6 (20.12.2019)
|
|
137
151
|
* (Stübi) Bugfixing: Login with username and password changed
|
|
138
|
-
* (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!
|
|
152
|
+
* (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!
|
|
139
153
|
|
|
140
154
|
### 1.0.5 (18.04.2019)
|
|
141
155
|
* (Stübi) Bugfixing
|
|
@@ -143,18 +157,17 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
|
|
|
143
157
|
* (Stübi) Fixed an error with js-controller 2.0. You need at least this version with js-controller 2.0
|
|
144
158
|
* (Stübi) two face authentication
|
|
145
159
|
|
|
146
|
-
|
|
147
160
|
### 1.0.4 (17.04.2019)
|
|
148
|
-
* (Stübi) Bugfixing for Ring Pro
|
|
161
|
+
* (Stübi) Bugfixing for Ring Pro
|
|
149
162
|
|
|
150
163
|
### 1.0.3 (09.03.2019)
|
|
151
|
-
* (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.
|
|
164
|
+
* (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.
|
|
152
165
|
|
|
153
166
|
### 1.0.2 (01.02.2019)
|
|
154
|
-
* (Stübi) More debug information
|
|
167
|
+
* (Stübi) More debug information
|
|
155
168
|
|
|
156
169
|
### 1.0.1 (05.01.2019)
|
|
157
|
-
* (Stübi) Support js-controller compact mode
|
|
170
|
+
* (Stübi) Support js-controller compact mode
|
|
158
171
|
|
|
159
172
|
### 1.0.0 (04.01.2018)
|
|
160
173
|
* (Stübi) Add camera device. For this reason, the device name changed from doorbot to doorbell.
|
|
@@ -171,11 +184,10 @@ on({id: "ring.0.doorbell_4711.kind"/*Kind*/}, (obj) => {
|
|
|
171
184
|
### 0.1.0 (14.12.2018)
|
|
172
185
|
* (Stübi) First Version
|
|
173
186
|
|
|
174
|
-
|
|
175
187
|
## License
|
|
176
188
|
The MIT License (MIT)
|
|
177
189
|
|
|
178
|
-
Copyright (c)
|
|
190
|
+
Copyright (c) 2022 Thorsten <thorsten@stueben.de> / <https://github.com/schmupu>
|
|
179
191
|
|
|
180
192
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
181
193
|
of this software and associated documentation files (the "Software"), to deal
|
package/io-package.json
CHANGED
|
@@ -1,9 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "ring",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-beta.3",
|
|
5
5
|
"title": "Ring",
|
|
6
6
|
"news": {
|
|
7
|
+
"2.0.0-beta.2": {
|
|
8
|
+
"en": "Fix adapter checker issues"
|
|
9
|
+
},
|
|
10
|
+
"2.0.0-beta.0": {
|
|
11
|
+
"en": "Update package\nAdd JS-Controller 4.0 dependency\nOn ding --> First take snapshot then livestream"
|
|
12
|
+
},
|
|
13
|
+
"1.2.8": {
|
|
14
|
+
"en": "Update package"
|
|
15
|
+
},
|
|
16
|
+
"1.2.6": {
|
|
17
|
+
"en": "Update packages\nStop adapter on unhandled Error\nTerminate adapter on invalid ring credentials",
|
|
18
|
+
"de": "Pakete aktualisieren\nAdapter bei unbehandeltem Fehler stoppen\nAdapter bei ungültigen Ringanmeldeinformationen beenden",
|
|
19
|
+
"ru": "Пакеты обновлений\nОстановить адаптер при необработанной ошибке\nЗавершить адаптер при неверных учетных данных кольца",
|
|
20
|
+
"pt": "Pacotes de atualização\nPare o adaptador em erro não tratado\nEncerrar o adaptador com credenciais de anel inválidas",
|
|
21
|
+
"nl": "Pakketten bijwerken\nStop adapter bij onverwerkte fout\nBeëindig adapter op ongeldige ringreferenties",
|
|
22
|
+
"fr": "Mettre à jour les packages\nArrêter l'adaptateur en cas d'erreur non gérée\nMettre fin à l'adaptateur sur des informations d'identification de sonnerie non valides",
|
|
23
|
+
"it": "Aggiorna pacchetti\nArresta l'adattatore in caso di errore non gestito\nTermina l'adattatore con credenziali di anello non valide",
|
|
24
|
+
"es": "Actualizar paquetes\nDetener el adaptador en caso de error no manejado\nTerminar adaptador en credenciales de anillo no válidas",
|
|
25
|
+
"pl": "Zaktualizuj pakiety\nZatrzymaj adapter przy nieobsługiwanym błędzie\nZakończ kartę z nieprawidłowymi danymi uwierzytelniającymi dzwonek",
|
|
26
|
+
"zh-cn": "更新包\n在未处理的错误上停止适配器\n在无效的环凭据上终止适配器"
|
|
27
|
+
},
|
|
28
|
+
"1.2.5": {
|
|
29
|
+
"en": "Update packages\nStop adapter on unhandled Error\nTerminate adapter on invalid ring credentials",
|
|
30
|
+
"de": "Pakete aktualisieren\nAdapter bei unbehandeltem Fehler stoppen\nAdapter bei ungültigen Ringanmeldeinformationen beenden",
|
|
31
|
+
"ru": "Пакеты обновлений\nОстановить адаптер при необработанной ошибке\nЗавершить адаптер при неверных учетных данных кольца",
|
|
32
|
+
"pt": "Pacotes de atualização\nPare o adaptador em erro não tratado\nEncerrar o adaptador com credenciais de anel inválidas",
|
|
33
|
+
"nl": "Pakketten bijwerken\nStop adapter bij onverwerkte fout\nBeëindig adapter op ongeldige ringreferenties",
|
|
34
|
+
"fr": "Mettre à jour les packages\nArrêter l'adaptateur en cas d'erreur non gérée\nMettre fin à l'adaptateur sur des informations d'identification de sonnerie non valides",
|
|
35
|
+
"it": "Aggiorna pacchetti\nArresta l'adattatore in caso di errore non gestito\nTermina l'adattatore con credenziali di anello non valide",
|
|
36
|
+
"es": "Actualizar paquetes\nDetener el adaptador en caso de error no manejado\nTerminar adaptador en credenciales de anillo no válidas",
|
|
37
|
+
"pl": "Zaktualizuj pakiety\nZatrzymaj adapter przy nieobsługiwanym błędzie\nZakończ kartę z nieprawidłowymi danymi uwierzytelniającymi dzwonek",
|
|
38
|
+
"zh-cn": "更新包\n在未处理的错误上停止适配器\n在无效的环凭据上终止适配器"
|
|
39
|
+
},
|
|
40
|
+
"1.2.4": {
|
|
41
|
+
"en": "Update packages\nStop adapter on unhandled Error\nTerminate adapter on invalid refresh token",
|
|
42
|
+
"de": "Pakete aktualisieren\nAdapter bei unbehandeltem Fehler stoppen\nAdapter bei ungültigem Aktualisierungstoken beenden",
|
|
43
|
+
"ru": "Пакеты обновлений\nОстановить адаптер при необработанной ошибке\nЗавершить адаптер при недопустимом токене обновления",
|
|
44
|
+
"pt": "Pacotes de atualização\nPare o adaptador em erro não tratado\nEncerrar adaptador em token de atualização inválido",
|
|
45
|
+
"nl": "Pakketten bijwerken\nStop adapter bij onverwerkte fout\nBeëindig adapter op ongeldige vernieuwingstoken",
|
|
46
|
+
"fr": "Mettre à jour les packages\nArrêter l'adaptateur en cas d'erreur non gérée\nMettre fin à l'adaptateur sur un jeton d'actualisation non valide",
|
|
47
|
+
"it": "Aggiorna pacchetti\nArresta l'adattatore in caso di errore non gestito\nTermina adattatore su token di aggiornamento non valido",
|
|
48
|
+
"es": "Actualizar paquetes\nDetener el adaptador en caso de error no manejado\nTerminar adaptador en token de actualización no válido",
|
|
49
|
+
"pl": "Zaktualizuj pakiety\nZatrzymaj adapter przy nieobsługiwanym błędzie\nZakończ adapter przy nieprawidłowym tokenie odświeżania",
|
|
50
|
+
"zh-cn": "更新包\n在未处理的错误上停止适配器\n在无效的刷新令牌上终止适配器"
|
|
51
|
+
},
|
|
7
52
|
"1.2.4-1": {
|
|
8
53
|
"en": "Update packages",
|
|
9
54
|
"de": "Pakete aktualisieren",
|
|
@@ -171,38 +216,6 @@
|
|
|
171
216
|
"es": "Registro de centinela",
|
|
172
217
|
"pl": "Rejestrowanie wartowników",
|
|
173
218
|
"zh-cn": "哨兵记录"
|
|
174
|
-
},
|
|
175
|
-
"1.1.0": {
|
|
176
|
-
"en": "New features, Improvements and bug fixing",
|
|
177
|
-
"de": "Neue Funktionen, Verbesserungen und Fehlerbehebung",
|
|
178
|
-
"ru": "Новые функции, улучшения и исправление ошибок",
|
|
179
|
-
"pt": "Novos recursos, melhorias e correção de erros",
|
|
180
|
-
"nl": "Nieuwe functies, verbeteringen en bugfixing",
|
|
181
|
-
"fr": "Nouvelles fonctionnalités, améliorations et correction de bugs",
|
|
182
|
-
"it": "Nuove funzionalità, miglioramenti e correzione dei bug",
|
|
183
|
-
"es": "Nuevas características, mejoras y corrección de errores.",
|
|
184
|
-
"pl": "Nowe funkcje, ulepszenia i naprawa błędów",
|
|
185
|
-
"zh-cn": "新功能,改进和错误修复"
|
|
186
|
-
},
|
|
187
|
-
"1.0.7": {
|
|
188
|
-
"en": "New API",
|
|
189
|
-
"de": "Neue API"
|
|
190
|
-
},
|
|
191
|
-
"1.0.6": {
|
|
192
|
-
"en": "Bugfixing",
|
|
193
|
-
"de": "Fehlerbehebung"
|
|
194
|
-
},
|
|
195
|
-
"1.0.5": {
|
|
196
|
-
"en": "Bugfixing",
|
|
197
|
-
"de": "Fehlerbehebung"
|
|
198
|
-
},
|
|
199
|
-
"1.0.4": {
|
|
200
|
-
"en": "Bugfixing for Ring Pro",
|
|
201
|
-
"de": "Fehlerbehebung Ring Pro"
|
|
202
|
-
},
|
|
203
|
-
"1.0.3": {
|
|
204
|
-
"en": "Changing ring API. Old one did not work anymore",
|
|
205
|
-
"de": "Wechsel der ring.com API"
|
|
206
219
|
}
|
|
207
220
|
},
|
|
208
221
|
"titleLang": {
|
|
@@ -257,7 +270,12 @@
|
|
|
257
270
|
"dsn": "https://345fa9990a0e4e4d95297341d0d0ee9a@sentry.iobroker.net/61",
|
|
258
271
|
"pathWhitelist": []
|
|
259
272
|
}
|
|
260
|
-
}
|
|
273
|
+
},
|
|
274
|
+
"dependencies": [
|
|
275
|
+
{
|
|
276
|
+
"js-controller": ">=4.0.0"
|
|
277
|
+
}
|
|
278
|
+
]
|
|
261
279
|
},
|
|
262
280
|
"native": {
|
|
263
281
|
"email": "email@test.foo",
|
|
@@ -286,4 +304,4 @@
|
|
|
286
304
|
"native": {}
|
|
287
305
|
}
|
|
288
306
|
]
|
|
289
|
-
}
|
|
307
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.ring",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"description": "Ring",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Thorsten Stueben",
|
|
@@ -31,27 +31,27 @@
|
|
|
31
31
|
"@iobroker/adapter-core": "^2.5.1",
|
|
32
32
|
"esm": "^3.2.25",
|
|
33
33
|
"events": "^3.3.0",
|
|
34
|
-
"express": "^4.17.
|
|
35
|
-
"node-schedule": "^2.
|
|
34
|
+
"express": "^4.17.2",
|
|
35
|
+
"node-schedule": "^2.1.0",
|
|
36
36
|
"request": "^2.88.2",
|
|
37
|
-
"ring-client-api": "^9.
|
|
37
|
+
"ring-client-api": "^9.24.0",
|
|
38
38
|
"rtsp-streaming-server": "^2.0.6",
|
|
39
|
-
"rxjs": "^7.
|
|
39
|
+
"rxjs": "^7.5.2",
|
|
40
40
|
"semver": "^7.3.5",
|
|
41
|
-
"
|
|
41
|
+
"stun": "^2.1.0",
|
|
42
|
+
"utf-8-validate": "^5.0.8",
|
|
42
43
|
"xml2js": "~0.4.23",
|
|
43
|
-
"xmlbuilder": "^15.1.1"
|
|
44
|
-
"stun": "^2.1.0"
|
|
44
|
+
"xmlbuilder": "^15.1.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@alcalzone/release-script": "^
|
|
48
|
-
"@iobroker/testing": "^2.
|
|
49
|
-
"axios": "^0.
|
|
50
|
-
"chai": "^4.3.
|
|
51
|
-
"eslint": "^
|
|
52
|
-
"eslint-plugin-react": "^7.
|
|
47
|
+
"@alcalzone/release-script": "^3.5.2",
|
|
48
|
+
"@iobroker/testing": "^2.5.4",
|
|
49
|
+
"axios": "^0.25.0",
|
|
50
|
+
"chai": "^4.3.6",
|
|
51
|
+
"eslint": "^8.8.0",
|
|
52
|
+
"eslint-plugin-react": "^7.28.0",
|
|
53
53
|
"gulp": "^4.0.2",
|
|
54
|
-
"mocha": "^9.0
|
|
54
|
+
"mocha": "^9.2.0"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=12.0.0"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
|
-
"test:js": "mocha --recursive \"{!(node_modules
|
|
66
|
+
"test:js": "mocha --recursive \"{!(node_modules)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
|
|
67
67
|
"test:package": "mocha test/package --exit",
|
|
68
68
|
"test:unit": "mocha test/unit --exit",
|
|
69
69
|
"test:integration": "mocha test/integration --exit",
|
|
@@ -77,4 +77,4 @@
|
|
|
77
77
|
"url": "https://github.com/iobroker-community-adapters/ioBroker.ring/issues"
|
|
78
78
|
},
|
|
79
79
|
"readmeFilename": "README.md"
|
|
80
|
-
}
|
|
80
|
+
}
|
package/ring.js
CHANGED
|
@@ -335,7 +335,7 @@ async function setLight(ring, id, deviceData, init) {
|
|
|
335
335
|
try {
|
|
336
336
|
await ring.setLight(id, controlVal);
|
|
337
337
|
} catch (error) {
|
|
338
|
-
adapter.log.error(error);
|
|
338
|
+
adapter.log.error(`Error within light_switch Call: ${error}`);
|
|
339
339
|
}
|
|
340
340
|
};
|
|
341
341
|
}
|
|
@@ -363,7 +363,7 @@ async function processSnapshotInfo(info, channelId, snapshot, deviceId, vis, rin
|
|
|
363
363
|
let type = 'state';
|
|
364
364
|
switch (i) {
|
|
365
365
|
case 'jpg':
|
|
366
|
-
if (snapshot) await adapter.
|
|
366
|
+
if (snapshot) await adapter.setForeignBinaryStateAsync(stateId, snapshot.image);
|
|
367
367
|
break;
|
|
368
368
|
case 'snapshot':
|
|
369
369
|
type = 'meta';
|
|
@@ -393,7 +393,7 @@ async function processSnapshotInfo(info, channelId, snapshot, deviceId, vis, rin
|
|
|
393
393
|
try {
|
|
394
394
|
await setSnapshot(ring, id);
|
|
395
395
|
} catch (error) {
|
|
396
|
-
adapter.log.error(error);
|
|
396
|
+
adapter.log.error(`Error within snapshotrequest: ${error}`);
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
};
|
|
@@ -423,7 +423,11 @@ async function setSnapshot(ring, id, init) {
|
|
|
423
423
|
let deviceId = kind + '_' + id;
|
|
424
424
|
let channelId = deviceId;
|
|
425
425
|
let file = path.join(adapter.config.path, adapter.config.filename_snapshot);
|
|
426
|
-
let snapshot
|
|
426
|
+
let snapshot;
|
|
427
|
+
if(!init) {
|
|
428
|
+
adapter.log.silly(`Starting Snapshot request for: ${id} to ${file}`);
|
|
429
|
+
snapshot = await ring.getSnapshot(id, file);
|
|
430
|
+
}
|
|
427
431
|
if (!init && !snapshot) return;
|
|
428
432
|
let info = datapoints.getObjectByName('snapshot');
|
|
429
433
|
let vis;
|
|
@@ -435,11 +439,12 @@ async function setSnapshot(ring, id, init) {
|
|
|
435
439
|
},
|
|
436
440
|
native: {}
|
|
437
441
|
}, ['name']);
|
|
442
|
+
adapter.log.silly(`Processing Snapshot info for: ${id} at ${file}`);
|
|
438
443
|
await processSnapshotInfo(info, channelId, snapshot, deviceId, vis, ring, id);
|
|
439
444
|
objectHelper.processObjectQueue(() => {
|
|
440
445
|
});
|
|
441
446
|
} catch (error) {
|
|
442
|
-
throw new Error('Error
|
|
447
|
+
throw new Error('Error setSnapshot()): ' + error);
|
|
443
448
|
}
|
|
444
449
|
}
|
|
445
450
|
|
|
@@ -460,8 +465,65 @@ async function updateCurrentFile(file, stateId, deviceId, value, deleteOldSettin
|
|
|
460
465
|
return value;
|
|
461
466
|
}
|
|
462
467
|
|
|
468
|
+
async function processLivestreamInfo(info, channelId, livestream, deviceId, vis, ring, id) {
|
|
469
|
+
for (let i in info) {
|
|
470
|
+
let controlFunction;
|
|
471
|
+
let value = null;
|
|
472
|
+
let stateId = channelId + '.' + i;
|
|
473
|
+
let common = info[i];
|
|
474
|
+
let type = 'state';
|
|
475
|
+
switch (i) {
|
|
476
|
+
case 'mp4':
|
|
477
|
+
if (livestream) await adapter.setForeignBinaryStateAsync(stateId, livestream.video);
|
|
478
|
+
break;
|
|
479
|
+
case 'livestream':
|
|
480
|
+
type = 'meta';
|
|
481
|
+
// http://<ip-iobroker>:<port-vis>/<ring-instanz>/<device>.livestream/livestream.jpg
|
|
482
|
+
// http://192.168.1.10:8082/ring.0/doorbell_4711.livestream/livestream.jpg
|
|
483
|
+
if (livestream) {
|
|
484
|
+
const path = `${deviceId}/${livestream.filename}`;
|
|
485
|
+
adapter.log.debug(`Write Livestream to: ${path}`);
|
|
486
|
+
await adapter.writeFile(adapter.namespace, path, livestream.video);
|
|
487
|
+
}
|
|
488
|
+
break;
|
|
489
|
+
case 'livestream_url':
|
|
490
|
+
vis = await adapter.getForeignObjectAsync('system.adapter.web.0');
|
|
491
|
+
if (vis && vis.native && vis.native) {
|
|
492
|
+
let secure = vis.native.secure ? 'https' : 'http';
|
|
493
|
+
if (livestream) {
|
|
494
|
+
value = `${secure}://${adapter.host}:${vis.native.port}/${adapter.namespace}/${deviceId}/${livestream.filename}`;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
break;
|
|
498
|
+
case 'livestream_file':
|
|
499
|
+
value = await updateCurrentFile(livestream, stateId, deviceId, value, adapter.config.del_old_livestream);
|
|
500
|
+
break;
|
|
501
|
+
case 'livestreamrequest':
|
|
502
|
+
controlFunction = async (value) => {
|
|
503
|
+
if (value == true) {
|
|
504
|
+
try {
|
|
505
|
+
await setLivetream(ring, id);
|
|
506
|
+
} catch (error) {
|
|
507
|
+
adapter.log.error(`Error within livestreamrequest: ${error}`);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
break;
|
|
512
|
+
default:
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
if (!states.hasOwnProperty(stateId) || states[stateId] !== value) {
|
|
516
|
+
objectHelper.setOrUpdateObject(stateId, {
|
|
517
|
+
type: type,
|
|
518
|
+
common: common
|
|
519
|
+
}, ['name'], value, controlFunction);
|
|
520
|
+
}
|
|
521
|
+
states[stateId] = value;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
463
525
|
/**
|
|
464
|
-
* make
|
|
526
|
+
* make livestream
|
|
465
527
|
* @param {*} ring
|
|
466
528
|
* @param {*} id
|
|
467
529
|
* @param {*} image
|
|
@@ -473,7 +535,11 @@ async function setLivetream(ring, id, init) {
|
|
|
473
535
|
let channelId = deviceId;
|
|
474
536
|
// if(!init) await ring.getLiveStreamSIP(id);
|
|
475
537
|
let file = path.join(adapter.config.path, adapter.config.filename_livestream);
|
|
476
|
-
let livestream
|
|
538
|
+
let livestream;
|
|
539
|
+
if(!init) {
|
|
540
|
+
adapter.log.silly(`Starting Livestream request for: ${id} to ${file}`);
|
|
541
|
+
livestream = await ring.getLiveStream(id, file);
|
|
542
|
+
}
|
|
477
543
|
if (!init && !livestream) return;
|
|
478
544
|
let info = datapoints.getObjectByName('livestream');
|
|
479
545
|
let vis;
|
|
@@ -485,60 +551,8 @@ async function setLivetream(ring, id, init) {
|
|
|
485
551
|
},
|
|
486
552
|
native: {}
|
|
487
553
|
}, ['name']);
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
let value = null;
|
|
491
|
-
let stateId = channelId + '.' + i;
|
|
492
|
-
let common = info[i];
|
|
493
|
-
let type = 'state';
|
|
494
|
-
switch (i) {
|
|
495
|
-
case 'mp4':
|
|
496
|
-
if (livestream) await adapter.setBinaryStateAsync(stateId, livestream.video);
|
|
497
|
-
break;
|
|
498
|
-
case 'livestream':
|
|
499
|
-
type = 'meta';
|
|
500
|
-
// http://<ip-iobroker>:<port-vis>/<ring-instanz>/<device>.livestream/livestream.jpg
|
|
501
|
-
// http://192.168.1.10:8082/ring.0/doorbell_4711.livestream/livestream.jpg
|
|
502
|
-
if (livestream) {
|
|
503
|
-
const path = `${deviceId}/${livestream.filename}`;
|
|
504
|
-
adapter.log.debug(`Write Livestream to: ${path}`);
|
|
505
|
-
await adapter.writeFile(adapter.namespace, path, livestream.video);
|
|
506
|
-
}
|
|
507
|
-
break;
|
|
508
|
-
case 'livestream_url':
|
|
509
|
-
vis = await adapter.getForeignObjectAsync('system.adapter.web.0');
|
|
510
|
-
if (vis && vis.native && vis.native) {
|
|
511
|
-
let secure = vis.native.secure ? 'https' : 'http';
|
|
512
|
-
if (livestream) {
|
|
513
|
-
value = `${secure}://${adapter.host}:${vis.native.port}/${adapter.namespace}/${deviceId}/${livestream.filename}`;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
break;
|
|
517
|
-
case 'livestream_file':
|
|
518
|
-
value = await updateCurrentFile(livestream, stateId, deviceId, value, adapter.config.del_old_livestream);
|
|
519
|
-
break;
|
|
520
|
-
case 'livestreamrequest':
|
|
521
|
-
controlFunction = async (value) => {
|
|
522
|
-
if (value == true) {
|
|
523
|
-
try {
|
|
524
|
-
await setLivetream(ring, id);
|
|
525
|
-
} catch (error) {
|
|
526
|
-
adapter.log.error(error);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
};
|
|
530
|
-
break;
|
|
531
|
-
default:
|
|
532
|
-
break;
|
|
533
|
-
}
|
|
534
|
-
if (!states.hasOwnProperty(stateId) || states[stateId] !== value) {
|
|
535
|
-
objectHelper.setOrUpdateObject(stateId, {
|
|
536
|
-
type: type,
|
|
537
|
-
common: common
|
|
538
|
-
}, ['name'], value, controlFunction);
|
|
539
|
-
}
|
|
540
|
-
states[stateId] = value;
|
|
541
|
-
}
|
|
554
|
+
adapter.log.silly(`Processing Livestream info for: ${id} at ${file}`);
|
|
555
|
+
await processLivestreamInfo(info, channelId, livestream, deviceId, vis, ring, id);
|
|
542
556
|
objectHelper.processObjectQueue(() => {
|
|
543
557
|
});
|
|
544
558
|
} catch (error) {
|
|
@@ -585,7 +599,7 @@ async function setDingDong(ring, id, ding) {
|
|
|
585
599
|
try {
|
|
586
600
|
await ring.setLight(ring, id, value);
|
|
587
601
|
} catch (error) {
|
|
588
|
-
adapter.log.error(error);
|
|
602
|
+
adapter.log.error(`Error within setDingDong: ${error}`);
|
|
589
603
|
}
|
|
590
604
|
}
|
|
591
605
|
};
|
|
@@ -710,8 +724,10 @@ async function startDevice(id, dbids, j) {
|
|
|
710
724
|
adapter.log.silly('Ding Dong for Id ' + id + JSON.stringify(ding));
|
|
711
725
|
executeImmediateGuarded(async () => {await setDingDong(ring, id, ding);}, this);
|
|
712
726
|
if (ding.kind != 'on_demand') {
|
|
713
|
-
executeImmediateGuarded(async () => {
|
|
714
|
-
|
|
727
|
+
executeImmediateGuarded(async () => {
|
|
728
|
+
await setSnapshot(ring, id);
|
|
729
|
+
await setLivetream(ring, id);
|
|
730
|
+
}, this);
|
|
715
731
|
}
|
|
716
732
|
});
|
|
717
733
|
await ring.eventOnSnapshot(id, async (data) => {
|
|
@@ -749,12 +765,29 @@ async function ringer() {
|
|
|
749
765
|
dbids = await ring.getAllRingsDevices();
|
|
750
766
|
errorcounter = 0;
|
|
751
767
|
} catch (error) {
|
|
768
|
+
const isRefreshTokenError = error.message.indexOf('Refresh token is not valid') >= 0;
|
|
769
|
+
const isoAuthError = error.message.indexOf('Failed to fetch oauth token from Ring') >= 0;
|
|
770
|
+
if(isRefreshTokenError || isoAuthError) {
|
|
771
|
+
if(isRefreshTokenError) {
|
|
772
|
+
adapter.log.error(
|
|
773
|
+
`Invalid Refresh token detected. Please check and/or create a fresh one following "https://github.com/dgreif/ring/wiki/Refresh-Tokens"`
|
|
774
|
+
);
|
|
775
|
+
} else if (isoAuthError) {
|
|
776
|
+
adapter.log.error(
|
|
777
|
+
`Invalid Login information, additionally please use a refresh token instead. Please create a fresh one following "https://github.com/dgreif/ring/wiki/Refresh-Tokens"`
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
adapter.stop();
|
|
781
|
+
adapter.disable();
|
|
782
|
+
adapter.terminate('Invalid Ring Login information', 11);
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
752
785
|
// if, error we will get a new ring connection
|
|
753
786
|
errorcounter++;
|
|
754
787
|
ringdevices = {};
|
|
755
788
|
states = {};
|
|
756
789
|
ring = null; // we start from beginning
|
|
757
|
-
adapter.log.error(error);
|
|
790
|
+
adapter.log.error(`Error within Ringer: ${error}`);
|
|
758
791
|
if (errorcounter >= errorcountmax) {
|
|
759
792
|
adapter.log.error('To many connection errors, restarting adapter');
|
|
760
793
|
restartAdapter();
|
|
@@ -813,7 +846,7 @@ function executeImmediateGuarded(f, thisContext) {
|
|
|
813
846
|
try {
|
|
814
847
|
await f.bind(thisContext)();
|
|
815
848
|
} catch (error) {
|
|
816
|
-
adapter.log.error(error);
|
|
849
|
+
adapter.log.error(`executeImmediateGuarded resulted in Error: ${error}`);
|
|
817
850
|
}
|
|
818
851
|
});
|
|
819
852
|
}
|
|
@@ -847,8 +880,11 @@ async function main() {
|
|
|
847
880
|
}
|
|
848
881
|
await poll_ringer();
|
|
849
882
|
} catch (error) {
|
|
850
|
-
adapter.log.error(
|
|
851
|
-
|
|
883
|
+
adapter.log.error(
|
|
884
|
+
`Could not start the Adapter ${adapter.namespace} in version ${adapter.version} because of ${error.message}:\n${
|
|
885
|
+
error.stackTrace}`
|
|
886
|
+
);
|
|
887
|
+
adapter.stop();
|
|
852
888
|
}
|
|
853
889
|
}
|
|
854
890
|
|
package/.commitmessage
DELETED