Skip to content

Commit 2155044

Browse files
committed
Adding naming accessory
1 parent 42bba16 commit 2155044

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

README.md

-8
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ If you want to have manual control over the configuration, add the following con
5353
streamPassword: "__STREAM_PASSWORD__", // This must be only alphanumeric [A-Za-z0-9], no special characters allowed!
5454
streamUser: "__STREAM_USER__", // This must be only alphanumeric [A-Za-z0-9], no special characters allowed!
5555

56-
// Optionals, don't put them in the config if you need the default values
57-
pullInterval: 60000, // Numbers of milliseconds after we update accessories by polling
58-
disableStreaming: false, // Disables the video feed
59-
disablePrivacyAccessory: false, // Disables the privacy accessory
60-
disableAlarmAccessory: false, // Disables the alarm accessory
61-
disableMotionAccessory: false, // Disables the motion detection sensor
62-
lowQuality: false, // Video stream will be requested in low-quality (640x480) instead of HQ (1920x1080)
63-
6456
// An object containing a video-config passed to camera-ffmpeg
6557
// Please check https://www.npmjs.com/package/homebridge-camera-ffmpeg for all the possible values\
6658
// Make sure you don't override default values provided by this plugin unless you know what you're doing!

config.schema.json

+13-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"username": {
3131
"title": "TAPO username",
3232
"type": "string",
33-
"required": false,
3433
"description": "Most of the time you should leave this empty, defaulting to admin. If it doesn't work, try to use your streaming username (see below)"
3534
},
3635
"password": {
@@ -87,7 +86,19 @@
8786
"title": "Low Quality",
8887
"type": "boolean",
8988
"description": "Video stream will be requested in low-quality (640x480) instead of HQ (1920x1080)"
90-
}
89+
},
90+
"privacyAccessoryName": {
91+
"title": "Privacy Accessory Name",
92+
"type": "string",
93+
"description": "Name of the Privacy accessory",
94+
"placeholder": "Eyes"
95+
},
96+
"alarmAccessoryName": {
97+
"title": "Alarm Accessory Name",
98+
"type": "string",
99+
"description": "Name of the Alarm accessory",
100+
"placeholder": "Alarm"
101+
},
91102
}
92103
}
93104
}

src/cameraAccessory.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export type CameraConfig = {
3030
lowQuality?: boolean;
3131

3232
videoConfig?: VideoConfig;
33+
34+
privacyAccessoryName?: string;
35+
alarmAccessoryName?: string;
3336
};
3437

3538
export class CameraAccessory {
@@ -81,8 +84,12 @@ export class CameraAccessory {
8184
}
8285

8386
private setupAlarmAccessory() {
84-
const name = `${this.config.name} - Alarm`;
87+
const name = this.config.alarmAccessoryName || "Alarm";
8588
this.alarmService = new this.api.hap.Service.Switch(name, "alarm");
89+
this.alarmService.setCharacteristic(
90+
this.api.hap.Characteristic.ConfiguredName,
91+
name
92+
);
8693
this.alarmService = this.accessory.addService(this.alarmService);
8794
this.alarmService
8895
.getCharacteristic(this.api.hap.Characteristic.On)
@@ -108,8 +115,12 @@ export class CameraAccessory {
108115
}
109116

110117
private setupPrivacyModeAccessory() {
111-
const name = `${this.config.name} - Eyes`;
118+
const name = this.config.privacyAccessoryName || "Eyes";
112119
this.privacyService = new this.api.hap.Service.Switch(name, "privacy");
120+
this.privacyService.setCharacteristic(
121+
this.api.hap.Characteristic.ConfiguredName,
122+
name
123+
);
113124
this.accessory.addService(this.privacyService);
114125

115126
this.privacyService

0 commit comments

Comments
 (0)