Skip to content

Commit 414b8ab

Browse files
authored
Merging pull request #17960
* new components * pnpm-lock.yaml * updates
1 parent 35e176f commit 414b8ab

File tree

24 files changed

+1352
-7
lines changed

24 files changed

+1352
-7
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import rhombus from "../../rhombus.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "rhombus-create-camera-clip",
6+
name: "Create Camera Clip",
7+
description: "Create a camera clip from video footage. [See the documentation](https://apidocs.rhombus.com/reference/splicev3)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
rhombus,
12+
clipType: {
13+
type: "string",
14+
label: "Clip Type",
15+
description: "The type of clip to create",
16+
options: [
17+
{
18+
label: "Arbitrary Clip (Splice)",
19+
value: "splice",
20+
},
21+
{
22+
label: "Policy Alert Clip",
23+
value: "policyAlert",
24+
},
25+
],
26+
default: "splice",
27+
},
28+
cameraUuid: {
29+
type: "string",
30+
label: "Camera ID",
31+
description: "The ID of a camera (required for arbitrary clips)",
32+
propDefinition: [
33+
rhombus,
34+
"cameraUuid",
35+
],
36+
optional: true,
37+
},
38+
startTimeMills: {
39+
type: "string",
40+
label: "Start Time",
41+
description: "The start time for the clip (in milliseconds since the Unix epoch) - required for arbitrary clips",
42+
optional: true,
43+
},
44+
durationSec: {
45+
type: "integer",
46+
label: "Duration (sec)",
47+
description: "The duration of the clip (in seconds)",
48+
optional: true,
49+
},
50+
policyAlertUuid: {
51+
type: "string",
52+
label: "Policy Alert UUID",
53+
description: "The UUID of the policy alert to save as a clip (required for policy alert clips)",
54+
optional: true,
55+
},
56+
clipName: {
57+
type: "string",
58+
label: "Clip Name",
59+
description: "A name for the created clip",
60+
optional: true,
61+
},
62+
description: {
63+
type: "string",
64+
label: "Description",
65+
description: "A description for the created clip",
66+
optional: true,
67+
},
68+
},
69+
async run({ $ }) {
70+
let response;
71+
72+
if (this.clipType === "splice") {
73+
// Validate required fields for splice
74+
if (!this.cameraUuid) {
75+
throw new ConfigurationError("Camera UUID is required for arbitrary clips");
76+
}
77+
if (!this.startTimeMills) {
78+
throw new ConfigurationError("Start time is required for arbitrary clips");
79+
}
80+
81+
response = await this.rhombus.spliceV3({
82+
$,
83+
data: {
84+
deviceUuids: [
85+
this.cameraUuid,
86+
],
87+
startTimeMillis: this.startTimeMills,
88+
durationSec: this.durationSec,
89+
title: this.clipName,
90+
description: this.description,
91+
},
92+
});
93+
94+
$.export("$summary", `Created arbitrary clip for camera ${this.cameraUuid}`);
95+
} else if (this.clipType === "policyAlert") {
96+
// Validate required fields for policy alert
97+
if (!this.policyAlertUuid) {
98+
throw new ConfigurationError("Policy Alert UUID is required for policy alert clips");
99+
}
100+
101+
response = await this.rhombus.savePolicyAlertV2({
102+
$,
103+
data: {
104+
alertUuid: this.policyAlertUuid,
105+
savedClipTitle: this.clipName,
106+
savedClipDescription: this.description,
107+
},
108+
});
109+
110+
$.export("$summary", `Created policy alert clip from policy alert ${this.policyAlertUuid}`);
111+
} else {
112+
throw new ConfigurationError(`Unsupported clip type: ${this.clipType}`);
113+
}
114+
115+
return response;
116+
},
117+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import rhombus from "../../rhombus.app.mjs";
2+
3+
export default {
4+
key: "rhombus-create-custom-footage-seekpoints",
5+
name: "Create Custom Footage Seekpoints",
6+
description: "Create custom activity seekpoints for a specified camera. [See the documentation](https://apidocs.rhombus.com/reference/createcustomfootageseekpoints)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
rhombus,
11+
cameraUuid: {
12+
propDefinition: [
13+
rhombus,
14+
"cameraUuid",
15+
],
16+
},
17+
name: {
18+
type: "string",
19+
label: "Name",
20+
description: "The name of the custom seekpoint",
21+
},
22+
timestampMs: {
23+
type: "integer",
24+
label: "Timestamp (ms)",
25+
description: "The timestamp of the custom seekpoint (in milliseconds since the Unix epoch)",
26+
},
27+
description: {
28+
type: "string",
29+
label: "Description",
30+
description: "A description for the custom seekpoint",
31+
optional: true,
32+
},
33+
},
34+
async run({ $ }) {
35+
const response = await this.rhombus.createCustomFootageSeekpoints({
36+
$,
37+
data: {
38+
cameraUuid: this.cameraUuid,
39+
footageSeekpoints: [
40+
{
41+
name: this.name,
42+
timestampMs: this.timestampMs,
43+
description: this.description,
44+
},
45+
],
46+
},
47+
});
48+
49+
$.export("$summary", `Created custom footage seekpoint for camera ${this.cameraUuid}`);
50+
return response;
51+
},
52+
};
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
import rhombus from "../../rhombus.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
import constants from "../../common/constants.mjs";
4+
5+
export default {
6+
key: "rhombus-create-shared-live-video-stream",
7+
name: "Create Shared Live Video Stream",
8+
description: "Create a shared live video stream and get the URL to access it. [See the documentation](https://apidocs.rhombus.com/reference/createcamerasharedlivevideostream))",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
rhombus,
13+
deviceType: {
14+
type: "string",
15+
label: "Device Type",
16+
description: "The type of device to create a shared stream for",
17+
options: [
18+
{
19+
label: "Camera",
20+
value: "camera",
21+
},
22+
{
23+
label: "Doorbell Camera",
24+
value: "doorbell",
25+
},
26+
],
27+
default: "camera",
28+
},
29+
streamType: {
30+
type: "string",
31+
label: "Stream Type",
32+
description: "The type of stream to create",
33+
options: constants.STREAM_TYPES,
34+
},
35+
vodEnabled: {
36+
type: "boolean",
37+
label: "VOD Enabled",
38+
description: "Enables recording of live footage to a VOD",
39+
},
40+
cameraUuid: {
41+
type: "string",
42+
label: "Camera ID",
43+
description: "The ID of a camera (required when device type is 'camera')",
44+
propDefinition: [
45+
rhombus,
46+
"cameraUuid",
47+
],
48+
optional: true,
49+
},
50+
doorbellCameraUuid: {
51+
type: "string",
52+
label: "Doorbell Camera ID",
53+
description: "The ID of a doorbell camera (required when device type is 'doorbell')",
54+
propDefinition: [
55+
rhombus,
56+
"doorbellCameraUuid",
57+
],
58+
optional: true,
59+
},
60+
includeAudio: {
61+
type: "boolean",
62+
label: "Include Audio",
63+
description: "Camera must be associated with an audio gateway to have audio. Required when device type is `camera`.",
64+
default: false,
65+
optional: true,
66+
},
67+
},
68+
async run({ $ }) {
69+
let response;
70+
let deviceUuid;
71+
72+
if (this.deviceType === "camera") {
73+
if (!this.cameraUuid) {
74+
throw new ConfigurationError("Camera UUID is required when device type is 'camera'");
75+
}
76+
if (this.includeAudio === undefined || this.includeAudio === null) {
77+
throw new ConfigurationError("Include Audio is required when device type is 'camera'");
78+
}
79+
deviceUuid = this.cameraUuid;
80+
81+
response = await this.rhombus.createSharedLiveVideoStream({
82+
$,
83+
data: {
84+
cameraUuid: this.cameraUuid,
85+
includeAudio: this.includeAudio,
86+
vodEnabled: this.vodEnabled,
87+
streamType: this.streamType,
88+
},
89+
});
90+
} else if (this.deviceType === "doorbell") {
91+
if (!this.doorbellCameraUuid) {
92+
throw new ConfigurationError("Doorbell Camera UUID is required when device type is 'doorbell'");
93+
}
94+
deviceUuid = this.doorbellCameraUuid;
95+
96+
response = await this.rhombus.createDoorbellSharedLiveVideoStream({
97+
$,
98+
data: {
99+
doorbellCameraUuid: this.doorbellCameraUuid,
100+
includeAudio: this.includeAudio,
101+
vodEnabled: this.vodEnabled,
102+
streamType: this.streamType,
103+
},
104+
});
105+
} else {
106+
throw new Error(`Unsupported device type: ${this.deviceType}`);
107+
}
108+
109+
// Extract the stream URL from the response
110+
const streamUrl = response.streamUrl || response.url;
111+
112+
$.export("$summary", `Created shared live video stream '${this.streamName}' for ${this.deviceType} ${deviceUuid}`);
113+
114+
// Export the stream URL for easy access
115+
if (streamUrl) {
116+
$.export("streamUrl", streamUrl);
117+
}
118+
119+
return {
120+
...response,
121+
streamUrl,
122+
deviceType: this.deviceType,
123+
deviceUuid,
124+
};
125+
},
126+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import rhombus from "../../rhombus.app.mjs";
2+
3+
export default {
4+
key: "rhombus-play-audio-upload",
5+
name: "Play Audio Upload",
6+
description: "Play an uploaded audio clip through an audio device. [See the documentation](https://apidocs.rhombus.com/reference/playaudioupload)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
rhombus,
11+
audioGatewayUuid: {
12+
propDefinition: [
13+
rhombus,
14+
"audioGatewayUuid",
15+
],
16+
},
17+
audioUploadUuid: {
18+
propDefinition: [
19+
rhombus,
20+
"audioUploadUuid",
21+
],
22+
},
23+
loopDurationSec: {
24+
type: "integer",
25+
label: "Loop Duration (sec)",
26+
description: "The duration of the loop (in seconds)",
27+
optional: true,
28+
},
29+
playCount: {
30+
type: "integer",
31+
label: "Play Count",
32+
description: "The number of times to play the audio upload",
33+
optional: true,
34+
},
35+
},
36+
async run({ $ }) {
37+
const response = await this.rhombus.playAudioUpload({
38+
$,
39+
data: {
40+
audioGatewayUuids: [
41+
this.audioGatewayUuid,
42+
],
43+
audioUploadUuid: this.audioUploadUuid,
44+
loopDurationSec: this.loopDurationSec,
45+
playCount: this.playCount,
46+
},
47+
});
48+
49+
$.export("$summary", `Playing audio upload ${this.audioUploadUuid} through audio gateway ${this.audioGatewayUuid}`);
50+
return response;
51+
},
52+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import rhombus from "../../rhombus.app.mjs";
2+
3+
export default {
4+
key: "rhombus-reboot-camera",
5+
name: "Reboot Camera",
6+
description: "Reboot a camera. [See the documentation](https://apidocs.rhombus.com/reference/rebootcamera)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
rhombus,
11+
cameraUuid: {
12+
propDefinition: [
13+
rhombus,
14+
"cameraUuid",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.rhombus.rebootCamera({
20+
$,
21+
data: {
22+
cameraUuid: this.cameraUuid,
23+
},
24+
});
25+
$.export("$summary", `Rebooted camera ${this.cameraUuid}`);
26+
return response;
27+
},
28+
};

0 commit comments

Comments
 (0)