diff --git a/.dockerignore b/.dockerignore index 3128f48..3f14f52 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ node_modules npm-debug.log -config.json \ No newline at end of file +config.json +.DS_Store diff --git a/.gitignore b/.gitignore index 9b12685..32967b5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules .eslintrc.json config.json.sample +.DS_Store diff --git a/README.md b/README.md index 4384ee5..cc32201 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This script leverages the excellent [ring-client-api](https://github.com/dgreif/ring) to provide a bridge between MQTT and suppoted Ring devices such as alarm control panel, lights and cameras ([full list of supported devices and features](#current-features)). It also provides support for Home Assistant style MQTT auto-discovery which allows for easy Home Assistant integration with minimal configuration (requires Home Assistant MQTT integration to be enabled). This also includes an optional [Home Assistant Addon](https://github.com/tsightler/ring-mqtt-ha-addon) for users of HassOS/Home Assistant Installer. It can also be used with any other tool capable of working with MQTT as it provides consistent topic naming based on location/device ID. ## !!! Important Notices - Please Read !!! -If you are upgrading from ring-mqtt prior to version 4.0.0, or from Home Assistant versions < 0.113, please read the approciate section in [docs/NOTICES.md](docs/NOTICES.md) +If you are upgrading from ring-mqtt prior to version 4.0.0, or from Home Assistant versions < 0.113, please read the appropriate section in [docs/NOTICES.md](docs/NOTICES.md) ## Installation Starting with the 4.0.0 release of ring-mqtt, Docker is now the recommended installation method, however, standard, non-Docker installation is still fully supported. Please skip to the [Standard Install](#standard-install) section for details on this installation method. diff --git a/devices/alarm-device.js b/devices/alarm-device.js index f038797..5b3877e 100644 --- a/devices/alarm-device.js +++ b/devices/alarm-device.js @@ -143,14 +143,14 @@ class AlarmDevice { ... this.device.data.batteryStatus && this.device.data.batteryStatus !== 'none' ? { batteryStatus: this.device.data.batteryStatus } : {}, - ... this.device.data.hasOwnProperty('brightness') ? {brightness: this.device.data.brightness } : {}, + ... this.device.data.hasOwnProperty('brightness') ? { brightness: this.device.data.brightness } : {}, ... this.device.data.chirps && this.device.deviceType == 'security-keypad' ? {chirps: this.device.data.chirps } : {}, ... this.device.data.commStatus ? { commStatus: this.device.data.commStatus } : {}, ... this.device.data.firmwareUpdate ? { firmwareStatus: this.device.data.firmwareUpdate.state } : {}, ... this.device.data.lastCommTime ? { lastCommTime: utils.getISOTime(this.device.data.lastUpdate) } : {}, ... this.device.data.lastUpdate ? { lastUpdate: utils.getISOTime(this.device.data.lastUpdate) } : {}, ... this.device.data.linkQuality ? { linkQuality: this.device.data.linkQuality } : {}, - ... this.device.data.powerSave ? {powerSave: this.device.data.powerSave } : {}, + ... this.device.data.powerSave ? { powerSave: this.device.data.powerSave } : {}, ... this.device.data.serialNumber ? { serialNumber: this.device.data.serialNumber } : {}, ... this.device.data.tamperStatus ? { tamperStatus: this.device.data.tamperStatus } : {}, ... this.device.data.hasOwnProperty('volume') ? {volume: this.device.data.volume } : {}, diff --git a/devices/camera.js b/devices/camera.js index 4e640b7..e78a2b1 100644 --- a/devices/camera.js +++ b/devices/camera.js @@ -1,6 +1,6 @@ const debug = require('debug')('ring-mqtt') const utils = require( '../lib/utils' ) -const clientApi = require('../node_modules/ring-client-api/lib/api/rest-client').clientApi +const clientApi = require('../node_modules/@tsightler/ring-client-api/lib/api/rest-client').clientApi const P2J = require('pipe2jpeg') const net = require('net'); const getPort = require('get-port') @@ -9,6 +9,7 @@ class Camera { constructor(deviceInfo) { // Set default properties for camera device object model this.camera = deviceInfo.device + this.mqttClient = deviceInfo.mqttClient this.subscribed = false this.availabilityState = 'init' @@ -28,6 +29,7 @@ class Camera { timestamp: null, updating: null } + if (this.config.snapshot_mode === "motion" || this.config.snapshot_mode === "interval" || this.config.snapshot_mode === "all" ) { this.snapshot.motion = (this.config.snapshot_mode === "motion" || this.config.snapshot_mode === "all") ? true : false @@ -63,7 +65,7 @@ class Camera { mdl: this.camera.model } - // Set device location and top level MQTT topics + // Create top level MQTT topics this.cameraTopic = deviceInfo.CONFIG.ring_topic+'/'+this.locationId+'/camera/'+this.deviceId this.availabilityTopic = this.cameraTopic+'/status' @@ -88,77 +90,26 @@ class Camera { last_ding_time: 'none' } } + + // Properties to store state published to MQTT + // Used to keep from sending state updates on every poll (20 seconds) + if (this.camera.hasLight) { + this.publishedLightState = 'unknown' + } + + if (this.camera.hasSiren) { + this.publishedSirenState = 'unknown' + } + + this.publishedMotionDetectionStatus = 'unkown' } // Publish camera capabilities and state and subscribe to events async publish() { const debugMsg = (this.availabilityState === 'init') ? 'Publishing new ' : 'Republishing existing ' - debug(debugMsg+'device id: '+this.deviceId) - // Publish motion sensor feature for camera - this.publishCapability({ - type: 'motion', - component: 'binary_sensor', - className: 'motion', - suffix: 'Motion', - attributes: true, - command: false - }) - - // If doorbell publish doorbell sensor - if (this.camera.isDoorbot) { - this.publishCapability({ - type: 'ding', - component: 'binary_sensor', - className: 'occupancy', - suffix: 'Ding', - attributes: true, - command: false - }) - } - - // If camera has a light publish light component - if (this.camera.hasLight) { - this.publishCapability({ - type: 'light', - component: 'light', - suffix: 'Light', - attributes: false, - command: 'command' - }) - } - - // If camera has a siren publish switch component - if (this.camera.hasSiren) { - this.publishCapability({ - type: 'siren', - component: 'switch', - suffix: 'Siren', - attributes: false, - command: 'command' - }) - } - - // Publish info sensor for camera - this.publishCapability({ - type: 'info', - component: 'sensor', - suffix: 'Info', - attributes: false, - command: false - }) - - // If snapshots enabled, publish snapshot capability - if (this.snapshot.motion || this.snapshot.interval) { - this.publishCapability({ - type: 'snapshot', - component: 'camera', - suffix: 'Snapshot', - attributes: true, - command: 'interval' - }) - } + await this.publishCapabilities() // Give Home Assistant time to configure device before sending first state data await utils.sleep(2) @@ -227,66 +178,140 @@ class Camera { } } - // Publish state messages via MQTT with optional debug - publishMqtt(topic, message, enableDebug) { - if (enableDebug) debug(topic, message) - this.mqttClient.publish(topic, message, { qos: 1 }) + publishCapabilities() { + // Publish motion sensor feature for camera + this.publishCapability({ + component: 'binary_sensor', + suffix: 'Motion', + className: 'motion', + attributes: true, + command: false + }) + + // Publish info around the motion detection on/off + this.publishCapability({ + component: 'switch', + suffix: 'Motion Detection', + attributes: false, + command: true + }) + + // Publish info sensor for camera + this.publishCapability({ + component: 'sensor', + suffix: 'Info', + attributes: false, + command: false + }) + + // If doorbell publish doorbell sensor + if (this.camera.isDoorbot) { + this.publishCapability({ + component: 'binary_sensor', + suffix: 'Ding', + className: 'occupancy', + attributes: true, + command: false + }) + } + + // If camera has a light publish light component + if (this.camera.hasLight) { + this.publishCapability({ + component: 'light', + suffix: 'Light', + attributes: false, + command: true + }) + } + + // If camera has a siren publish switch component + if (this.camera.hasSiren) { + this.publishCapability({ + component: 'switch', + suffix: 'Siren', + attributes: false, + command: true + }) + } + + // If snapshots enabled, publish snapshot capability + if (this.snapshot.motion || this.snapshot.interval) { + this.publishCapability({ + component: 'camera', + suffix: 'Snapshot', + attributes: true, + command: false + }) + + this.publishCapability({ + component: 'number', + suffix: 'Snapshot Interval', + attributes: false, + command: true + }) + } } // Build and publish a Home Assistant MQTT discovery packet for camera capability async publishCapability(capability) { - const componentTopic = this.cameraTopic+'/'+capability.type - const configTopic = 'homeassistant/'+capability.component+'/'+this.locationId+'/'+this.deviceId+'_'+capability.type+'/config' + const capabilityType = capability.suffix.toLowerCase().replace(" ","_") + const capabilityTopic = this.cameraTopic+'/'+capabilityType + const configTopic = 'homeassistant/'+capability.component+'/'+this.locationId+'/'+this.deviceId+'_'+capabilityType+'/config' const message = { name: this.camera.name+' '+capability.suffix, - unique_id: this.deviceId+'_'+capability.type, + unique_id: this.deviceId+'_'+capabilityType, availability_topic: this.availabilityTopic, payload_available: 'online', - payload_not_available: 'offline' + payload_not_available: 'offline', + device: this.deviceData, + ... capability.attributes ? { json_attributes_topic: capabilityTopic+'/attributes' } : {}, + ... capability.className ? { device_class: capability.className } : {}, + ... capability.command ? { command_topic: capabilityTopic+'/command' } : {} } - if (capability.type === 'snapshot') { - message.topic = componentTopic+'/image' - } else { - message.state_topic = componentTopic+'/state' - } - - if (capability.attributes) { message.json_attributes_topic = componentTopic+'/attributes' } - if (capability.className) { message.device_class = capability.className } - + // Subscribe to command topic if required if (capability.command) { - if (capability.type !== 'snapshot') { - message.command_topic = componentTopic+'/'+capability.command - } - this.mqttClient.subscribe(componentTopic+'/'+capability.command) + this.mqttClient.subscribe(capabilityTopic+'/command') } - // Set the primary state value for info sensors based on power (battery/wired) - // and connectivity (Wifi/ethernet) - if (capability.type === 'info') { - message.json_attributes_topic = componentTopic+'/state' - message.icon = 'mdi:information-outline' - const deviceHealth = await Promise.race([this.camera.getHealth(), utils.sleep(5)]).then(function(result) { return result; }) - if (deviceHealth) { - if (deviceHealth.network_connection && deviceHealth.network_connection === 'ethernet') { - message.value_template = '{{value_json["wiredNetwork"]}}' - } else { - // Device is connected via wifi, track that as primary - message.value_template = '{{value_json["wirelessSignal"]}}' - message.unit_of_measurement = 'RSSI' + switch (capabilityType) { + case 'info': + // Set the primary state value for info sensors based on power (battery/wired) + // and connectivity (Wifi/ethernet) + message.state_topic = capabilityTopic+'/state' + message.json_attributes_topic = capabilityTopic+'/state' + message.icon = 'mdi:information-outline' + const deviceHealth = await Promise.race([this.camera.getHealth(), utils.sleep(5)]).then(function(result) { return result; }) + if (deviceHealth) { + if (deviceHealth.network_connection && deviceHealth.network_connection === 'ethernet') { + message.value_template = '{{value_json["wiredNetwork"]}}' + } else { + // Device is connected via wifi, track that as primary + message.value_template = '{{value_json["wirelessSignal"]}}' + message.unit_of_measurement = 'RSSI' + } } - } + break; + case 'snapshot': + message.topic = capabilityTopic+'/image' + break; + default: + message.state_topic = capabilityTopic+'/state' } - // Add device data for Home Assistant device registry - message.device = this.deviceData - debug('HASS config topic: '+configTopic) debug(message) this.mqttClient.publish(configTopic, JSON.stringify(message), { qos: 1 }) } + // Publish state messages via MQTT with optional debug + publishMqtt(topic, message, enableDebug) { + if (enableDebug) debug(topic, message) + this.mqttClient.publish(topic, message, { qos: 1 }) + } + // Process a ding event async processDing(ding) { // Is it a motion or doorbell ding? (for others we do nothing) @@ -381,6 +406,15 @@ class Camera { } } + if (this.camera.data && this.camera.data.settings && typeof this.camera.data.settings.motion_detection_enabled !== 'undefined') { + const stateTopic = this.cameraTopic+'/motion_detection/state' + const motionDetectionStatus = this.camera.data.settings.motion_detection_enabled === true ? 'ON' : 'OFF' + if (motionDetectionStatus !== this.publishedMotionDetectionStatus) { + this.publishMqtt(stateTopic, motionDetectionStatus, true) + this.publishedMotionDetectionStatus = motionDetectionStatus + } + } + // Update snapshot frequency in case it's changed if (this.snapshot.autoInterval && this.camera.data.settings.hasOwnProperty('lite_24x7')) { this.snapshot.interval = this.camera.data.settings.lite_24x7.frequency_secs diff --git a/devices/security-panel.js b/devices/security-panel.js index 6b337c4..3df52fa 100644 --- a/devices/security-panel.js +++ b/devices/security-panel.js @@ -1,8 +1,8 @@ const debug = require('debug')('ring-mqtt') const utils = require( '../lib/utils' ) const AlarmDevice = require('./alarm-device') -const alarmStates = require('ring-client-api').allAlarmStates -const RingDeviceType = require('ring-client-api').RingDeviceType +const alarmStates = require('@tsightler/ring-client-api').allAlarmStates +const RingDeviceType = require('@tsightler/ring-client-api').RingDeviceType class SecurityPanel extends AlarmDevice { constructor(deviceInfo) { diff --git a/lib/tokenapp.js b/lib/tokenapp.js index bcb7c4d..0003350 100644 --- a/lib/tokenapp.js +++ b/lib/tokenapp.js @@ -1,4 +1,4 @@ -const RingRestClient = require('../node_modules/ring-client-api/lib/api/rest-client').RingRestClient +const RingRestClient = require('../node_modules/@tsightler/ring-client-api/lib/api/rest-client').RingRestClient const debug = require('debug')('ring-mqtt') const colors = require('colors/safe') const express = require('express') diff --git a/package-lock.json b/package-lock.json index 35cbfb6..2ab1143 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ring-mqtt", - "version": "4.5.5", + "version": "4.5.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -72,21 +72,26 @@ } }, "@homebridge/camera-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@homebridge/camera-utils/-/camera-utils-2.0.1.tgz", - "integrity": "sha512-s3KA7zKis2QxlB1gLLPRwfbEb5iPLL5iBR7VgpEIRIyfMfJsF5v4vNP9J56gYWYFRPPZvVU+3MEb1XeOSkUleA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@homebridge/camera-utils/-/camera-utils-2.0.2.tgz", + "integrity": "sha512-MdgL46CxxhP7Fgs35qWZTEHnMNcEI1elLf5C6152dQmnznJ89vfqVZjDCO/W2qsGpms8soni/padRMaftPxTHA==", "requires": { "execa": "^5.0.0", "ffmpeg-for-homebridge": "^0.0.9", "pick-port": "^1.0.0", - "rxjs": "^7.0.0", - "systeminformation": "^5.6.12" + "rxjs": "^7.0.1", + "systeminformation": "^5.6.21" } }, + "@leichtgewicht/ip-codec": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.2.tgz", + "integrity": "sha512-PjsLKLzJ0jWM1iM4xdYkrMyonAHP4kHGiXm81FRNfcnjToQA9UOknwZE28bxq0AGmEAMVBPSuuHurzla2wyYyA==" + }, "@sindresorhus/is": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.0.tgz", - "integrity": "sha512-FyD2meJpDPjyNQejSjvnhpgI/azsQkA4lGbuu5BQZfjvJ9cbRZXzeWL2HceCekW4lixO9JPesIIQkSoLjeJHNQ==" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz", + "integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g==" }, "@szmarczak/http-timer": { "version": "4.0.5", @@ -96,10 +101,43 @@ "defer-to-connect": "^2.0.0" } }, + "@tsightler/ring-client-api": { + "version": "9.18.1-custom.2", + "resolved": "https://registry.npmjs.org/@tsightler/ring-client-api/-/ring-client-api-9.18.1-custom.2.tgz", + "integrity": "sha512-VNP5BuwVluOHaeeFVUiKAU3GLb4lPpI7eQzU9LDY2+mpFLYvcmMOsvZBbbqzYBNnksvpXHNtNmFAJtYZXw3okw==", + "requires": { + "@homebridge/camera-utils": "2.0.2", + "colors": "1.4.0", + "debug": "4.3.1", + "got": "11.8.2", + "rxjs": "7.1.0", + "sdp": "3.0.2", + "sip": "0.0.6", + "socket.io-client": "2.4.0", + "stun": "2.1.0", + "systeminformation": "5.7.6", + "uuid": "8.3.2" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, "@types/cacheable-request": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.1.tgz", - "integrity": "sha512-ykFq2zmBGOCbpIXtoVbz4SKY5QriWPh3AjyU4G74RYbtt5yOc5OfaY75ftjg7mikMOla1CTGpX3lLbuJh8DTrQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz", + "integrity": "sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA==", "requires": { "@types/http-cache-semantics": "*", "@types/keyv": "*", @@ -108,22 +146,22 @@ } }, "@types/http-cache-semantics": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz", - "integrity": "sha512-c3Xy026kOF7QOTn00hbIllV1dLR9hG9NkSrLQgCVs8NF6sBU+VGWjD3wLPhmh1TYAc7ugCFsvHYMN4VcBN1U1A==" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" }, "@types/keyv": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.1.tgz", - "integrity": "sha512-MPtoySlAZQ37VoLaPcTHCu1RWJ4llDkULYZIzOYxlhxBqYPB0RsRlmMU0R6tahtFe27mIdkHV+551ZWV4PLmVw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.2.tgz", + "integrity": "sha512-/FvAK2p4jQOaJ6CGDHJTqZcUtbZe820qIeTg7o0Shg7drB4JHeL+V/dhSaly7NXx6u8eSee+r7coT+yuJEvDLg==", "requires": { "@types/node": "*" } }, "@types/node": { - "version": "14.14.34", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.34.tgz", - "integrity": "sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA==" + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.3.1.tgz", + "integrity": "sha512-N87VuQi7HEeRJkhzovao/JviiqKjDKMVKxKMfUvSKw+MbkbW8R0nA3fi/MQhhlxV2fQ+2ReM+/Nt4efdrJx3zA==" }, "@types/responselike": { "version": "1.0.0", @@ -361,17 +399,24 @@ "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==" }, "cacheable-request": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.1.tgz", - "integrity": "sha512-lt0mJ6YAnsrBErpTMWeu5kl/tg9xMAWjavYTN6VQXM1A/teBITuNcccXsCxF0tDQQJf9DfAaX5O4e0zp0KlfZw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", + "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", "requires": { "clone-response": "^1.0.2", "get-stream": "^5.1.0", "http-cache-semantics": "^4.0.0", "keyv": "^4.0.0", "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", + "normalize-url": "^6.0.1", "responselike": "^2.0.0" + }, + "dependencies": { + "normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==" + } } }, "call-bind": { @@ -383,39 +428,6 @@ "get-intrinsic": "^1.0.2" } }, - "callback-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/callback-stream/-/callback-stream-1.1.0.tgz", - "integrity": "sha1-RwGlEmbwbgbqpx/BcjOCLYdfSQg=", - "requires": { - "inherits": "^2.0.1", - "readable-stream": "> 1.0.0 < 3.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -596,11 +608,6 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -620,9 +627,9 @@ } }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "requires": { "ms": "2.1.2" }, @@ -702,19 +709,19 @@ "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" }, "dns-packet": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.2.1.tgz", - "integrity": "sha512-JHj2yJeKOqlxzeuYpN1d56GfhzivAxavNwHj9co3qptECel27B1rLY5PifJAvubsInX5pGLDjAHuCfCUc2Zv/w==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.3.0.tgz", + "integrity": "sha512-Nce7YLu6YCgWRvOmDBsJMo9M5/jV3lEZ5vUWnWXYmwURvPylHvq7nkDWhNmk1ZQoZZOP7oQh/S0lSxbisKOfHg==", "requires": { - "ip": "^1.1.5" + "@leichtgewicht/ip-codec": "^2.0.1" } }, "dns-socket": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/dns-socket/-/dns-socket-4.2.1.tgz", - "integrity": "sha512-fNvDq86lS522+zMbh31X8cQzYQd6xumCNlxsuZF5TKxQThF/e+rJbVM6K8mmlsdcSm6yNjKJQq3Sf38viAJj8g==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/dns-socket/-/dns-socket-4.2.2.tgz", + "integrity": "sha512-BDeBd8najI4/lS00HSKpdFia+OvUMytaVjfzR9n5Lq8MlZRSvtbI+uLtx1+XmQFls5wFU9dssccTmQQ6nfpjdg==", "requires": { - "dns-packet": "^5.1.2" + "dns-packet": "^5.2.4" } }, "doctrine": { @@ -727,9 +734,9 @@ } }, "dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==" }, "duplexer3": { "version": "0.1.4", @@ -737,38 +744,14 @@ "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" }, "duplexify": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", - "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz", + "integrity": "sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA==", "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", + "end-of-stream": "^1.4.1", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1", "stream-shift": "^1.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } } }, "ee-first": { @@ -796,9 +779,9 @@ } }, "engine.io-client": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.1.tgz", - "integrity": "sha512-oVu9kBkGbcggulyVF0kz6BV3ganqUeqXvD79WOFKa+11oK692w1NyFkuEj4xrkFRpZhn92QOqTk4RQq5LiBXbQ==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.2.tgz", + "integrity": "sha512-QEqIp+gJ/kMHeUun7f5Vv3bteRHppHH/FMBQX/esFj/fuYfjyUKWGMo3VCvIP/V8bE9KcjHmRZrhIz2Z9oNsDA==", "requires": { "component-emitter": "~1.3.0", "component-inherit": "0.0.3", @@ -809,7 +792,7 @@ "parseqs": "0.0.6", "parseuri": "0.0.6", "ws": "~7.4.2", - "xmlhttprequest-ssl": "~1.5.4", + "xmlhttprequest-ssl": "~1.6.2", "yeast": "0.1.2" }, "dependencies": { @@ -820,6 +803,11 @@ "requires": { "ms": "2.0.0" } + }, + "ws": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==" } } }, @@ -1047,9 +1035,9 @@ "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" }, "execa": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.0.0.tgz", - "integrity": "sha512-ov6w/2LCiuyO4RLYGdpFGjkcs0wMTgGE8PrkTHikeUy5iJekXyPIKUjifk5CsE0pt7sMCrMZ3YNqoCj6idQOnQ==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", "requires": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -1116,11 +1104,6 @@ } } }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -1291,56 +1274,6 @@ "path-is-absolute": "^1.0.0" } }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "glob-stream": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", - "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", - "requires": { - "extend": "^3.0.0", - "glob": "^7.1.1", - "glob-parent": "^3.1.0", - "is-negated-glob": "^1.0.0", - "ordered-read-streams": "^1.0.0", - "pumpify": "^1.3.5", - "readable-stream": "^2.1.5", - "remove-trailing-separator": "^1.0.1", - "to-absolute-glob": "^2.0.0", - "unique-stream": "^2.0.2" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "globals": { "version": "13.6.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.6.0.tgz", @@ -1395,13 +1328,6 @@ "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", "requires": { "isarray": "2.0.1" - }, - "dependencies": { - "isarray": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", - "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" - } } }, "has-cors": { @@ -1421,14 +1347,12 @@ "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" }, "help-me": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/help-me/-/help-me-1.1.0.tgz", - "integrity": "sha1-jy1QjQYAtKRW2i8IZVbn5cBWo8Y=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-3.0.0.tgz", + "integrity": "sha512-hx73jClhyk910sidBB7ERlnhMlFsJJIBqSVMFDwPN8o2v9nmp5KgLq1Xz1Bf1fCMMZ6mPrX159iG0VLy/fPMtQ==", "requires": { - "callback-stream": "^1.0.2", - "glob-stream": "^6.1.0", - "through2": "^2.0.1", - "xtend": "^4.0.0" + "glob": "^7.1.6", + "readable-stream": "^3.6.0" } }, "hosted-git-info": { @@ -1546,24 +1470,15 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, - "is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - } - }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" }, "is-core-module": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.3.0.tgz", - "integrity": "sha512-xSphU2KG9867tsYdLD4RWQ1VqdFl4HTO9Thf3I/3dLEfr0dbPTWKsuCKrgqMljg4nPE+Gq0VCnzT3gr0CyBmsw==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", "requires": { "has": "^1.0.3" } @@ -1571,7 +1486,8 @@ "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true }, "is-fullwidth-code-point": { "version": "3.0.0", @@ -1579,14 +1495,6 @@ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "requires": { - "is-extglob": "^2.1.0" - } - }, "is-ip": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", @@ -1595,20 +1503,15 @@ "ip-regex": "^4.0.0" } }, - "is-negated-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", - "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=" - }, "is-online": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/is-online/-/is-online-9.0.0.tgz", - "integrity": "sha512-P53pg5IPdfE19JB51ckbzl5ZT5/+pQAIX/QfuOx0qQLT1xuk5twnbKSxdbHC9/HrS3o69aX67HkkdYrUH9QYeA==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/is-online/-/is-online-9.0.1.tgz", + "integrity": "sha512-+08dRW0dcFOtleR2N3rHRVxDyZtQitUp9cC+KpKTds0mXibbQyW5js7xX0UGyQXkaLUJObe0w6uQ4ex34lX9LA==", "requires": { "got": "^11.8.0", "p-any": "^3.0.0", "p-timeout": "^3.2.0", - "public-ip": "^4.0.2" + "public-ip": "^4.0.4" } }, "is-plain-obj": { @@ -1629,18 +1532,10 @@ "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" }, - "is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "requires": { - "is-unc-path": "^1.0.0" - } - }, "is-ssh": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/is-ssh/-/is-ssh-1.3.2.tgz", - "integrity": "sha512-elEw0/0c2UscLrNG+OAorbP539E3rhliKPg+hDMWN9VwrDXfYK+4PBEykDPfxlYYtQvl84TascnQyobfQLHEhQ==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/is-ssh/-/is-ssh-1.3.3.tgz", + "integrity": "sha512-NKzJmQzJfEEma3w5cJNcUMxoXfDjz0Zj0eyCalHn2E6VOwlzjZo0yuO2fcBSf8zhFuVCL/82/r5gRcoi6aEPVQ==", "requires": { "protocols": "^1.1.0" } @@ -1655,23 +1550,10 @@ "resolved": "https://registry.npmjs.org/is-stun/-/is-stun-2.0.0.tgz", "integrity": "sha512-3d3CI8nLmh2ATbjfvi5TkVcimMgXtFH7PGoXeT1prGguVK8eaO3CzynLbdFY8Ez9khVpLpP8HHFPxneqn0QYPw==" }, - "is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "requires": { - "unc-path-regex": "^0.1.2" - } - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" - }, "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" }, "isexe": { "version": "2.0.0", @@ -1718,7 +1600,8 @@ "json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true }, "keyv": { "version": "4.0.3", @@ -1906,29 +1789,37 @@ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" }, "mqtt": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-4.2.6.tgz", - "integrity": "sha512-GpxVObyOzL0CGPBqo6B04GinN8JLk12NRYAIkYvARd9ZCoJKevvOyCaWK6bdK/kFSDj3LPDnCsJbezzNlsi87Q==", + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-4.2.8.tgz", + "integrity": "sha512-DJYjlXODVXtSDecN8jnNzi6ItX3+ufGsEs9OB3YV24HtkRrh7kpx8L5M1LuyF0KzaiGtWr2PzDcMGAY60KGOSA==", "requires": { "commist": "^1.0.0", "concat-stream": "^2.0.0", "debug": "^4.1.1", - "help-me": "^1.0.1", + "duplexify": "^4.1.1", + "help-me": "^3.0.0", "inherits": "^2.0.3", "minimist": "^1.2.5", - "mqtt-packet": "^6.6.0", + "mqtt-packet": "^6.8.0", "pump": "^3.0.0", "readable-stream": "^3.6.0", "reinterval": "^1.1.0", "split2": "^3.1.0", - "ws": "^7.3.1", + "ws": "^7.5.0", "xtend": "^4.0.2" + }, + "dependencies": { + "ws": { + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.2.tgz", + "integrity": "sha512-lkF7AWRicoB9mAgjeKbGqVUekLnSNO4VjKVnuPHpQeOxZOErX6BPXwJk70nFslRCEEA8EVW7ZjKwXaP9N+1sKQ==" + } } }, "mqtt-packet": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-6.9.0.tgz", - "integrity": "sha512-cngFSAXWSl5XHKJYUQiYQjtp75zhf1vygY00NnJdhQoXOH2v3aizmaaMIHI5n1N/TJEHSAbHryQhFr3gJ9VNvA==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-6.10.0.tgz", + "integrity": "sha512-ja8+mFKIHdB1Tpl6vac+sktqy3gA8t9Mduom1BA75cI+R9AHnZOiaBQwpGiWnaVJLDGRdNhQmFaAqd7tkKSMGA==", "requires": { "bl": "^4.0.2", "debug": "^4.1.1", @@ -1963,9 +1854,9 @@ } }, "normalize-url": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==" + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==" }, "npm-run-path": { "version": "4.0.1", @@ -1976,9 +1867,9 @@ } }, "object-inspect": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.2.tgz", - "integrity": "sha512-gz58rdPpadwztRrPjZE9DZLOABUpTGdcANUgOwBFO1C+HZZhePoP83M65WGDmbpwFYJSWqavbl4SgDn4k8RYTA==" + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz", + "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==" }, "on-finished": { "version": "2.3.0", @@ -2018,38 +1909,6 @@ "word-wrap": "^1.2.3" } }, - "ordered-read-streams": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", - "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", - "requires": { - "readable-stream": "^2.0.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "p-any": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-any/-/p-any-3.0.0.tgz", @@ -2147,21 +2006,14 @@ } }, "parse-url": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-5.0.2.tgz", - "integrity": "sha512-Czj+GIit4cdWtxo3ISZCvLiUjErSo0iI3wJ+q9Oi3QuMYTI6OZu+7cewMWZ+C1YAnKhYTk6/TLuhIgCypLthPA==", + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-5.0.7.tgz", + "integrity": "sha512-CgbjyWT6aOh2oNSUS0cioYQsGysj9hQ2IdbOfeNwq5KOaKM7dOw/yTupiI0cnJhaDHJEIGybPkQz7LF9WNIhyw==", "requires": { "is-ssh": "^1.3.0", - "normalize-url": "^3.3.0", + "normalize-url": "4.5.1", "parse-path": "^4.0.0", "protocols": "^1.4.0" - }, - "dependencies": { - "normalize-url": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz", - "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==" - } } }, "parseqs": { @@ -2179,11 +2031,6 @@ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" - }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -2200,9 +2047,9 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "path-to-regexp": { "version": "0.1.7", @@ -2272,11 +2119,11 @@ } }, "public-ip": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-ip/-/public-ip-4.0.3.tgz", - "integrity": "sha512-IofiJJWoZ8hZHBk25l4ozLvcET0pjZSxocbUfh4sGkjidMOm4iZNzzWxezGqGsVY7HuxiK7SkyJKHNeT0YQ7uw==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/public-ip/-/public-ip-4.0.4.tgz", + "integrity": "sha512-EJ0VMV2vF6Cu7BIPo3IMW1Maq6ME+fbR0NcPmqDfpfNGIRPue1X8QrGjrg/rfjDkOsIkKHIf2S5FlEa48hFMTA==", "requires": { - "dns-socket": "^4.2.1", + "dns-socket": "^4.2.2", "got": "^9.6.0", "is-ip": "^3.1.0" }, @@ -2404,27 +2251,6 @@ "once": "^1.3.1" } }, - "pumpify": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", - "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", - "requires": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - }, - "dependencies": { - "pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - } - } - }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -2524,11 +2350,6 @@ "resolved": "https://registry.npmjs.org/reinterval/-/reinterval-1.1.0.tgz", "integrity": "sha1-M2Hs+jymwYKDOA3Qu5VG85D17Oc=" }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" - }, "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -2545,9 +2366,9 @@ } }, "resolve-alpn": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.0.0.tgz", - "integrity": "sha512-rTuiIEqFmGxne4IovivKSDzld2lWW9QCjqv80SYjPgf+gS35eaCAjaP54CCwGAwBtnCsvNLYtqxe1Nw+i6JEmA==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.1.2.tgz", + "integrity": "sha512-8OyfzhAtA32LVUsJSke3auIyINcwdh5l3cvYKdKO0nvsYSKuiLfTM5i78PJswFPT8y6cPW+L1v6/hE95chcpDA==" }, "resolve-from": { "version": "4.0.0", @@ -2572,28 +2393,10 @@ "glob": "^7.1.3" } }, - "ring-client-api": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/ring-client-api/-/ring-client-api-9.18.0.tgz", - "integrity": "sha512-uQsbhjUNFS5CcYBKxOoD+OqG5fTp2oaQa9f7on+i18o4aK0gP4YiWyJ2g9saVxPp6ax6m+2XmoEgSx+OID5zEg==", - "requires": { - "@homebridge/camera-utils": "2.0.1", - "colors": "1.4.0", - "debug": "4.3.1", - "got": "11.8.2", - "rxjs": "7.0.0", - "sdp": "3.0.2", - "sip": "0.0.6", - "socket.io-client": "2.4.0", - "stun": "2.1.0", - "systeminformation": "5.6.12", - "uuid": "8.3.2" - } - }, "rxjs": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.0.0.tgz", - "integrity": "sha512-I1V/ArAtGJg4kmCfms8fULm0SwYgEsAf2d5WPCBGzTYm2qTjO3Tx4EDFaGjbOox8CeEsC69jQK22mnmfyA26sw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.1.0.tgz", + "integrity": "sha512-gCFO5iHIbRPwznl6hAYuwNFld8W4S2shtSJIqG27ReWXo9IWrCyEICxUA+6vJHwSR/OakoenC4QsDxq50tzYmw==", "requires": { "tslib": "~2.1.0" } @@ -2740,16 +2543,6 @@ "integrity": "sha512-t+FYic4EQ25GTsIRWFVvsq+GmVkoZhrcoghANlnN6CsWMHGcfjPDYMD+nTBNrHR/WnRykF4nqx4i+gahAnW5NA==", "requires": { "ws": "^6.1.0" - }, - "dependencies": { - "ws": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", - "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", - "requires": { - "async-limiter": "~1.0.0" - } - } } }, "slice-ansi": { @@ -2834,11 +2627,6 @@ "requires": { "ms": "2.0.0" } - }, - "isarray": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", - "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" } } }, @@ -2866,9 +2654,9 @@ } }, "spdx-license-ids": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", - "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==" + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.9.tgz", + "integrity": "sha512-Ki212dKK4ogX+xDo4CtOZBVIwhsKBEfsEEcwmJfLQzirgc2jIWdzg40Unxz/HzEUqM1WFzVlQSMF9kZZ2HboLQ==" }, "split-on-first": { "version": "1.1.0", @@ -2987,9 +2775,9 @@ } }, "systeminformation": { - "version": "5.6.12", - "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.6.12.tgz", - "integrity": "sha512-prJAt+iS2ITeygjLt/FGtN1qsIQHrRePCUqWtP0hGv6JsS0LSQTR+y5hWAd4frUIM/sjG95jHFUK1gx244KwUA==" + "version": "5.7.6", + "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.7.6.tgz", + "integrity": "sha512-sT7GeHq32DHaYBsQFogiLuHx51u+DO5flOlhIcmckTP0T9hQhAvvrbOR8jglNMaZgCvp5jACxeepERKGl7Bn/g==" }, "table": { "version": "6.0.7", @@ -3042,57 +2830,6 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "through2-filter": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz", - "integrity": "sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==", - "requires": { - "through2": "~2.0.0", - "xtend": "~4.0.0" - } - }, - "to-absolute-glob": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", - "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", - "requires": { - "is-absolute": "^1.0.0", - "is-negated-glob": "^1.0.0" - } - }, "to-array": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", @@ -3152,20 +2889,6 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, - "unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" - }, - "unique-stream": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz", - "integrity": "sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A==", - "requires": { - "json-stable-stringify-without-jsonify": "^1.0.1", - "through2-filter": "^3.0.0" - } - }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -3248,14 +2971,17 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "ws": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", - "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==" + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", + "integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==", + "requires": { + "async-limiter": "~1.0.0" + } }, "xmlhttprequest-ssl": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", - "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.3.tgz", + "integrity": "sha512-3XfeQE/wNkvrIktn2Kf0869fC0BN6UpydVasGIeSm2B1Llihf7/0UfZM+eCkOw3P7bP4+qPgqhm7ZoxuJtFU0Q==" }, "xtend": { "version": "4.0.2", diff --git a/package.json b/package.json index 661af72..116ea18 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,18 @@ { "name": "ring-mqtt", - "version": "4.5.5", + "version": "4.5.6", "description": "Ring to MQTT Bridge", "main": "ring-mqtt.js", "dependencies": { "body-parser": "^1.19.0", - "debug": "^4.3.1", + "debug": "^4.3.2", "express": "^4.17.1", "get-port": "^5.1.1", - "is-online": "^9.0.0", - "mqtt": "^4.2.6", + "got": "^11.8.2", + "is-online": "^9.0.1", + "mqtt": "^4.2.8", "pipe2jpeg": "^0.3.1", - "ring-client-api": "^9.18.0" + "@tsightler/ring-client-api": "9.18.1-custom.2" }, "devDependencies": { "eslint": "^7.19.0" diff --git a/ring-mqtt.js b/ring-mqtt.js index 32ea5b7..6455296 100644 --- a/ring-mqtt.js +++ b/ring-mqtt.js @@ -1,9 +1,9 @@ #!/usr/bin/env node // Defines -const RingApi = require('ring-client-api').RingApi -const RingDeviceType = require('ring-client-api').RingDeviceType -const RingCamera = require('ring-client-api').RingCamera +const RingApi = require('@tsightler/ring-client-api').RingApi +const RingDeviceType = require('@tsightler/ring-client-api').RingDeviceType +const RingCamera = require('@tsightler/ring-client-api').RingCamera const mqttApi = require ('mqtt') const isOnline = require ('is-online') const debug = require('debug')('ring-mqtt') @@ -131,7 +131,8 @@ async function updateRingData(mqttClient, ringClient) { debug(colors.green('Found existing location '+location.name+' with id '+location.id)) } else { debug(colors.green('Found new location '+location.name+' with id '+location.id)) - if (location.hasHubs) { location.needsSubscribe = true } + location.isSubscribed = false + location.isConnected = false ringLocations.push(location) foundLocation = location } @@ -178,24 +179,12 @@ async function updateRingData(mqttClient, ringClient) { await utils.sleep(5) } -// Set all devices for location offline -async function setLocationOffline(location) { - // Wait 30 seconds before setting devices offline in case disconnect is transient - // Keeps from creating "unknown" state for sensors if connection error is short lived - await utils.sleep(30) - if (location.onConnected._value) { return } - ringDevices.forEach(device => { - if (device.locationId == location.locationId && !device.camera) { - device.offline() - } - }) -} - // Publish devices/cameras for given location -async function publishDevices(devices, location) { +async function publishDevices(location) { republishCount = (republishCount < 1) ? 1 : republishCount while (republishCount > 0 && mqttConnected) { try { + const devices = await ringDevices.filter(d => d.locationId == location.locationId) if (devices && devices.length) { devices.forEach(device => { // Provide location websocket connection state to device @@ -220,20 +209,34 @@ async function processLocations(mqttClient, ringClient) { const devices = await ringDevices.filter(d => d.locationId == location.locationId) // If location has devices publish them if (devices && devices.length) { - if (location.needsSubscribe) { + if (location.hasHubs && !location.isSubscribed) { // Location has an alarm or smart bridge so subscribe to websocket connection monitor - location.needsSubscribe = false + location.isSubscribed = true location.onConnected.subscribe(async connected => { if (connected) { - debug('Websocket for location id '+location.locationId+' is connected') - publishDevices(devices, location) + // Only publish if previous state was actually disconnected + if (!location.isConnected) { + location.isConnected = true + debug('Websocket for location id '+location.locationId+' is connected') + publishDevices(location) + } } else { - debug('Websocket for location id '+location.locationId+' is disconnected') - setLocationOffline(location) + // Wait 30 seconds before setting devices offline in case disconnect is transient + // Keeps from creating "unknown" state for sensors if connection error is short lived + await utils.sleep(30) + if (!location.onConnected._value) { + location.isConnected = false + debug('Websocket for location id '+location.locationId+' is disconnected') + ringDevices.forEach(device => { + if (device.locationId == location.locationId && !device.camera) { + device.offline() + } + }) + } } }) } else { - publishDevices(devices, location) + publishDevices(location) } } else { debug('No devices found for location ID '+location.id) @@ -450,6 +453,7 @@ const main = async(generatedToken) => { cameraDingsPollingSeconds: 2 } } + if (CONFIG.enable_modes) { ringAuth.locationModePollingSeconds = 20 } if (!(CONFIG.location_ids === undefined || CONFIG.location_ids == 0)) { ringAuth.locationIds = CONFIG.location_ids diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index e4078ee..630c788 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -14,11 +14,14 @@ if [ -f /data/options.json ]; then if [ "${BRANCH}" = "latest" ]; then /app/ring-mqtt/scripts/update2latest.sh echo "-------------------------------------------------------" + exec /app/ring-mqtt-latest/scripts/run-addon.sh elif [ "${BRANCH}" = "dev" ]; then /app/ring-mqtt/scripts/update2dev.sh echo "-------------------------------------------------------" + exec /app/ring-mqtt-dev/scripts/run-addon.sh + else + exec /app/ring-mqtt/scripts/run-addon.sh fi - exec /app/ring-mqtt/scripts/run-addon.sh else # No options.json found, assume we are in running in standard Docker set +o nounset @@ -46,10 +49,10 @@ else fi echo "Running ring-mqtt..." if [ "${BRANCH}" = "latest" ]; then - ISDOCKER=true exec /app/ring-mqtt-latest/ring-mqtt.js + ISDOCKER=true NODE_OPTIONS="--unhandled-rejection=warn" exec /app/ring-mqtt-latest/ring-mqtt.js elif [ "${BRANCH}" = "dev" ]; then - ISDOCKER=true exec /app/ring-mqtt-dev/ring-mqtt.js + ISDOCKER=true NODE_OPTIONS="--unhandled-rejection=warn" exec /app/ring-mqtt-dev/ring-mqtt.js else - ISDOCKER=true exec /app/ring-mqtt/ring-mqtt.js + ISDOCKER=true NODE_OPTIONS="--unhandled-rejection=warn" exec /app/ring-mqtt/ring-mqtt.js fi fi \ No newline at end of file diff --git a/scripts/run-addon.sh b/scripts/run-addon.sh index 821bc42..91af1f5 100644 --- a/scripts/run-addon.sh +++ b/scripts/run-addon.sh @@ -72,9 +72,9 @@ fi echo "-------------------------------------------------------" echo Running ring-mqtt... if [ "${BRANCH}" = "latest" ]; then - DEBUG=ring-mqtt HASSADDON=true exec /app/ring-mqtt-latest/ring-mqtt.js + DEBUG=ring-mqtt HASSADDON=true NODE_OPTIONS="--unhandled-rejection=warn" exec /app/ring-mqtt-latest/ring-mqtt.js elif [ "${BRANCH}" = "dev" ]; then - DEBUG=ring-mqtt HASSADDON=true exec /app/ring-mqtt-dev/ring-mqtt.js + DEBUG=ring-mqtt HASSADDON=true NODE_OPTIONS="--unhandled-rejection=warn" exec /app/ring-mqtt-dev/ring-mqtt.js else - DEBUG=ring-mqtt HASSADDON=true exec /app/ring-mqtt/ring-mqtt.js + DEBUG=ring-mqtt HASSADDON=true NODE_OPTIONS="--unhandled-rejection=warn" exec /app/ring-mqtt/ring-mqtt.js fi