Socket
Socket
Sign inDemoInstall

homebridge-nest-cam2

Package Overview
Dependencies
4
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0-beta.3 to 2.1.0-test.1

8

dist/index.js

@@ -69,2 +69,3 @@ "use strict";

}
// Set up the config if options are not set
const googleAuth = config['googleAuth'];

@@ -95,2 +96,6 @@ const options = config['options'];

}
const alertTypes = config.options['alertTypes'];
if (typeof alertTypes === 'undefined') {
config.options.alertTypes = ['motion'];
}
}

@@ -180,3 +185,3 @@ api.on("didFinishLaunching" /* DID_FINISH_LAUNCHING */, this.didFinishLaunching.bind(this));

// Add doorbell service
if (camera.detectors.includes('doorbellPress') && this.doorbellAlerts) {
if (camera.capabilities.includes('indoor_chime') && this.doorbellAlerts) {
const doorbell = new hap.Service.Doorbell('Doorbell');

@@ -260,2 +265,3 @@ accessory.addService(doorbell);

if (!response.items.find((x) => x.uuid === accessory.context.cameraInfo.uuid)) {
accessory.context.removed = true;
this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);

@@ -262,0 +268,0 @@ }

51

dist/nestcam.js

@@ -19,2 +19,5 @@ "use strict";

this.softwareVersion = '';
this.detectors = [];
this.capabilities = [];
this.alertTypes = ['motion'];
this.type = -1;

@@ -26,5 +29,5 @@ this.nexusTalkHost = '';

this.config = config;
this.alertTypes = config.options.alertTypes;
this.endpoints = new nest_endpoints_1.NestEndpoints(config.options.fieldTest);
this.setAttributes(info);
this.motionDetected = false;
}

@@ -44,3 +47,3 @@ async updateInfo() {

if (error.response) {
this.log.debug(`Error updating camera info: ${error.response.status}`);
this.log.error(`Error updating camera info: ${error.response.status}`);
}

@@ -58,3 +61,4 @@ else {

this.softwareVersion = info.combined_software_version;
this.detectors = info.detectors;
this.detectors = info.all_detectors;
this.capabilities = info.capabilities;
this.type = info.type;

@@ -83,3 +87,3 @@ this.nexusTalkHost = info.direct_nexustalk_host;

async checkAlerts(accessory) {
this.log.debug(`Checking for motion on ${accessory.displayName}`);
this.log.debug(`Checking for alerts on ${accessory.displayName}`);
try {

@@ -92,14 +96,18 @@ const currDate = new Date();

});
const response = await this.endpoints.sendRequest(this.config.access_token, this.apiHost, `/cuepoint/${this.uuid}/2?${query}`, 'GET');
if (response.length > 0) {
for (let i = 0; i < response.length; i++) {
const trigger = response[i];
if (trigger.is_important && trigger.types.includes('doorbell') && !this.doorbellRang) {
this.triggerDoorbell(accessory);
break;
if (!accessory.context.removed) {
const response = await this.endpoints.sendRequest(this.config.access_token, this.apiHost, `/cuepoint/${this.uuid}/2?${query}`, 'GET');
if (response.length > 0) {
for (let i = 0; i < response.length; i++) {
const trigger = response[i];
if (trigger.is_important && trigger.types.includes('doorbell') && !this.doorbellRang) {
this.triggerDoorbell(accessory);
break;
}
// Check the intersection between user defined alert types and received alerts
const intersection = this.alertTypes.filter((type) => trigger.types.includes(type));
if (trigger.is_important && intersection.length > 0 && !this.motionDetected) {
this.triggerMotion(accessory);
break;
}
}
if (trigger.is_important && trigger.types.includes('motion') && !this.motionDetected) {
this.triggerMotion(accessory);
break;
}
}

@@ -110,3 +118,3 @@ }

if (error.response) {
this.log.debug(`Error checking alerts: ${error.response.status}`);
this.log.error(`Error checking alerts: ${error.response.status}`);
}

@@ -138,16 +146,13 @@ else {

const self = this; // eslint-disable-line @typescript-eslint/no-this-alias
this.setDoorbell(accessory, true);
this.setDoorbell(accessory);
this.doorbellRang = true;
setTimeout(async function () {
self.setDoorbell(accessory, false);
}, ALERT_LENGTH);
setTimeout(async function () {
self.doorbellRang = false;
}, ALERT_COOLDOWN);
}
setDoorbell(accessory, state) {
this.log.debug(`Setting ${accessory.displayName} Doorbell to ${state}`);
setDoorbell(accessory) {
this.log.debug(`Ringing ${accessory.displayName} Doorbell`);
const service = accessory.getService(this.hap.Service.Doorbell);
if (service) {
service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, state);
service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
}

@@ -154,0 +159,0 @@ }

{
"name": "homebridge-nest-cam2",
"version": "2.1.0-beta.3",
"version": "2.1.0-test.1",
"description": "Nest cam plugin for homebridge: https://homebridge.io/",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc