iobroker.ring 3.2.2 → 3.2.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/README.md +5 -0
- package/build/lib/constants.js +17 -1
- package/build/lib/constants.js.map +1 -1
- package/build/lib/ownRingCamera.js +433 -0
- package/build/lib/ownRingCamera.js.map +1 -0
- package/build/lib/ownRingDevice.js +25 -440
- package/build/lib/ownRingDevice.js.map +1 -1
- package/build/lib/ownRingIntercom.js +98 -0
- package/build/lib/ownRingIntercom.js.map +1 -0
- package/build/lib/ringApiClient.js +29 -11
- package/build/lib/ringApiClient.js.map +1 -1
- package/io-package.json +14 -14
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -119,6 +119,11 @@ It is recommended that you add your own tests into the mix.
|
|
|
119
119
|
Placeholder for the next version (at the beginning of the line):
|
|
120
120
|
### **WORK IN PROGRESS**
|
|
121
121
|
-->
|
|
122
|
+
### 3.2.3 (2022-12-15)
|
|
123
|
+
|
|
124
|
+
* (theimo1221) Update Packages
|
|
125
|
+
* (theimo1221) #385 Experimental Ring Intercom support
|
|
126
|
+
|
|
122
127
|
### 3.2.2 (2022-12-02)
|
|
123
128
|
|
|
124
129
|
* (theimo1221) #373 Fix event receiving for iobroker instances without unique hostname
|
package/build/lib/constants.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.STATE_ID_LIVESTREAM_REQUEST = exports.STATE_ID_SNAPSHOT_REQUEST = exports.STATE_ID_LIGHT_SWITCH = exports.CHANNEL_NAME_EVENTS = exports.CHANNEL_NAME_LIVESTREAM = exports.CHANNEL_NAME_SNAPSHOT = exports.CHANNEL_NAME_LIGHT = exports.CHANNEL_NAME_HISTORY = exports.CHANNEL_NAME_INFO = exports.COMMON_LOCATIONMODE = exports.COMMON_OLD_TOKEN = exports.COMMON_NEW_TOKEN = exports.COMMON_INTERCOM_UNLOCK_REQUEST = exports.COMMON_DEBUG_REQUEST = exports.COMMON_EVENTS_MOMENT = exports.COMMON_EVENTS_MESSAGE = exports.COMMON_EVENTS_DETECTIONTYPE = exports.COMMON_EVENTS_TYPE = exports.COMMON_EVENTS_INTERCOM_DING = exports.COMMON_EVENTS_DOORBELL = exports.COMMON_MOTION = exports.COMMON_LIVESTREAM_FILE = exports.COMMON_LIVESTREAM_URL = exports.COMMON_LIVESTREAM_REQUEST = exports.COMMON_LIVESTREAM_MOMENT = exports.COMMON_LIVESTREAM_LIVESTREAM = exports.COMMON_SNAPSHOT_MOMENT = exports.COMMON_SNAPSHOT_SNAPSHOT = exports.COMMON_SNAPSHOT_REQUEST = exports.COMMON_SNAPSHOT_FILE = exports.COMMON_SNAPSHOT_URL = exports.COMMON_HISTORY_KIND = exports.COMMON_HISTORY_CREATED_AT = exports.COMMON_HISTORY_URL = exports.COMMON_LIGHT_STATE = exports.COMMON_LIGHT_SWITCH = exports.COMMON_INFO_HAS_SIREN = exports.COMMON_INFO_HAS_BATTERY = exports.COMMON_INFO_HAS_LIGHT = exports.COMMON_INFO_FIRMWARE = exports.COMMON_INFO_LATEST_SIGNAL_CATEGORY = exports.COMMON_INFO_LATEST_SIGNAL_STRENGTH = exports.COMMON_INFO_WIFI_NAME = exports.COMMON_INFO_BATTERY_PERCENTAGE_CATEGORY = exports.COMMON_INFO_BATTERY_PERCENTAGE = exports.COMMON_INFO_KIND = exports.COMMON_INFO_EXTERNAL_CONNECTION = exports.COMMON_INFO_DESCRIPTION = exports.COMMON_INFO_ID = exports.LOCATION_MODE_OPTIONS = void 0;
|
|
4
|
+
exports.STATE_ID_LOCATIONMODE = exports.STATE_ID_INTERCOM_UNLOCK = exports.STATE_ID_DEBUG_REQUEST = void 0;
|
|
4
5
|
exports.LOCATION_MODE_OPTIONS = ["home", "away", "disarmed", "disabled", "unset"];
|
|
5
6
|
exports.COMMON_INFO_ID = {
|
|
6
7
|
type: "string",
|
|
@@ -214,6 +215,13 @@ exports.COMMON_EVENTS_DOORBELL = {
|
|
|
214
215
|
read: true,
|
|
215
216
|
write: false
|
|
216
217
|
};
|
|
218
|
+
exports.COMMON_EVENTS_INTERCOM_DING = {
|
|
219
|
+
type: "boolean",
|
|
220
|
+
role: "sensor.door",
|
|
221
|
+
name: "If there is a Ding event on Intercom",
|
|
222
|
+
read: true,
|
|
223
|
+
write: false
|
|
224
|
+
};
|
|
217
225
|
exports.COMMON_EVENTS_TYPE = {
|
|
218
226
|
type: "string",
|
|
219
227
|
role: "text",
|
|
@@ -249,6 +257,13 @@ exports.COMMON_DEBUG_REQUEST = {
|
|
|
249
257
|
read: false,
|
|
250
258
|
write: true
|
|
251
259
|
};
|
|
260
|
+
exports.COMMON_INTERCOM_UNLOCK_REQUEST = {
|
|
261
|
+
type: "boolean",
|
|
262
|
+
role: "button",
|
|
263
|
+
name: "Request Intercom door unlock",
|
|
264
|
+
read: false,
|
|
265
|
+
write: true
|
|
266
|
+
};
|
|
252
267
|
exports.COMMON_NEW_TOKEN = {
|
|
253
268
|
type: "string",
|
|
254
269
|
role: "text",
|
|
@@ -281,5 +296,6 @@ exports.STATE_ID_LIGHT_SWITCH = "light_switch";
|
|
|
281
296
|
exports.STATE_ID_SNAPSHOT_REQUEST = "snapshot_request";
|
|
282
297
|
exports.STATE_ID_LIVESTREAM_REQUEST = "livestream_request";
|
|
283
298
|
exports.STATE_ID_DEBUG_REQUEST = "debug_request";
|
|
299
|
+
exports.STATE_ID_INTERCOM_UNLOCK = "intercom_unlock_request";
|
|
284
300
|
exports.STATE_ID_LOCATIONMODE = "locationMode";
|
|
285
301
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":";;;;AAAa,QAAA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IACpD,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;CACb,CAAA;AACY,QAAA,mBAAmB,GAAyB;IACvD,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,6BAAqB;CAC9B,CAAA;AACY,QAAA,iBAAiB,GAAG,MAAM,CAAC;AAC3B,QAAA,oBAAoB,GAAG,SAAS,CAAC;AACjC,QAAA,kBAAkB,GAAG,OAAO,CAAC;AAC7B,QAAA,qBAAqB,GAAG,UAAU,CAAC;AACnC,QAAA,uBAAuB,GAAG,YAAY,CAAC;AACvC,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAE/B,QAAA,qBAAqB,GAAG,cAAc,CAAC;AACvC,QAAA,yBAAyB,GAAG,kBAAkB,CAAC;AAC/C,QAAA,2BAA2B,GAAG,oBAAoB,CAAC;AACnD,QAAA,sBAAsB,GAAG,eAAe,CAAC;AACzC,QAAA,wBAAwB,GAAG,yBAAyB,CAAC;AACrD,QAAA,qBAAqB,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.OwnRingCamera = void 0;
|
|
27
|
+
const constants_1 = require("./constants");
|
|
28
|
+
const lastAction_1 = require("./lastAction");
|
|
29
|
+
const fs = __importStar(require("fs"));
|
|
30
|
+
const file_service_1 = require("./services/file-service");
|
|
31
|
+
const util = __importStar(require("util"));
|
|
32
|
+
const ownRingDevice_1 = require("./ownRingDevice");
|
|
33
|
+
var EventState;
|
|
34
|
+
(function (EventState) {
|
|
35
|
+
EventState[EventState["Idle"] = 0] = "Idle";
|
|
36
|
+
EventState[EventState["ReactingOnMotion"] = 1] = "ReactingOnMotion";
|
|
37
|
+
EventState[EventState["ReactingOnDing"] = 2] = "ReactingOnDing";
|
|
38
|
+
EventState[EventState["ReactingOnDoorbell"] = 3] = "ReactingOnDoorbell";
|
|
39
|
+
})(EventState || (EventState = {}));
|
|
40
|
+
class OwnRingCamera extends ownRingDevice_1.OwnRingDevice {
|
|
41
|
+
get lastLiveStreamDir() {
|
|
42
|
+
return this._lastLiveStreamDir;
|
|
43
|
+
}
|
|
44
|
+
get lastSnapShotDir() {
|
|
45
|
+
return this._lastSnapShotDir;
|
|
46
|
+
}
|
|
47
|
+
get ringDevice() {
|
|
48
|
+
return this._ringDevice;
|
|
49
|
+
}
|
|
50
|
+
set ringDevice(device) {
|
|
51
|
+
this._ringDevice = device;
|
|
52
|
+
this.subscribeToEvents();
|
|
53
|
+
}
|
|
54
|
+
async subscribeToEvents() {
|
|
55
|
+
this.silly(`Start device subscriptions`);
|
|
56
|
+
await this._ringDevice.subscribeToDingEvents().catch((r) => {
|
|
57
|
+
this.catcher(`Failed subscribing to Ding Events for ${this._ringDevice.name}`, r);
|
|
58
|
+
});
|
|
59
|
+
await this._ringDevice.subscribeToMotionEvents().catch((r) => {
|
|
60
|
+
this.catcher(`Failed subscribing to Motion Events for ${this._ringDevice.name}`, r);
|
|
61
|
+
});
|
|
62
|
+
this._ringDevice.onData.subscribe(this.update.bind(this));
|
|
63
|
+
this._ringDevice.onMotionDetected.subscribe({
|
|
64
|
+
next: (motion) => {
|
|
65
|
+
this.onMotion(motion);
|
|
66
|
+
},
|
|
67
|
+
error: (err) => {
|
|
68
|
+
this.catcher(`Motion Observer recieved error`, err);
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
this._ringDevice.onDoorbellPressed.subscribe({
|
|
72
|
+
next: (ding) => {
|
|
73
|
+
this.onDorbell(ding);
|
|
74
|
+
},
|
|
75
|
+
error: (err) => {
|
|
76
|
+
this.catcher(`Dorbell Observer recieved error`, err);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
this._ringDevice.onNewNotification.subscribe({
|
|
80
|
+
next: (ding) => {
|
|
81
|
+
this.onDing(ding);
|
|
82
|
+
},
|
|
83
|
+
error: (err) => {
|
|
84
|
+
this.catcher(`Ding Observer recieved error`, err);
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
constructor(ringDevice, location, adapter, apiClient) {
|
|
89
|
+
super(location, adapter, apiClient, OwnRingCamera.evaluateKind(ringDevice.deviceType, adapter, ringDevice), `${ringDevice.id}`, ringDevice.data.description);
|
|
90
|
+
this._requestingSnapshot = false;
|
|
91
|
+
this._requestingLiveStream = false;
|
|
92
|
+
this._lastLightCommand = 0;
|
|
93
|
+
this._lastLiveStreamUrl = "";
|
|
94
|
+
this._lastLiveStreamDir = "";
|
|
95
|
+
this._lastLiveStreamVideo = null;
|
|
96
|
+
this._lastLiveStreamTimestamp = 0;
|
|
97
|
+
this._lastSnapShotUrl = "";
|
|
98
|
+
this._lastSnapShotDir = "";
|
|
99
|
+
this._lastSnapshotImage = null;
|
|
100
|
+
this._lastSnapshotTimestamp = 0;
|
|
101
|
+
this._snapshotCount = 0;
|
|
102
|
+
this._liveStreamCount = 0;
|
|
103
|
+
this._state = EventState.Idle;
|
|
104
|
+
this._ringDevice = ringDevice;
|
|
105
|
+
this.debug(`Create device`);
|
|
106
|
+
this.infoChannelId = `${this.fullId}.${constants_1.CHANNEL_NAME_INFO}`;
|
|
107
|
+
this.historyChannelId = `${this.fullId}.${constants_1.CHANNEL_NAME_HISTORY}`;
|
|
108
|
+
this.lightChannelId = `${this.fullId}.${constants_1.CHANNEL_NAME_LIGHT}`;
|
|
109
|
+
this.snapshotChannelId = `${this.fullId}.${constants_1.CHANNEL_NAME_SNAPSHOT}`;
|
|
110
|
+
this.liveStreamChannelId = `${this.fullId}.${constants_1.CHANNEL_NAME_LIVESTREAM}`;
|
|
111
|
+
this.eventsChannelId = `${this.fullId}.${constants_1.CHANNEL_NAME_EVENTS}`;
|
|
112
|
+
this.recreateDeviceObjectTree();
|
|
113
|
+
this.updateDeviceInfoObject(ringDevice.data);
|
|
114
|
+
this.updateHealth();
|
|
115
|
+
// noinspection JSIgnoredPromiseFromCall
|
|
116
|
+
this.updateHistory();
|
|
117
|
+
this.updateLiveStreamObject();
|
|
118
|
+
setTimeout(this.takeSnapshot.bind(this), 5000);
|
|
119
|
+
this.ringDevice = ringDevice; // subscribes to the events
|
|
120
|
+
}
|
|
121
|
+
processUserInput(channelID, stateID, state) {
|
|
122
|
+
switch (channelID) {
|
|
123
|
+
case "":
|
|
124
|
+
if (stateID !== constants_1.STATE_ID_DEBUG_REQUEST) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const targetVal = state.val;
|
|
128
|
+
if (targetVal) {
|
|
129
|
+
this._adapter.log.info(`Device Debug Data for ${this.shortId}: ${util.inspect(this._ringDevice, false, 1)}`);
|
|
130
|
+
this._adapter.upsertState(`${this.fullId}.${constants_1.STATE_ID_DEBUG_REQUEST}`, constants_1.COMMON_DEBUG_REQUEST, false);
|
|
131
|
+
}
|
|
132
|
+
return;
|
|
133
|
+
case "Light":
|
|
134
|
+
if (!this._ringDevice.hasLight) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (stateID === constants_1.STATE_ID_LIGHT_SWITCH) {
|
|
138
|
+
const targetVal = state.val;
|
|
139
|
+
this._adapter.log.debug(`Set light for ${this.shortId} to value ${targetVal}`);
|
|
140
|
+
this._lastLightCommand = Date.now();
|
|
141
|
+
this._ringDevice.setLight(targetVal).then((success) => {
|
|
142
|
+
if (success) {
|
|
143
|
+
this._adapter.upsertState(`${this.lightChannelId}.light_state`, constants_1.COMMON_LIGHT_STATE, targetVal);
|
|
144
|
+
this._adapter.upsertState(`${this.lightChannelId}.light_switch`, constants_1.COMMON_LIGHT_SWITCH, targetVal, true);
|
|
145
|
+
setTimeout(() => {
|
|
146
|
+
this.updateHealth.bind(this);
|
|
147
|
+
}, 65000);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this._adapter.log.error(`Unknown State/Switch with channel "${channelID}" and state "${stateID}"`);
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
case "Snapshot":
|
|
156
|
+
if (stateID === constants_1.STATE_ID_SNAPSHOT_REQUEST) {
|
|
157
|
+
const targetVal = state.val;
|
|
158
|
+
this._adapter.log.debug(`Get Snapshot request for ${this.shortId} to value ${targetVal}`);
|
|
159
|
+
if (targetVal) {
|
|
160
|
+
this.takeSnapshot().catch((reason) => {
|
|
161
|
+
this.catcher("Couldn't retrieve Snapshot.", reason);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
this._adapter.log.error(`Unknown State/Switch with channel "${channelID}" and state "${stateID}"`);
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case "Livestream":
|
|
170
|
+
if (stateID === constants_1.STATE_ID_LIVESTREAM_REQUEST) {
|
|
171
|
+
const targetVal = state.val;
|
|
172
|
+
this._adapter.log.debug(`Get Livestream request for ${this.shortId} to value ${targetVal}`);
|
|
173
|
+
if (targetVal) {
|
|
174
|
+
this.startLivestream().catch((reason) => {
|
|
175
|
+
this.catcher("Couldn't retrieve Livestream.", reason);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
this._adapter.log.error(`Unknown State/Switch with channel "${channelID}" and state "${stateID}"`);
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
default:
|
|
184
|
+
this._adapter.log.error(`Unknown State/Switch with channel "${channelID}" and state "${stateID}"`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
async recreateDeviceObjectTree() {
|
|
188
|
+
this.silly(`Recreate DeviceObjectTree`);
|
|
189
|
+
this._adapter.createDevice(this.fullId, {
|
|
190
|
+
name: `Device ${this.shortId} ("${this._ringDevice.data.description}")`
|
|
191
|
+
});
|
|
192
|
+
this._adapter.createChannel(this.fullId, constants_1.CHANNEL_NAME_INFO, { name: `Info ${this.shortId}` });
|
|
193
|
+
this._adapter.createChannel(this.fullId, constants_1.CHANNEL_NAME_SNAPSHOT);
|
|
194
|
+
this._adapter.createChannel(this.fullId, constants_1.CHANNEL_NAME_LIVESTREAM, { name: `Livestream ${this.shortId}` });
|
|
195
|
+
this._adapter.createChannel(this.fullId, constants_1.CHANNEL_NAME_HISTORY);
|
|
196
|
+
this._adapter.createChannel(this.fullId, constants_1.CHANNEL_NAME_EVENTS);
|
|
197
|
+
if (this._ringDevice.hasLight) {
|
|
198
|
+
this.debug(`Device with Light Capabilities detected`);
|
|
199
|
+
this._adapter.createChannel(this.fullId, constants_1.CHANNEL_NAME_LIGHT, { name: `Light ${this.shortId}` });
|
|
200
|
+
this._adapter.upsertState(`${this.lightChannelId}.${constants_1.STATE_ID_LIGHT_SWITCH}`, constants_1.COMMON_LIGHT_SWITCH, false, true);
|
|
201
|
+
}
|
|
202
|
+
this._lastSnapShotDir = await this._adapter.tryGetStringState(`${this.snapshotChannelId}.snapshot_file`);
|
|
203
|
+
this._lastLiveStreamDir = await this._adapter.tryGetStringState(`${this.liveStreamChannelId}.livestream_file`);
|
|
204
|
+
this._adapter.upsertState(`${this.fullId}.${constants_1.STATE_ID_DEBUG_REQUEST}`, constants_1.COMMON_DEBUG_REQUEST, false, true);
|
|
205
|
+
}
|
|
206
|
+
updateByDevice(ringDevice) {
|
|
207
|
+
this.ringDevice = ringDevice;
|
|
208
|
+
this._state = EventState.Idle;
|
|
209
|
+
this.update(ringDevice.data);
|
|
210
|
+
}
|
|
211
|
+
update(data) {
|
|
212
|
+
this.debug(`Recieved Update`);
|
|
213
|
+
this.updateDeviceInfoObject(data);
|
|
214
|
+
this.updateHealth();
|
|
215
|
+
// noinspection JSIgnoredPromiseFromCall
|
|
216
|
+
this.updateHistory();
|
|
217
|
+
this.updateSnapshotObject();
|
|
218
|
+
}
|
|
219
|
+
async startLivestream(duration) {
|
|
220
|
+
this.silly(`${this.shortId}.startLivestream()`);
|
|
221
|
+
const { fullPath, dirname } = file_service_1.FileService.getPath(this._adapter.config.path, this._adapter.config.filename_livestream, ++this._liveStreamCount, this.shortId, this.fullId, this.kind);
|
|
222
|
+
if (!(await file_service_1.FileService.prepareFolder(dirname))) {
|
|
223
|
+
this.debug(`Failed to prepare Livestream folder ("${fullPath}")`);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
file_service_1.FileService.deleteFileIfExistSync(fullPath, this._adapter);
|
|
227
|
+
if (this._ringDevice.isOffline) {
|
|
228
|
+
this.info(` is offline --> won't take LiveStream`);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
duration !== null && duration !== void 0 ? duration : (duration = this._adapter.config.recordtime_livestream);
|
|
232
|
+
const tempPath = (await file_service_1.FileService.getTempDir(this._adapter)) + `/temp_${this.shortId}_livestream.mp4`;
|
|
233
|
+
this.silly(`Initialize Livestream (${duration}s) to temp-file ${tempPath}`);
|
|
234
|
+
await this._ringDevice.recordToFile(tempPath, duration);
|
|
235
|
+
if (!fs.existsSync(tempPath)) {
|
|
236
|
+
this.info(`Could't create livestream`);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const video = fs.readFileSync(tempPath);
|
|
240
|
+
fs.unlink(tempPath, (err) => {
|
|
241
|
+
if (err) {
|
|
242
|
+
this._adapter.logCatch(`Couldn't delete temp file`, err);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
this.silly(`Recieved Livestream has Length: ${video.length}`);
|
|
246
|
+
this._lastLiveStreamUrl = await file_service_1.FileService.getVisUrl(this._adapter, this.fullId, "Livestream.mp4");
|
|
247
|
+
file_service_1.FileService.writeFileSync(fullPath, video, this._adapter);
|
|
248
|
+
if (this.lastLiveStreamDir !== "" && this._adapter.config.del_old_livestream) {
|
|
249
|
+
file_service_1.FileService.deleteFileIfExistSync(this._lastLiveStreamDir, this._adapter);
|
|
250
|
+
}
|
|
251
|
+
this._lastLiveStreamDir = fullPath;
|
|
252
|
+
this._requestingLiveStream = false;
|
|
253
|
+
// this.silly(`Locally storing Snapshot (Length: ${image.length})`);
|
|
254
|
+
this._lastLiveStreamVideo = video;
|
|
255
|
+
this._lastLiveStreamTimestamp = Date.now();
|
|
256
|
+
await this.updateLiveStreamObject();
|
|
257
|
+
this.debug(`Done creating livestream to ${fullPath}`);
|
|
258
|
+
}
|
|
259
|
+
async takeSnapshot(uuid, eventBased = false) {
|
|
260
|
+
const { fullPath, dirname } = file_service_1.FileService.getPath(this._adapter.config.path, this._adapter.config.filename_snapshot, ++this._snapshotCount, this.shortId, this.fullId, this.kind);
|
|
261
|
+
if (!(await file_service_1.FileService.prepareFolder(dirname)))
|
|
262
|
+
return;
|
|
263
|
+
file_service_1.FileService.deleteFileIfExistSync(fullPath, this._adapter);
|
|
264
|
+
if (this._ringDevice.isOffline) {
|
|
265
|
+
this.info(`is offline --> won't take Snapshot`);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const image = await this._ringDevice.getSnapshot({ uuid: uuid }).catch((reason) => {
|
|
269
|
+
if (eventBased) {
|
|
270
|
+
this.info("Taking Snapshot on Event failed. Will try again after livestream finished.");
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
this.catcher("Couldn't get Snapshot from api.", reason);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
if (!image) {
|
|
277
|
+
if (!eventBased) {
|
|
278
|
+
this.info("Could not create snapshot");
|
|
279
|
+
}
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
this.silly(`Writing Snapshot (Length: ${image.length}) to "${fullPath}"`);
|
|
283
|
+
file_service_1.FileService.writeFileSync(fullPath, image, this._adapter);
|
|
284
|
+
this._lastSnapShotUrl = await file_service_1.FileService.getVisUrl(this._adapter, this.fullId, "Snapshot.jpg");
|
|
285
|
+
if (this.lastSnapShotDir !== "" && this._adapter.config.del_old_snapshot) {
|
|
286
|
+
file_service_1.FileService.deleteFileIfExistSync(this._lastSnapShotDir, this._adapter);
|
|
287
|
+
}
|
|
288
|
+
this._lastSnapShotDir = fullPath;
|
|
289
|
+
this._requestingSnapshot = false;
|
|
290
|
+
// this.silly(`Locally storing Snapshot (Length: ${image.length})`);
|
|
291
|
+
this._lastSnapshotImage = image;
|
|
292
|
+
this._lastSnapshotTimestamp = Date.now();
|
|
293
|
+
await this.updateSnapshotObject();
|
|
294
|
+
this.debug(`Done creating snapshot to ${fullPath}`);
|
|
295
|
+
}
|
|
296
|
+
updateHealth() {
|
|
297
|
+
this.silly(`Update Health`);
|
|
298
|
+
this._ringDevice.getHealth().then(this.updateHealthObject.bind(this));
|
|
299
|
+
}
|
|
300
|
+
async updateHistory() {
|
|
301
|
+
this.silly(`Update History`);
|
|
302
|
+
this._ringDevice.getEvents({ limit: 50 })
|
|
303
|
+
.then(async (r) => {
|
|
304
|
+
this.silly(`Recieved Event History`);
|
|
305
|
+
const lastAction = r.events.find((event) => {
|
|
306
|
+
const kind = event.kind;
|
|
307
|
+
switch (kind) {
|
|
308
|
+
case "motion":
|
|
309
|
+
case "ding":
|
|
310
|
+
case "alarm":
|
|
311
|
+
case "on_demand":
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
return false;
|
|
315
|
+
});
|
|
316
|
+
if (lastAction === undefined) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
const url = await this._ringDevice.getRecordingUrl(lastAction.ding_id_str);
|
|
320
|
+
this.lastAction = new lastAction_1.LastAction(lastAction, url);
|
|
321
|
+
this.updateHistoryObject(this.lastAction);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
updateDeviceInfoObject(data) {
|
|
325
|
+
this._adapter.upsertState(`${this.infoChannelId}.id`, constants_1.COMMON_INFO_ID, data.device_id);
|
|
326
|
+
this._adapter.upsertState(`${this.infoChannelId}.kind`, constants_1.COMMON_INFO_KIND, data.kind);
|
|
327
|
+
this._adapter.upsertState(`${this.infoChannelId}.description`, constants_1.COMMON_INFO_DESCRIPTION, data.description);
|
|
328
|
+
this._adapter.upsertState(`${this.infoChannelId}.external_connection`, constants_1.COMMON_INFO_EXTERNAL_CONNECTION, data.external_connection);
|
|
329
|
+
this._adapter.upsertState(`${this.infoChannelId}.hasLight`, constants_1.COMMON_INFO_HAS_LIGHT, this._ringDevice.hasLight);
|
|
330
|
+
this._adapter.upsertState(`${this.infoChannelId}.hasBattery`, constants_1.COMMON_INFO_HAS_BATTERY, this._ringDevice.hasBattery);
|
|
331
|
+
this._adapter.upsertState(`${this.infoChannelId}.hasSiren`, constants_1.COMMON_INFO_HAS_SIREN, this._ringDevice.hasSiren);
|
|
332
|
+
}
|
|
333
|
+
updateHistoryObject(lastAction) {
|
|
334
|
+
this._adapter.upsertState(`${this.historyChannelId}.created_at`, constants_1.COMMON_HISTORY_CREATED_AT, lastAction.event.created_at);
|
|
335
|
+
this._adapter.upsertState(`${this.historyChannelId}.history_url`, constants_1.COMMON_HISTORY_URL, lastAction.historyUrl);
|
|
336
|
+
this._adapter.upsertState(`${this.historyChannelId}.kind`, constants_1.COMMON_HISTORY_KIND, lastAction.event.kind);
|
|
337
|
+
}
|
|
338
|
+
async updateSnapshotObject() {
|
|
339
|
+
this.debug(`Update Snapshot Object`);
|
|
340
|
+
if (this._lastSnapshotImage) {
|
|
341
|
+
await this._adapter.upsertFile(`${this.snapshotChannelId}.jpg`, constants_1.COMMON_SNAPSHOT_SNAPSHOT, this._lastSnapshotImage, this._lastSnapshotTimestamp).catch((reason) => {
|
|
342
|
+
this.debug(`Couldn't update Snapshot obejct: "${reason}"`);
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
if (this._lastSnapshotTimestamp !== 0) {
|
|
346
|
+
this._adapter.upsertState(`${this.snapshotChannelId}.snapshot_file`, constants_1.COMMON_SNAPSHOT_FILE, this._lastSnapShotDir);
|
|
347
|
+
this._adapter.upsertState(`${this.snapshotChannelId}.moment`, constants_1.COMMON_SNAPSHOT_MOMENT, this._lastSnapshotTimestamp);
|
|
348
|
+
this._adapter.upsertState(`${this.snapshotChannelId}.snapshot_url`, constants_1.COMMON_SNAPSHOT_URL, this._lastSnapShotUrl);
|
|
349
|
+
this._adapter.upsertState(`${this.snapshotChannelId}.${constants_1.STATE_ID_SNAPSHOT_REQUEST}`, constants_1.COMMON_SNAPSHOT_REQUEST, this._requestingSnapshot, true);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
async updateLiveStreamObject() {
|
|
353
|
+
this.debug(`Update Livestream Object`);
|
|
354
|
+
if (this._lastLiveStreamVideo) {
|
|
355
|
+
await this._adapter.upsertFile(`${this.liveStreamChannelId}.mp4`, constants_1.COMMON_LIVESTREAM_LIVESTREAM, this._lastLiveStreamVideo, this._lastLiveStreamTimestamp).catch((reason) => {
|
|
356
|
+
this.debug(`Couldn't update Livestream obejct: "${reason}"`);
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
if (this._lastLiveStreamDir !== "") {
|
|
360
|
+
this._adapter.upsertState(`${this.liveStreamChannelId}.livestream_file`, constants_1.COMMON_LIVESTREAM_FILE, this._lastLiveStreamDir);
|
|
361
|
+
this._adapter.upsertState(`${this.liveStreamChannelId}.livestream_url`, constants_1.COMMON_LIVESTREAM_URL, this._lastLiveStreamUrl);
|
|
362
|
+
this._adapter.upsertState(`${this.liveStreamChannelId}.moment`, constants_1.COMMON_LIVESTREAM_MOMENT, this._lastLiveStreamTimestamp);
|
|
363
|
+
}
|
|
364
|
+
this._adapter.upsertState(`${this.liveStreamChannelId}.${constants_1.STATE_ID_LIVESTREAM_REQUEST}`, constants_1.COMMON_LIVESTREAM_REQUEST, this._requestingLiveStream, true);
|
|
365
|
+
}
|
|
366
|
+
updateHealthObject(health) {
|
|
367
|
+
var _a;
|
|
368
|
+
this.debug(`Update Health Callback`);
|
|
369
|
+
let batteryPercent = parseInt((_a = health.battery_percentage) !== null && _a !== void 0 ? _a : "-1");
|
|
370
|
+
if (isNaN(batteryPercent)) {
|
|
371
|
+
batteryPercent = -1;
|
|
372
|
+
}
|
|
373
|
+
this._adapter.upsertState(`${this.infoChannelId}.battery_percentage`, constants_1.COMMON_INFO_BATTERY_PERCENTAGE, batteryPercent);
|
|
374
|
+
this._adapter.upsertState(`${this.infoChannelId}.battery_percentage_category`, constants_1.COMMON_INFO_BATTERY_PERCENTAGE_CATEGORY, health.battery_percentage_category);
|
|
375
|
+
this._adapter.upsertState(`${this.infoChannelId}.wifi_name`, constants_1.COMMON_INFO_WIFI_NAME, health.wifi_name);
|
|
376
|
+
this._adapter.upsertState(`${this.infoChannelId}.latest_signal_strength`, constants_1.COMMON_INFO_LATEST_SIGNAL_STRENGTH, health.latest_signal_strength);
|
|
377
|
+
this._adapter.upsertState(`${this.infoChannelId}.latest_signal_category`, constants_1.COMMON_INFO_LATEST_SIGNAL_CATEGORY, health.latest_signal_category);
|
|
378
|
+
this._adapter.upsertState(`${this.infoChannelId}.firmware`, constants_1.COMMON_INFO_FIRMWARE, health.firmware);
|
|
379
|
+
if (this._ringDevice.hasLight && (Date.now() - this._lastLightCommand > 60000)) {
|
|
380
|
+
// this.silly(JSON.stringify(this._ringDevice.data));
|
|
381
|
+
const floodlightOn = this._ringDevice.data.health.floodlight_on;
|
|
382
|
+
this.debug(`Update Light within Health Update Floodlight is ${floodlightOn}`);
|
|
383
|
+
this._adapter.upsertState(`${this.lightChannelId}.light_state`, constants_1.COMMON_LIGHT_STATE, floodlightOn);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
onDing(value) {
|
|
387
|
+
var _a;
|
|
388
|
+
this.debug(`Recieved Ding Event (${util.inspect(value, true, 1)})`);
|
|
389
|
+
this.conditionalRecording(EventState.ReactingOnDing, value.ding.image_uuid);
|
|
390
|
+
this._adapter.upsertState(`${this.eventsChannelId}.type`, constants_1.COMMON_EVENTS_TYPE, value.subtype);
|
|
391
|
+
this._adapter.upsertState(`${this.eventsChannelId}.detectionType`, constants_1.COMMON_EVENTS_DETECTIONTYPE, (_a = value.ding.detection_type) !== null && _a !== void 0 ? _a : value.subtype);
|
|
392
|
+
this._adapter.upsertState(`${this.eventsChannelId}.created_at`, constants_1.COMMON_EVENTS_MOMENT, Date.now());
|
|
393
|
+
this._adapter.upsertState(`${this.eventsChannelId}.message`, constants_1.COMMON_EVENTS_MESSAGE, value.aps.alert);
|
|
394
|
+
}
|
|
395
|
+
onMotion(value) {
|
|
396
|
+
this.debug(`Recieved Motion Event (${util.inspect(value, true, 1)})`);
|
|
397
|
+
this._adapter.upsertState(`${this.eventsChannelId}.motion`, constants_1.COMMON_MOTION, value);
|
|
398
|
+
if (value) {
|
|
399
|
+
this.conditionalRecording(EventState.ReactingOnMotion);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
onDorbell(value) {
|
|
403
|
+
this.debug(`Recieved Doorbell Event (${util.inspect(value, true, 1)})`);
|
|
404
|
+
this._adapter.upsertState(`${this.eventsChannelId}.doorbell`, constants_1.COMMON_EVENTS_DOORBELL, true);
|
|
405
|
+
setTimeout(() => {
|
|
406
|
+
this._adapter.upsertState(`${this.eventsChannelId}.doorbell`, constants_1.COMMON_EVENTS_DOORBELL, false);
|
|
407
|
+
}, 5000);
|
|
408
|
+
this.conditionalRecording(EventState.ReactingOnDoorbell, value.ding.image_uuid);
|
|
409
|
+
}
|
|
410
|
+
async conditionalRecording(state, uuid) {
|
|
411
|
+
if (this._state === EventState.Idle) {
|
|
412
|
+
this.silly(`Start recording for Event "${EventState[state]}"...`);
|
|
413
|
+
this._state = state;
|
|
414
|
+
try {
|
|
415
|
+
this.takeSnapshot(uuid, true);
|
|
416
|
+
await this.startLivestream(20);
|
|
417
|
+
}
|
|
418
|
+
finally {
|
|
419
|
+
this._state = EventState.Idle;
|
|
420
|
+
}
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
this.silly(`Would have recorded due to "${EventState[state]}", but we are already reacting.`);
|
|
424
|
+
if (uuid) {
|
|
425
|
+
setTimeout(() => {
|
|
426
|
+
this.debug(`delayed uuid recording`);
|
|
427
|
+
this.takeSnapshot(uuid);
|
|
428
|
+
}, 23000);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
exports.OwnRingCamera = OwnRingCamera;
|
|
433
|
+
//# sourceMappingURL=ownRingCamera.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownRingCamera.js","sourceRoot":"","sources":["../../src/lib/ownRingCamera.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,2CA8CqB;AACrB,6CAA0C;AAC1C,uCAAyB;AACzB,0DAAsD;AACtD,2CAA6B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