homebridge-unifi-protect 5.3.3 → 5.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  <SPAN ALIGN="CENTER" STYLE="text-align:center">
2
2
  <DIV ALIGN="CENTER" STYLE="text-align:center">
3
3
 
4
- [![homebridge-unifi-protect: Native HomeKit support for UniFi Protect](https://raw.githubusercontent.com/hjdhjd/homebridge-unifi-protect/master/homebridge-protect.svg)](https://github.com/hjdhjd/homebridge-unifi-protect)
4
+ [![homebridge-unifi-protect: Native HomeKit support for UniFi Protect](https://raw.githubusercontent.com/hjdhjd/homebridge-unifi-protect/main/homebridge-protect.svg)](https://github.com/hjdhjd/homebridge-unifi-protect)
5
5
 
6
6
  # Homebridge UniFi Protect
7
7
  [![Downloads](https://img.shields.io/npm/dt/homebridge-unifi-protect?color=%230559C9&logo=icloud&logoColor=%23FFFFFF&style=for-the-badge)](https://www.npmjs.com/package/homebridge-unifi-protect)
@@ -23,54 +23,54 @@ What does *just works* mean in practice? It means that this plugin will discover
23
23
  For the more technically inclined - this plugin has continued to pioneer the HomeKit user experience for UniFi Protect by being the ***first*** Homebridge plugin (and first third-party app, to my knowledge) to successfully reverse engineer the UniFi Protect realtime events API that was introduced with UniFi OS. This means that rather than poll the Protect controller every few seconds to catch events, we're able to capture motion and doorbell ring events in realtime, providing an immediate and extremely responsive HomeKit experience, further reducing the potential performance impact to Protect controllers. Since reverse engineering the realtime events API, most of the major open source smart automation projects have benefitted and also incorporated that work.
24
24
 
25
25
  ### Features
26
- - ***Easy* configuration - all you need is your UniFi Protect controller IP address, username, and password to get started.** The defaults work for the vast majority of users. When you want more, there are [advanced options](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/AdvancedOptions.md) you can play with, if you choose.
26
+ - ***Easy* configuration - all you need is your UniFi Protect controller IP address, username, and password to get started.** The defaults work for the vast majority of users. When you want more, there are [advanced options](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/AdvancedOptions.md) you can play with, if you choose.
27
27
 
28
28
  - **Full HomeKit support for the UniFi Protect ecosystem.** All generally available UniFi Protect devices are supported, including cameras, doorbells, lights, sensors, and ViewPorts.
29
29
 
30
- - **[Complete HomeKit Secure Video support for all UniFi Protect cameras.](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/HomeKitSecureVideo.md)** Complete HomeKit Secure Video support, without the need for additional plugins or software beyond FFmpeg. Another community first. We weren't the first to do HKSV, but we are the first to do it seamlessly without the need for additional tools to get a complete solution.
30
+ - **[Complete HomeKit Secure Video support for all UniFi Protect cameras.](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/HomeKitSecureVideo.md)** Complete HomeKit Secure Video support, without the need for additional plugins or software beyond FFmpeg. Another community first. We weren't the first to do HKSV, but we are the first to do it seamlessly without the need for additional tools to get a complete solution.
31
31
 
32
32
  - **Blazing fast video streaming.** Video streaming from HomeKit will start within in 1-2 seconds for cameras, in most cases. I've spent the time to optimize the video streaming experience to ensure it feels very responsive, and *just works*.
33
33
 
34
- - **[Full UniFi Protect Doorbell support.](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Doorbell.md).** This plugin provides complete support for [UniFi Protect Doorbells](https://store.ui.com/collections/unifi-protect/products/uvc-g4-doorbell). We support all the features of the doorbell including - doorbell rings, two-way audio, and the use of the onboard LCD screen for messages. Two-way audio has caveats you should be aware of.
34
+ - **[Full UniFi Protect Doorbell support.](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Doorbell.md).** This plugin provides complete support for [UniFi Protect Doorbells](https://store.ui.com/collections/unifi-protect/products/uvc-g4-doorbell). We support all the features of the doorbell including - doorbell rings, two-way audio, and the use of the onboard LCD screen for messages. Two-way audio has caveats you should be aware of.
35
35
 
36
- - **[Two-way audio support](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Doorbell.md#doorbell-twoway) for all UniFi Protect cameras that support it**. Some Protect devices that support two-way audio capabilities include [UniFi Protect Doorbells](https://store.ui.com/collections/unifi-protect/products/uvc-g4-doorbell), the [UniFi Protect Instant Cameras](https://store.ui.com/collections/unifi-protect/products/unifi-video-g3-micro), and more. If the Protect device supports two-way audio, that functionality is available to you in HomeKit.
36
+ - **[Two-way audio support](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Doorbell.md#doorbell-twoway) for all UniFi Protect cameras that support it**. Some Protect devices that support two-way audio capabilities include [UniFi Protect Doorbells](https://store.ui.com/collections/unifi-protect/products/uvc-g4-doorbell), the [UniFi Protect Instant Cameras](https://store.ui.com/collections/unifi-protect/products/unifi-video-g3-micro), and more. If the Protect device supports two-way audio, that functionality is available to you in HomeKit.
37
37
 
38
38
  - **Support for multiple controllers.** This plugin can support multiple UniFi Protect controllers. If you have more than one controller, it's easy to add them to this plugin, and integrate them seamlessly into HomeKit.
39
39
 
40
40
  - **Automatic *continuous* detection and configuration of all UniFi Protect devices.** By default - all of your supported UniFi Protect devices are made available in HomeKit without needing any further configuration on your part. Additionally, if you add or remove cameras or other devices to your UniFi Protect controller, this plugin will autodetect those configuration changes and add or remove those devices in HomeKit, seamlessly, *in realtime*.
41
41
 
42
- - **The ability to [selectively hide and show](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/FeatureOptions.md) specific Protect devices.** For those who only want to show particular devices in HomeKit, or particular controllers, a flexible and intuitive way to configure device availability at a granular level is available.
42
+ - **The ability to [selectively hide and show](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/FeatureOptions.md) specific Protect devices.** For those who only want to show particular devices in HomeKit, or particular controllers, a flexible and intuitive way to configure device availability at a granular level is available.
43
43
 
44
44
  - **Motion detection support using the native realtime notification API.** We use the **native realtime update notification API**, *without having to continuously poll the UniFI Protect controller.* This does a couple of things - first, it provides ***true*** realtime HomeKit rich notifications when motion is detected, including image snapshots. Second, this approach eliminates the requirement to continuously poll every few seconds that most non-native solutions to motion detection on UniFi Protect have used until now and reduces the load on UniFi Protect controllers substantially.
45
45
 
46
46
  - **Motion sensor control from within HomeKit.** By default, all detected cameras have a motion sensor service. An additional motion switch service can be enabled if you want even more granular control: the motion switch allows you to selectively activate and deactivate motion detection of your cameras. This is especially useful in automation scenarios where you wish to activate or deactivate motion detection selectively when you leave your home or arrive home, for example, or to enable specific groups of cameras to turn on and off motion detection through automation.
47
47
 
48
- - **Create scenes or presets for groups of cameras.** If you choose to [create specific liveviews](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Liveviews.md), a security system accessory will appear in HomeKit, enabling you to have motion-detection scenes or presets a tap away. For even more customization, you can create liveview-based switches that will allow you to enable or disable motion detection on groups of cameras. They're easy and intuitive to create and can amplify your user experience in HomeKit.
48
+ - **Create scenes or presets for groups of cameras.** If you choose to [create specific liveviews](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Liveviews.md), a security system accessory will appear in HomeKit, enabling you to have motion-detection scenes or presets a tap away. For even more customization, you can create liveview-based switches that will allow you to enable or disable motion detection on groups of cameras. They're easy and intuitive to create and can amplify your user experience in HomeKit.
49
49
 
50
- - **MQTT support.** [MQTT](https://mqtt.org) support is available for those that want to [make UniFi Protect accessible to an MQTT broker](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/MQTT.md).
50
+ - **MQTT support.** [MQTT](https://mqtt.org) support is available for those that want to [make UniFi Protect accessible to an MQTT broker](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/MQTT.md).
51
51
 
52
52
  ### What's Not In This Plugin Yet
53
53
  Acoustic Echo Cancellation (AEC) support for two-way audio in UniFi Protect. We're most of the way there with two-way audio support, and hopefully AEC support can be reverse-engineered in the future.
54
54
 
55
- I hope to continue to work on this one to get AEC working for two-way audio. [You can also read more on about two-way audio support here](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Doorbell.md#doorbell-twoway).
55
+ I hope to continue to work on this one to get AEC working for two-way audio. [You can also read more on about two-way audio support here](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Doorbell.md#doorbell-twoway).
56
56
 
57
57
  ## Documentation
58
58
  * Getting Started
59
59
  * [Installation](#installation): installing this plugin, including system requirements.
60
60
  * [Plugin Configuration](#plugin-configuration): how to quickly get up and running.
61
- * [Best Practices](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/BestPractices.md): best practices for getting the most of your HomeKit setup and UniFi Protect.
62
- * [Troubleshooting](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Troubleshooting.md): run into login problems or streaming problems? Give this a read.
61
+ * [Best Practices](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/BestPractices.md): best practices for getting the most of your HomeKit setup and UniFi Protect.
62
+ * [Troubleshooting](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Troubleshooting.md): run into login problems or streaming problems? Give this a read.
63
63
  * Advanced Topics
64
- * [Autoconfiguration](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Autoconfiguration.md): what it is, design choices that I've made, and why.
65
- * [Feature Options](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/FeatureOptions.md): granular options to allow you to set the camera quality individually, show or hide specific cameras, controllers, and more.
66
- * [Audio Options](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/AudioOptions.md): options to further tailor how audio is handled from Protect, such as background noise reduction.
67
- * [Doorbells](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Doorbell.md): how UniFi Protect doorbell support works in this plugin, and how to use all the available features including doorbell messages.
68
- * [HomeKit Secure Video](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/HomeKitSecureVideo.md): how HomeKit Secure Video support works in this plugin with UniFi Protect.
69
- * [Liveview Scenes](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Liveviews.md): use the UniFi Protect liveviews feature (available in the UniFi Protect controller webUI) to create motion-detection scenes.
70
- * [MQTT](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/MQTT.md): how to configure MQTT support.
71
- * [Advanced Configuration](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/AdvancedOptions.md): complete list of configuration options available in this plugin.
72
- * [Realtime API Documentation](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/ProtectAPI.md): documentation of how the Ubiquiti realtime updates API works and how to decode the binary protocol.
73
- * [Changelog](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Changelog.md): changes and release history of this plugin, starting with v3.0.
64
+ * [Autoconfiguration](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Autoconfiguration.md): what it is, design choices that I've made, and why.
65
+ * [Feature Options](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/FeatureOptions.md): granular options to allow you to set the camera quality individually, show or hide specific cameras, controllers, and more.
66
+ * [Audio Options](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/AudioOptions.md): options to further tailor how audio is handled from Protect, such as background noise reduction.
67
+ * [Doorbells](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Doorbell.md): how UniFi Protect doorbell support works in this plugin, and how to use all the available features including doorbell messages.
68
+ * [HomeKit Secure Video](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/HomeKitSecureVideo.md): how HomeKit Secure Video support works in this plugin with UniFi Protect.
69
+ * [Liveview Scenes](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Liveviews.md): use the UniFi Protect liveviews feature (available in the UniFi Protect controller webUI) to create motion-detection scenes.
70
+ * [MQTT](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/MQTT.md): how to configure MQTT support.
71
+ * [Advanced Configuration](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/AdvancedOptions.md): complete list of configuration options available in this plugin.
72
+ * [Realtime API Documentation](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/ProtectAPI.md): documentation of how the Ubiquiti realtime updates API works and how to decode the binary protocol.
73
+ * [Changelog](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Changelog.md): changes and release history of this plugin, starting with v3.0.
74
74
 
75
75
  ## Installation
76
76
  If you are new to Homebridge, please first read the [Homebridge](https://homebridge.io) [documentation](https://github.com/homebridge/homebridge/wiki) and installation instructions before proceeding.
@@ -84,7 +84,7 @@ Audio on cameras is tricky in the HomeKit world to begin with, and when you thro
84
84
 
85
85
  * This plugin provides audio on UniFi cameras and doorbells. This includes two-way audio on the [G4 Doorbell](https://store.ui.com/collections/unifi-protect/products/uvc-g4-doorbell), [G3 Micro](https://store.ui.com/collections/unifi-protect/products/unifi-video-g3-micro), and other UniFi Protect devices that support two-way audio.
86
86
 
87
- * There is one notable caveat, currently, with two-way audio: the lack of acoustic echo cancellation, or AEC. [Read more on about two-way audio here](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Doorbell.md#doorbell-twoway).
87
+ * There is one notable caveat, currently, with two-way audio: the lack of acoustic echo cancellation, or AEC. [Read more on about two-way audio here](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Doorbell.md#doorbell-twoway).
88
88
 
89
89
  * **Audio support will not work unless you have a version of ffmpeg that supports fdk-aac.** Unfortunately, most default installations of ffmpeg are not compiled with support for fdk-aac. You'll need to compile or acquire a version of ffmpeg that does. Doing so is beyond the scope of this documentation. There are plenty of guides to this - Google is your friend. This plugin uses [ffmpeg-for-homebridge](https://www.npmjs.com/package/ffmpeg-for-homebridge) which eases the pain somewhat by providing prebuilt static binaries of ffmpeg for certain platforms, and save you the trouble of having to compile a version of ffmpeg yourself.
90
90
 
@@ -107,7 +107,7 @@ Audio on cameras is tricky in the HomeKit world to begin with, and when you thro
107
107
  - **No beta versions of device controller firmware (UCKgen2+, UDM-Pro, UNVR, etc.) are supported by this plugin. You are on your own if you choose to install / run beta firmwares - don't expect support or sympathy if you run into issues.**
108
108
  - **No beta versions of UniFi Protect firmware are supported by this plugin. You are on your own if you choose to install / run beta firmwares - don't expect support or sympathy if you run into issues.**
109
109
  - **No beta or early access versions of UniFi Protect hardware are supported by this plugin. You are on your own if you choose to use non-production/GA hardware - don't expect support or sympathy if you run into issues.**
110
- - **My philosophy is to aggressively adopt the capability and features (that make sense in a HomeKit context) in the latest production / stable Ubiquiti firmware releases and to deprecate old functionality that's been superceded by newer, richer, or more performant capabilities - either by HomeKit or Ubiquiti. Read the [Changelog](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Changelog.md) carefully for the latest information on what's new.**
110
+ - **My philosophy is to aggressively adopt the capability and features (that make sense in a HomeKit context) in the latest production / stable Ubiquiti firmware releases and to deprecate old functionality that's been superceded by newer, richer, or more performant capabilities - either by HomeKit or Ubiquiti. Read the [Changelog](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/docs/Changelog.md) carefully for the latest information on what's new.**
111
111
  - ***For extra clarity and to reiterate the above - before you install this plugin, make sure you are on the latest production / stable controller platform firmware and the latest production / stable UniFi Protect firmware.***
112
112
 
113
113
  ## Plugin Configuration
@@ -135,7 +135,7 @@ You can use your Ubiquiti account credentials, though 2FA is not currently suppo
135
135
  ## Plugin Development Dashboard
136
136
  This is mostly of interest to the true developer nerds amongst us.
137
137
 
138
- [![License](https://img.shields.io/npm/l/homebridge-unifi-protect?color=%230559C9&logo=open%20source%20initiative&logoColor=%23FFFFFF&style=for-the-badge)](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/LICENSE.md)
138
+ [![License](https://img.shields.io/npm/l/homebridge-unifi-protect?color=%230559C9&logo=open%20source%20initiative&logoColor=%23FFFFFF&style=for-the-badge)](https://github.com/hjdhjd/homebridge-unifi-protect/blob/main/LICENSE.md)
139
139
  [![Build Status](https://img.shields.io/github/workflow/status/hjdhjd/homebridge-unifi-protect/Continuous%20Integration?color=%230559C9&logo=github-actions&logoColor=%23FFFFFF&style=for-the-badge)](https://github.com/hjdhjd/homebridge-unifi-protect/actions?query=workflow%3A%22Continuous+Integration%22)
140
140
  [![Dependencies](https://img.shields.io/librariesio/release/npm/homebridge-unifi-protect?color=%230559C9&logo=dependabot&style=for-the-badge)](https://libraries.io/npm/homebridge-unifi-protect)
141
141
  [![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/hjdhjd/homebridge-unifi-protect/latest?color=%230559C9&logo=github&sort=semver&style=for-the-badge)](https://github.com/hjdhjd/homebridge-unifi-protect/commits/master)
@@ -171,7 +171,7 @@
171
171
  "title": "Video Encoder",
172
172
  "required": false,
173
173
  "placeholder": "e.g. h264_omx",
174
- "description": "FFmpeg video encoder to use for transcoding. Useful for hardware-accelerated video encoding such as on a Raspberry Pi. Default: libx264."
174
+ "description": "FFmpeg video encoder to use for transcoding. Useful for hardware-accelerated video encoding such as on a Raspberry Pi. This option is provided with no support. Many hardware video encoders are notorious for producing bad video quality, errors and other artifacts. Default: libx264."
175
175
  },
176
176
 
177
177
  "videoProcessor": {
@@ -1,15 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProtectAccessory = exports.ProtectBase = exports.PROTECT_SWITCH_MOTION_TRIGGER = exports.PROTECT_SWITCH_MOTION_SENSOR = exports.PROTECT_SWITCH_HKSV_RECORDING = exports.PROTECT_SWITCH_DOORBELL_TRIGGER = exports.PROTECT_CONTACT_SENSOR_ALARM_SOUND = exports.PROTECT_CONTACT_SENSOR = exports.PROTECT_CONTACT_MOTION_SMARTDETECT = void 0;
4
- // Manage our contact sensor types.
5
- exports.PROTECT_CONTACT_MOTION_SMARTDETECT = "ContactMotionSmartDetect";
6
- exports.PROTECT_CONTACT_SENSOR = "ContactSensor";
7
- exports.PROTECT_CONTACT_SENSOR_ALARM_SOUND = "ContactAlarmSound";
8
- // Manage our switch types.
9
- exports.PROTECT_SWITCH_DOORBELL_TRIGGER = "DoorbellTrigger";
10
- exports.PROTECT_SWITCH_HKSV_RECORDING = "HKSVRecordingSwitch";
11
- exports.PROTECT_SWITCH_MOTION_SENSOR = "MotionSensorSwitch";
12
- exports.PROTECT_SWITCH_MOTION_TRIGGER = "MotionSensorTrigger";
3
+ exports.ProtectAccessory = exports.ProtectBase = exports.ProtectReservedNames = void 0;
4
+ var ProtectReservedNames;
5
+ (function (ProtectReservedNames) {
6
+ // Manage our contact sensor types.
7
+ ProtectReservedNames["CONTACT_MOTION_SMARTDETECT"] = "ContactMotionSmartDetect";
8
+ ProtectReservedNames["CONTACT_SENSOR"] = "ContactSensor";
9
+ ProtectReservedNames["CONTACT_SENSOR_ALARM_SOUND"] = "ContactAlarmSound";
10
+ // Manage our switch types.
11
+ ProtectReservedNames["SWITCH_DOORBELL_TRIGGER"] = "DoorbellTrigger";
12
+ ProtectReservedNames["SWITCH_DYNAMIC_BITRATE"] = "DynamicBitrate";
13
+ ProtectReservedNames["SWITCH_HKSV_RECORDING"] = "HKSVRecordingSwitch";
14
+ ProtectReservedNames["SWITCH_MOTION_SENSOR"] = "MotionSensorSwitch";
15
+ ProtectReservedNames["SWITCH_MOTION_TRIGGER"] = "MotionSensorTrigger";
16
+ ProtectReservedNames["SWITCH_UFP_RECORDING_ALWAYS"] = "UFPRecordingSwitch.always";
17
+ ProtectReservedNames["SWITCH_UFP_RECORDING_DETECTIONS"] = "UFPRecordingSwitch.detections";
18
+ ProtectReservedNames["SWITCH_UFP_RECORDING_NEVER"] = "UFPRecordingSwitch.never";
19
+ })(ProtectReservedNames = exports.ProtectReservedNames || (exports.ProtectReservedNames = {}));
13
20
  class ProtectBase {
14
21
  // The constructor initializes key variables and calls configureDevice().
15
22
  constructor(nvr) {
@@ -76,10 +83,11 @@ class ProtectAccessory extends ProtectBase {
76
83
  // Configure the Protect motion sensor for HomeKit.
77
84
  configureMotionSensor(isEnabled = true) {
78
85
  var _a, _b;
86
+ const device = this.accessory.context.device;
79
87
  // Find the motion sensor service, if it exists.
80
88
  let motionService = this.accessory.getService(this.hap.Service.MotionSensor);
81
89
  // Have we disabled motion sensors?
82
- if (!isEnabled || !((_a = this.nvr) === null || _a === void 0 ? void 0 : _a.optionEnabled(this.accessory.context.device, "Motion.Sensor"))) {
90
+ if (!isEnabled || !((_a = this.nvr) === null || _a === void 0 ? void 0 : _a.optionEnabled(device, "Motion.Sensor"))) {
83
91
  if (motionService) {
84
92
  this.accessory.removeService(motionService);
85
93
  (_b = this.nvr.mqtt) === null || _b === void 0 ? void 0 : _b.unsubscribe(this.accessory, "motion/trigger");
@@ -87,29 +95,31 @@ class ProtectAccessory extends ProtectBase {
87
95
  }
88
96
  return false;
89
97
  }
90
- // The motion sensor has already been configured.
91
- if (motionService) {
92
- // Initialize the state of the motion sensor.
93
- motionService.updateCharacteristic(this.hap.Characteristic.MotionDetected, false);
94
- this.configureMqttMotionTrigger();
95
- return true;
96
- }
97
- // We don't have it, add the motion sensor to the camera.
98
- motionService = new this.hap.Service.MotionSensor(this.accessory.displayName);
98
+ // We don't have a motion sensor, let's add it to the camera.
99
99
  if (!motionService) {
100
- this.log.error("%s: Unable to add motion sensor.", this.name());
101
- return false;
100
+ // We don't have it, add the motion sensor to the camera.
101
+ motionService = new this.hap.Service.MotionSensor(this.accessory.displayName);
102
+ if (!motionService) {
103
+ this.log.error("%s: Unable to add motion sensor.", this.name());
104
+ return false;
105
+ }
106
+ this.accessory.addService(motionService);
107
+ this.log.info("%s: Enabling motion sensor.", this.name());
102
108
  }
103
- this.accessory.addService(motionService);
109
+ // Initialize the state of the motion sensor.
110
+ motionService.updateCharacteristic(this.hap.Characteristic.MotionDetected, false);
111
+ motionService.updateCharacteristic(this.hap.Characteristic.StatusActive, device.state === "CONNECTED");
112
+ motionService.getCharacteristic(this.hap.Characteristic.StatusActive).onGet(() => {
113
+ return this.accessory.context.device.state === "CONNECTED";
114
+ });
104
115
  this.configureMqttMotionTrigger();
105
- this.log.info("%s: Enabling motion sensor.", this.name());
106
116
  return true;
107
117
  }
108
118
  // Configure a switch to easily activate or deactivate motion sensor detection for HomeKit.
109
119
  configureMotionSwitch() {
110
120
  var _a, _b, _c;
111
121
  // Find the switch service, if it exists.
112
- let switchService = this.accessory.getServiceById(this.hap.Service.Switch, exports.PROTECT_SWITCH_MOTION_SENSOR);
122
+ let switchService = this.accessory.getServiceById(this.hap.Service.Switch, ProtectReservedNames.SWITCH_MOTION_SENSOR);
113
123
  // Have we disabled motion sensors or the motion switch? Motion switches are disabled by default.
114
124
  if (!((_a = this.nvr) === null || _a === void 0 ? void 0 : _a.optionEnabled(this.accessory.context.device, "Motion.Sensor")) ||
115
125
  !((_b = this.nvr) === null || _b === void 0 ? void 0 : _b.optionEnabled(this.accessory.context.device, "Motion.Switch", false))) {
@@ -123,7 +133,7 @@ class ProtectAccessory extends ProtectBase {
123
133
  this.log.info("%s: Enabling motion sensor switch.", this.name());
124
134
  // Add the switch to the camera, if needed.
125
135
  if (!switchService) {
126
- switchService = new this.hap.Service.Switch(this.accessory.displayName + " Motion Events", exports.PROTECT_SWITCH_MOTION_SENSOR);
136
+ switchService = new this.hap.Service.Switch(this.accessory.displayName + " Motion Events", ProtectReservedNames.SWITCH_MOTION_SENSOR);
127
137
  if (!switchService) {
128
138
  this.log.error("%s: Unable to add motion sensor switch.", this.name());
129
139
  return false;
@@ -162,16 +172,7 @@ class ProtectAccessory extends ProtectBase {
162
172
  }
163
173
  // Utility function for reserved identifiers for switches.
164
174
  isReservedName(name) {
165
- return name === undefined ? false :
166
- [
167
- exports.PROTECT_CONTACT_MOTION_SMARTDETECT.toUpperCase(),
168
- exports.PROTECT_SWITCH_DOORBELL_TRIGGER.toUpperCase(),
169
- exports.PROTECT_SWITCH_HKSV_RECORDING.toUpperCase(),
170
- exports.PROTECT_SWITCH_MOTION_SENSOR.toUpperCase(),
171
- exports.PROTECT_SWITCH_MOTION_TRIGGER.toUpperCase(),
172
- exports.PROTECT_CONTACT_SENSOR.toUpperCase(),
173
- exports.PROTECT_CONTACT_SENSOR_ALARM_SOUND.toUpperCase()
174
- ].includes(name.toUpperCase());
175
+ return name === undefined ? false : Object.values(ProtectReservedNames).map(x => x.toUpperCase()).includes(name.toUpperCase());
175
176
  }
176
177
  // Utility function to return the fully enumerated name of this camera.
177
178
  name() {
@@ -1 +1 @@
1
- {"version":3,"file":"protect-accessory.js","sourceRoot":"","sources":["../src/protect-accessory.ts"],"names":[],"mappings":";;;AAgBA,mCAAmC;AACtB,QAAA,kCAAkC,GAAG,0BAA0B,CAAC;AAChE,QAAA,sBAAsB,GAAG,eAAe,CAAC;AACzC,QAAA,kCAAkC,GAAG,mBAAmB,CAAC;AAEtE,2BAA2B;AACd,QAAA,+BAA+B,GAAG,iBAAiB,CAAC;AACpD,QAAA,6BAA6B,GAAG,qBAAqB,CAAC;AACtD,QAAA,4BAA4B,GAAG,oBAAoB,CAAC;AACpD,QAAA,6BAA6B,GAAG,qBAAqB,CAAC;AAOnE,MAAsB,WAAW;IAU/B,yEAAyE;IACzE,YAAY,GAAe;QAEzB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC/B,CAAC;IAED,uDAAuD;IAC7C,OAAO,CAAC,SAA4B,EAAE,MAA0D;;QAExG,yCAAyC;QACzC,IAAG,CAAC,MAAM,EAAE;YACV,OAAO,KAAK,CAAC;SACd;QAED,uDAAuD;QACvD,MAAA,SAAS;aACN,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,oBAAoB,CAAC,0CAChD,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,C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