From afa07d4e0cfce7661957a73a8ec516b6da14cb48 Mon Sep 17 00:00:00 2001 From: David Maher Date: Thu, 18 Feb 2021 15:36:00 -0500 Subject: [PATCH 1/4] Drop support for Homebridge <1.1.3 --- README.md | 2 -- config.schema.json | 45 +++++++++++++++++----------------------- package-lock.json | 36 +++----------------------------- package.json | 3 +-- src/configTypes.ts | 1 - src/index.ts | 3 +-- src/streamingDelegate.ts | 39 +--------------------------------- 7 files changed, 25 insertions(+), 104 deletions(-) diff --git a/README.md b/README.md index b4ae70ee..49d69172 100755 --- a/README.md +++ b/README.md @@ -163,7 +163,6 @@ Other users have been sharing configurations that work for them on our GitHub si ### Rarely Needed Parameters - `videoProcessor`: Defines which video processor is used to decode and encode videos, must take the same parameters as FFmpeg. Common uses would be `avconv` or the path to a custom-compiled version of FFmpeg. If not set, will use the included version of FFmpeg, or the version of FFmpeg installed on the system if no included version is available. -- `interfaceName`: Selects which network interface to use for video streaming to HomeKit. If you have multiple active network interfaces in your system, you may need to set this. If not set, the first available network interface is used, and a mismatch will cause HomeKit to discard the video stream. #### Rare Option Example @@ -171,7 +170,6 @@ Other users have been sharing configurations that work for them on our GitHub si { "platform": "Camera-ffmpeg", "videoProcessor": "/usr/bin/ffmpeg", - "interfaceName": "eth0", "cameras": [] } ``` diff --git a/config.schema.json b/config.schema.json index 0101dda7..4cf658b4 100644 --- a/config.schema.json +++ b/config.schema.json @@ -17,12 +17,6 @@ "placeholder": "ffmpeg", "description": "Defines which video processor is used to decode and encode videos, must take the same parameters as FFmpeg. Common uses would be 'avconv' or the path to a custom-compiled version of FFmpeg. If not set, will use the included version of FFmpeg, or the version of FFmpeg installed on the system if no included version is available." }, - "interfaceName": { - "title": "Network Interface", - "type": "string", - "placeholder": "eth0", - "description": "Selects which network interface to use for video streaming to HomeKit. If you have multiple active network interfaces in your system, you may need to set this. If not set, the first available network interface is used, and a mismatch will cause HomeKit to discard the video stream." - }, "mqtt": { "title": "MQTT Server", "type": "string", @@ -357,16 +351,6 @@ } ] }, - { - "type": "section", - "title": "Global Advanced", - "expandable": true, - "expanded": false, - "items": [ - "videoProcessor", - "interfaceName" - ] - }, { "type": "section", "title": "Global Automation", @@ -375,29 +359,38 @@ "items": [ { "type": "section", - "title": "MQTT Client", + "title": "HTTP Server", "expandable": true, "expanded": true, "items": [ - "mqtt", - "portmqtt", - "tlsmqtt", - "usermqtt", - "passmqtt", - "topic" + "porthttp", + "localhttp" ] }, { "type": "section", - "title": "HTTP Server", + "title": "MQTT Client", "expandable": true, "expanded": true, "items": [ - "porthttp", - "localhttp" + "mqtt", + "portmqtt", + "tlsmqtt", + "usermqtt", + "passmqtt", + "topic" ] } ] + }, + { + "type": "section", + "title": "Global Advanced", + "expandable": true, + "expanded": false, + "items": [ + "videoProcessor" + ] } ] } diff --git a/package-lock.json b/package-lock.json index f45b130f..c8a0e950 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "homebridge-camera-ffmpeg", - "version": "3.0.5", + "version": "3.0.6", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "3.0.5", + "version": "3.0.6", "funding": [ { "type": "kofi", @@ -28,8 +28,7 @@ "dependencies": { "ffmpeg-for-homebridge": "^0.0.9", "get-port": "^5.1.1", - "mqtt": "^4.2.6", - "systeminformation": "^5.3.2" + "mqtt": "^4.2.6" }, "devDependencies": { "@types/node": "^14.14.28", @@ -2856,30 +2855,6 @@ "node": ">=8" } }, - "node_modules/systeminformation": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.3.2.tgz", - "integrity": "sha512-fD4mSjY64FRm1KfO5ykLqr5tjrGsrhML+PEe66LpQYwnA4KX2CCymUJNo7hrggw2nQeeFtZ4BtB3+cdn+OBJ5Q==", - "os": [ - "darwin", - "linux", - "win32", - "freebsd", - "openbsd", - "netbsd", - "sunos" - ], - "bin": { - "systeminformation": "lib/cli.js" - }, - "engines": { - "node": ">=4.0.0" - }, - "funding": { - "type": "Buy me a coffee", - "url": "https://www.buymeacoffee.com/systeminfo" - } - }, "node_modules/table": { "version": "6.0.7", "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", @@ -5317,11 +5292,6 @@ "has-flag": "^4.0.0" } }, - "systeminformation": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.3.2.tgz", - "integrity": "sha512-fD4mSjY64FRm1KfO5ykLqr5tjrGsrhML+PEe66LpQYwnA4KX2CCymUJNo7hrggw2nQeeFtZ4BtB3+cdn+OBJ5Q==" - }, "table": { "version": "6.0.7", "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", diff --git a/package.json b/package.json index f3e5b543..5470122b 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,6 @@ "dependencies": { "ffmpeg-for-homebridge": "^0.0.9", "get-port": "^5.1.1", - "mqtt": "^4.2.6", - "systeminformation": "^5.3.2" + "mqtt": "^4.2.6" } } diff --git a/src/configTypes.ts b/src/configTypes.ts index 733594df..258ab653 100644 --- a/src/configTypes.ts +++ b/src/configTypes.ts @@ -4,7 +4,6 @@ export type FfmpegPlatformConfig = { platform: PlatformName | PlatformIdentifier; name?: string; videoProcessor?: string; - interfaceName?: string; mqtt?: string; portmqtt?: number; tlsmqtt?: boolean; diff --git a/src/index.ts b/src/index.ts index 3cf324df..e23350be 100644 --- a/src/index.ts +++ b/src/index.ts @@ -150,8 +150,7 @@ class FfmpegPlatform implements DynamicPlatformPlugin { } } - const delegate = new StreamingDelegate(this.log, cameraConfig, this.api, hap, - this.config.videoProcessor, this.config.interfaceName); + const delegate = new StreamingDelegate(this.log, cameraConfig, this.api, hap, this.config.videoProcessor); accessory.configureController(delegate.controller); } diff --git a/src/streamingDelegate.ts b/src/streamingDelegate.ts index 70dae48e..c5105755 100644 --- a/src/streamingDelegate.ts +++ b/src/streamingDelegate.ts @@ -23,15 +23,12 @@ import { spawn } from 'child_process'; import { createSocket, Socket } from 'dgram'; import ffmpegPath from 'ffmpeg-for-homebridge'; import getPort from 'get-port'; -import os from 'os'; -import { networkInterfaceDefault } from 'systeminformation'; import { CameraConfig, VideoConfig } from './configTypes'; import { FfmpegProcess } from './ffmpeg'; import { Logger } from './logger'; type SessionInfo = { address: string; // address of the HAP controller - localAddress: string; ipv6: boolean; videoPort: number; @@ -66,7 +63,6 @@ export class StreamingDelegate implements CameraStreamingDelegate { private readonly cameraName: string; private readonly videoConfig: VideoConfig; private readonly videoProcessor: string; - private readonly interfaceName?: string; readonly controller: CameraController; // keep track of sessions @@ -74,14 +70,13 @@ export class StreamingDelegate implements CameraStreamingDelegate { ongoingSessions: Record = {}; timeouts: Record = {}; - constructor(log: Logger, cameraConfig: CameraConfig, api: API, hap: HAP, videoProcessor?: string, interfaceName?: string) { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types + constructor(log: Logger, cameraConfig: CameraConfig, api: API, hap: HAP, videoProcessor?: string) { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types this.log = log; this.videoConfig = cameraConfig.videoConfig!; this.hap = hap; this.cameraName = cameraConfig.name!; this.videoProcessor = videoProcessor || ffmpegPath || 'ffmpeg'; - this.interfaceName = interfaceName; api.on(APIEvent.SHUTDOWN, () => { for (const session in this.ongoingSessions) { @@ -198,24 +193,6 @@ export class StreamingDelegate implements CameraStreamingDelegate { } } - async getIpAddress(ipv6: boolean, interfaceName?: string): Promise { - if (!interfaceName) { - interfaceName = await networkInterfaceDefault(); - } - const interfaces = os.networkInterfaces(); - const externalInfo = interfaces[interfaceName]?.filter((info) => { - return !info.internal; - }); - const preferredFamily = ipv6 ? 'IPv6' : 'IPv4'; - const addressInfo = externalInfo?.find((info) => { - return info.family === preferredFamily; - }) || externalInfo?.[0]; - if (!addressInfo) { - throw new Error('Unable to get network address for "' + interfaceName + '"!'); - } - return addressInfo.address; - } - async prepareStream(request: PrepareStreamRequest, callback: PrepareStreamCallback): Promise { const videoReturnPort = await getPort(); const videoSSRC = this.hap.CameraController.generateSynchronisationSource(); @@ -224,21 +201,8 @@ export class StreamingDelegate implements CameraStreamingDelegate { const ipv6 = request.addressVersion === 'ipv6'; - let currentAddress: string; - try { - currentAddress = await this.getIpAddress(ipv6, this.interfaceName); - } catch (ex) { - if (this.interfaceName) { - this.log.warn(ex + ' Falling back to default.', this.cameraName); - currentAddress = await this.getIpAddress(ipv6); - } else { - throw ex; - } - } - const sessionInfo: SessionInfo = { address: request.targetAddress, - localAddress: currentAddress, ipv6: ipv6, videoPort: request.video.port, @@ -255,7 +219,6 @@ export class StreamingDelegate implements CameraStreamingDelegate { }; const response: PrepareStreamResponse = { - address: currentAddress, video: { port: videoReturnPort, ssrc: videoSSRC, From d3ec7452e509512a725e6eccca8b9c6d8d8e3aa1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Feb 2021 05:30:59 +0000 Subject: [PATCH 2/4] Bump actions/stale from v3.0.16 to v3.0.17 Bumps [actions/stale](https://github.com/actions/stale) from v3.0.16 to v3.0.17. - [Release notes](https://github.com/actions/stale/releases) - [Commits](https://github.com/actions/stale/compare/v3.0.16...996798eb71ef485dc4c7b4d3285842d714040c4a) Signed-off-by: dependabot[bot] --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 5754966b..2c6a9a62 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,7 +13,7 @@ jobs: env: ACTIONS_STEP_DEBUG: true steps: - - uses: actions/stale@v3.0.16 + - uses: actions/stale@v3.0.17 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.' From 46f70f46b99006b3e5442690722b67c7562b332c Mon Sep 17 00:00:00 2001 From: David Maher Date: Sat, 20 Feb 2021 20:07:43 -0500 Subject: [PATCH 3/4] Rework MQTT and fix Homebridge 1.3 warnings --- README.md | 33 ++++++++++++ config.schema.json | 56 +++++++++++++++++++- package-lock.json | 4 +- package.json | 2 +- src/configTypes.ts | 12 ++++- src/index.ts | 124 +++++++++++++++++++++++++++++++-------------- 6 files changed, 187 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 49d69172..ea8d3a20 100755 --- a/README.md +++ b/README.md @@ -137,6 +137,39 @@ Other users have been sharing configurations that work for them on our GitHub si } ``` +### Camera MQTT Parameters + +- `motionTopic`: The MQTT topic to watch for motion alerts. +- `motionMessage`: The message to watch for to trigger motion alerts. Will use the name of the camera if blank. +- `motionResetTopic`: The MQTT topic to watch for motion resets. +- `motionResetMessage`: The message to watch for to trigger motion resets. Will use the name of the camera if blank. +- `doorbellTopic`: The MQTT topic to watch for doorbell alerts. +- `doorbellMessage`: The message to watch for to trigger doorbell alerts. Will use the name of the camera if blank. + +#### Camera MQTT Example + +```json +{ + "platform": "Camera-ffmpeg", + "cameras": [ + { + "name": "Camera Name", + "videoConfig": { + "source": "-i rtsp://myfancy_rtsp_stream" + }, + "mqtt": { + "motionTopic": "home/camera", + "motionMessage": "ON", + "motionResetTopic": "home/camera", + "motionResetMessage": "OFF", + "doorbellTopic": "home/doobell", + "doorbellMessage": "ON" + } + } + ] +} +``` + ### Automation Parameters - `mqtt`: Defines the hostname or IP of the MQTT broker to connect to for MQTT-based automation. If not set, MQTT support is not started. See the project site for [more information on using MQTT](https://sunoo.github.io/homebridge-camera-ffmpeg/automation/mqtt.html). diff --git a/config.schema.json b/config.schema.json index 4cf658b4..988914f7 100644 --- a/config.schema.json +++ b/config.schema.json @@ -255,6 +255,45 @@ "description": "Includes debugging output from the FFmpeg process used for two-way audio in the Homebridge log." } } + }, + "mqtt": { + "title": "MQTT Configuration", + "type": "object", + "properties": { + "motionTopic": { + "title": "Motion Topic", + "type": "string", + "placeholder": "homebridge/motion", + "description": "The MQTT topic to watch for motion alerts." + }, + "motionMessage": { + "title": "Motion Message", + "type": "string", + "description": "The message to watch for to trigger motion alerts. Will use the name of the camera if blank." + }, + "motionResetTopic": { + "title": "Motion Reset Topic", + "type": "string", + "placeholder": "homebridge/motion/reset", + "description": "The MQTT topic to watch for motion resets." + }, + "motionResetMessage": { + "title": "Motion Reset Message", + "type": "string", + "description": "The message to watch for to trigger motion resets. Will use the name of the camera if blank." + }, + "doorbellTopic": { + "title": "Doorbell Topic", + "type": "string", + "placeholder": "homebridge/doorbell", + "description": "The MQTT topic to watch for doorbell alerts." + }, + "doorbellMessage": { + "title": "Doorbell Message", + "type": "string", + "description": "The message to watch for to trigger doorbell alerts. Will use the name of the camera if blank." + } + } } } } @@ -344,7 +383,22 @@ "cameras[].doorbell", "cameras[].switches", "cameras[].motionTimeout", - "cameras[].motionDoorbell" + "cameras[].motionDoorbell", + { + "key": "cameras[]", + "type": "section", + "title": "MQTT Settings", + "expandable": true, + "expanded": false, + "items": [ + "cameras[].mqtt.motionTopic", + "cameras[].mqtt.motionMessage", + "cameras[].mqtt.motionResetTopic", + "cameras[].mqtt.motionResetMessage", + "cameras[].mqtt.doorbellTopic", + "cameras[].mqtt.doorbellMessage" + ] + } ] } ] diff --git a/package-lock.json b/package-lock.json index c8a0e950..8aec68c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "homebridge-camera-ffmpeg", - "version": "3.0.6", + "version": "3.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "3.0.6", + "version": "3.1.0", "funding": [ { "type": "kofi", diff --git a/package.json b/package.json index 5470122b..81b649c6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "displayName": "Homebridge Camera FFmpeg", "name": "homebridge-camera-ffmpeg", - "version": "3.0.6", + "version": "3.1.0", "description": "Homebridge Plugin Providing FFmpeg-based Camera Support", "main": "dist/index.js", "license": "ISC", diff --git a/src/configTypes.ts b/src/configTypes.ts index 258ab653..5272b28f 100644 --- a/src/configTypes.ts +++ b/src/configTypes.ts @@ -26,6 +26,7 @@ export type CameraConfig = { switches?: boolean; motionTimeout?: number; motionDoorbell?: boolean; + mqtt?: MqttCameraConfig; unbridge?: boolean; videoConfig?: VideoConfig; }; @@ -49,4 +50,13 @@ export type VideoConfig = { audio?: boolean; debug?: boolean; debugReturn?: boolean; -}; \ No newline at end of file +}; + +export type MqttCameraConfig = { + motionTopic?: string; + motionMessage?: string; + motionResetTopic?: string; + motionResetMessage?: string; + doorbellTopic?: string; + doorbellMessage?: string; +}; diff --git a/src/index.ts b/src/index.ts index e23350be..41142f21 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,7 +13,6 @@ import { } from 'homebridge'; import http from 'http'; import mqtt from 'mqtt'; -import url from 'url'; import { AutomationReturn } from './autoTypes'; import { CameraConfig, FfmpegPlatformConfig } from './configTypes'; import { Logger } from './logger'; @@ -26,6 +25,12 @@ let Accessory: typeof PlatformAccessory; const PLUGIN_NAME = 'homebridge-camera-ffmpeg'; const PLATFORM_NAME = 'Camera-ffmpeg'; +type MqttAction = { + accessory: PlatformAccessory; + active: boolean; + doorbell: boolean; +}; + class FfmpegPlatform implements DynamicPlatformPlugin { private readonly log: Logger; private readonly api: API; @@ -35,6 +40,7 @@ class FfmpegPlatform implements DynamicPlatformPlugin { private readonly accessories: Array = []; private readonly motionTimers: Map = new Map(); private readonly doorbellTimers: Map = new Map(); + private readonly mqttActions: Map>> = new Map(); constructor(log: Logging, config: PlatformConfig, api: API) { this.log = new Logger(log); @@ -86,6 +92,14 @@ class FfmpegPlatform implements DynamicPlatformPlugin { api.on(APIEvent.DID_FINISH_LAUNCHING, this.didFinishLaunching.bind(this)); } + addMqttAction(topic: string, message: string, details: MqttAction): void { + const messageMap = this.mqttActions.get(topic) || new Map(); + const actionArray = messageMap.get(message) || []; + actionArray.push(details); + messageMap.set(message, actionArray); + this.mqttActions.set(topic, messageMap); + } + setupAccessory(accessory: PlatformAccessory, cameraConfig: CameraConfig): void { accessory.on(PlatformAccessoryEvent.IDENTIFY, () => { this.log.info('Identify requested.', accessory.displayName); @@ -130,7 +144,7 @@ class FfmpegPlatform implements DynamicPlatformPlugin { .getCharacteristic(hap.Characteristic.On) .on(CharacteristicEventTypes.SET, (state: CharacteristicValue, callback: CharacteristicSetCallback) => { this.doorbellHandler(accessory, state as boolean); - callback(null, state); + callback(); }); accessory.addService(doorbellTrigger); } @@ -144,7 +158,7 @@ class FfmpegPlatform implements DynamicPlatformPlugin { .getCharacteristic(hap.Characteristic.On) .on(CharacteristicEventTypes.SET, (state: CharacteristicValue, callback: CharacteristicSetCallback) => { this.motionHandler(accessory, state as boolean, 1); - callback(null, state); + callback(); }); accessory.addService(motionTrigger); } @@ -153,6 +167,31 @@ class FfmpegPlatform implements DynamicPlatformPlugin { const delegate = new StreamingDelegate(this.log, cameraConfig, this.api, hap, this.config.videoProcessor); accessory.configureController(delegate.controller); + + if (this.config.mqtt) { + if (cameraConfig.mqtt) { + if (cameraConfig.mqtt.motionTopic) { + this.addMqttAction(cameraConfig.mqtt.motionTopic, cameraConfig.mqtt.motionMessage || cameraConfig.name!, + {accessory: accessory, active: true, doorbell: false}); + } + if (cameraConfig.mqtt.motionResetTopic) { + this.addMqttAction(cameraConfig.mqtt.motionResetTopic, cameraConfig.mqtt.motionResetMessage || cameraConfig.name!, + {accessory: accessory, active: false, doorbell: false}); + } + if (cameraConfig.mqtt.doorbellTopic) { + this.addMqttAction(cameraConfig.mqtt.doorbellTopic, cameraConfig.mqtt.doorbellMessage || cameraConfig.name!, + {accessory: accessory, active: true, doorbell: true}); + } + } + if (this.config.topic) { + this.addMqttAction(this.config.topic + '/motion', cameraConfig.name!, + {accessory: accessory, active: true, doorbell: false}); + this.addMqttAction(this.config.topic + '/motion/reset', cameraConfig.name!, + {accessory: accessory, active: false, doorbell: false}); + this.addMqttAction(this.config.topic + '/doorbell', cameraConfig.name!, + {accessory: accessory, active: true, doorbell: true}); + } + } } configureAccessory(accessory: PlatformAccessory): void { @@ -271,7 +310,7 @@ class FfmpegPlatform implements DynamicPlatformPlugin { } } - private automationHandler(fullpath: string, name: string): AutomationReturn { + private httpHandler(fullpath: string, name: string): AutomationReturn { const accessory = this.accessories.find((curAcc: PlatformAccessory) => { return curAcc.displayName == name; }); @@ -299,26 +338,54 @@ class FfmpegPlatform implements DynamicPlatformPlugin { } didFinishLaunching(): void { + for (const [uuid, cameraConfig] of this.cameraConfigs) { + if (cameraConfig.unbridge) { + const accessory = new Accessory(cameraConfig.name!, uuid); + this.log.info('Configuring unbridged accessory...', accessory.displayName); + this.setupAccessory(accessory, cameraConfig); + this.api.publishExternalAccessories(PLUGIN_NAME, [accessory]); + this.accessories.push(accessory); + } else { + const cachedAccessory = this.cachedAccessories.find((curAcc: PlatformAccessory) => curAcc.UUID === uuid); + if (!cachedAccessory) { + const accessory = new Accessory(cameraConfig.name!, uuid); + this.log.info('Configuring bridged accessory...', accessory.displayName); + this.setupAccessory(accessory, cameraConfig); + this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]); + this.accessories.push(accessory); + } else { + this.accessories.push(cachedAccessory); + } + } + } + if (this.config.mqtt) { const portmqtt = this.config.portmqtt || '1883'; - let mqtttopic = 'homebridge'; - if (this.config.topic && this.config.topic != 'homebridge/motion') { - mqtttopic = this.config.topic; - } - this.log.info('Setting up MQTT connection with topic ' + mqtttopic + '...'); + this.log.info('Setting up MQTT connection...'); const client = mqtt.connect((this.config.tlsmqtt ? 'mqtts://' : 'mqtt://') + this.config.mqtt + ':' + portmqtt, { 'username': this.config.usermqtt, 'password': this.config.passmqtt }); client.on('connect', () => { this.log.info('MQTT connected.'); - client.subscribe(mqtttopic + '/#'); + for (const [topic] of this.mqttActions) { + this.log.debug('Subscribing to MQTT topic: ' + topic); + client.subscribe(topic); + } }); client.on('message', (topic: string, message: Buffer) => { - if (topic.startsWith(mqtttopic)) { - const path = topic.substr(mqtttopic.length); - const name = message.toString(); - this.automationHandler(path, name); + const messageMap = this.mqttActions.get(topic); + if (messageMap) { + const actionArray = messageMap.get(message.toString()); + if (actionArray) { + for (const action of actionArray) { + if (action.doorbell) { + this.doorbellHandler(action.accessory, action.active); + } else { + this.motionHandler(action.accessory, action.active); + } + } + } } }); } @@ -334,10 +401,10 @@ class FfmpegPlatform implements DynamicPlatformPlugin { message: 'Malformed URL.' }; if (request.url) { - const parseurl = url.parse(request.url); - if (parseurl.pathname && parseurl.query) { - const name = decodeURIComponent(parseurl.query).split('=')[0]; - results = this.automationHandler(parseurl.pathname, name); + const spliturl = request.url.split('?'); + if (spliturl.length == 2) { + const name = decodeURIComponent(spliturl[1]).split('=')[0]; + results = this.httpHandler(spliturl[0], name); } } response.writeHead(results.error ? 500 : 200); @@ -346,27 +413,6 @@ class FfmpegPlatform implements DynamicPlatformPlugin { }); } - for (const [uuid, cameraConfig] of this.cameraConfigs) { - if (cameraConfig.unbridge) { - const accessory = new Accessory(cameraConfig.name!, uuid); - this.log.info('Configuring unbridged accessory...', accessory.displayName); - this.setupAccessory(accessory, cameraConfig); - this.api.publishExternalAccessories(PLUGIN_NAME, [accessory]); - this.accessories.push(accessory); - } else { - const cachedAccessory = this.cachedAccessories.find((curAcc: PlatformAccessory) => curAcc.UUID === uuid); - if (!cachedAccessory) { - const accessory = new Accessory(cameraConfig.name!, uuid); - this.log.info('Configuring bridged accessory...', accessory.displayName); - this.setupAccessory(accessory, cameraConfig); - this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]); - this.accessories.push(accessory); - } else { - this.accessories.push(cachedAccessory); - } - } - } - this.cachedAccessories.forEach((accessory: PlatformAccessory) => { const cameraConfig = this.cameraConfigs.get(accessory.UUID); if (!cameraConfig || cameraConfig.unbridge) { From a7f3acd573471613a45aeddde430087208f41be1 Mon Sep 17 00:00:00 2001 From: David Maher Date: Sat, 20 Feb 2021 20:41:22 -0500 Subject: [PATCH 4/4] Dropped legacy MQTT settings --- README.md | 2 - config.schema.json | 9 +- package-lock.json | 256 +++++++++++++++++++++++++++++++++++---------- package.json | 4 +- src/configTypes.ts | 1 - src/index.ts | 8 -- 6 files changed, 201 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index ea8d3a20..223acbc6 100755 --- a/README.md +++ b/README.md @@ -177,7 +177,6 @@ Other users have been sharing configurations that work for them on our GitHub si - `tlsmqtt`: Use TLS to connect to the MQTT broker. (Default: `false`) - `usermqtt`: The username used to connect to your MQTT broker. If not set, no authentication is used. - `passmqtt`: The password used to connect to your MQTT broker. If not set, no authentication is used. -- `topic`: The base MQTT topic to subscribe to. (Default: `homebridge`) - `porthttp`: The port to listen on for HTTP-based automation. If not set, HTTP support is not started. See the project site for [more information on using HTTP](https://sunoo.github.io/homebridge-camera-ffmpeg/automation/http.html). - `localhttp`: Only allow HTTP calls from localhost. Useful if using helper plugins that translate to HTTP. (Default: `false`) @@ -187,7 +186,6 @@ Other users have been sharing configurations that work for them on our GitHub si { "platform": "Camera-ffmpeg", "mqtt": "127.0.0.1", - "topic": "homebridge", "porthttp": "8080", "cameras": [] } diff --git a/config.schema.json b/config.schema.json index 988914f7..44f4c907 100644 --- a/config.schema.json +++ b/config.schema.json @@ -44,12 +44,6 @@ "type": "string", "description": "The password used to connect to your MQTT broker. If not set, no authentication is used." }, - "topic": { - "title": "MQTT Topic", - "type": "string", - "placeholder": "homebridge", - "description": "The base MQTT topic to subscribe to." - }, "porthttp": { "title": "HTTP Port", "type": "integer", @@ -431,8 +425,7 @@ "portmqtt", "tlsmqtt", "usermqtt", - "passmqtt", - "topic" + "passmqtt" ] } ] diff --git a/package-lock.json b/package-lock.json index 8aec68c5..796d4bde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,11 +31,11 @@ "mqtt": "^4.2.6" }, "devDependencies": { - "@types/node": "^14.14.28", + "@types/node": "^14.14.31", "@typescript-eslint/eslint-plugin": "^4.15.1", "@typescript-eslint/parser": "^4.15.1", "eslint": "^7.20.0", - "homebridge": "^1.1.7", + "homebridge": "^1.3.0", "rimraf": "^3.0.2", "typescript": "^4.1.5" }, @@ -153,6 +153,27 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/@homebridge/ciao": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@homebridge/ciao/-/ciao-1.1.2.tgz", + "integrity": "sha512-31IfDKMqxfT+uVNXj0/TmYMou57gP8CUrh0vABzsc5QMsoCQ4Oo5uYQp0oJJyzxTBkF2pFvjR3XlWAapl0VyCg==", + "dev": true, + "dependencies": { + "debug": "^4.3.1", + "fast-deep-equal": "^3.1.3", + "source-map-support": "^0.5.19", + "tslib": "^2.0.3" + }, + "bin": { + "ciao-bcs": "lib/bonjour-conformance-testing.js" + } + }, + "node_modules/@homebridge/ciao/node_modules/tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", + "dev": true + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", @@ -195,9 +216,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "14.14.28", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.28.tgz", - "integrity": "sha512-lg55ArB+ZiHHbBBttLpzD07akz0QPrZgUODNakeC09i62dnrywr9mFErHuaPlB6I7z+sEbK+IYmplahvplCj2g==", + "version": "14.14.31", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.31.tgz", + "integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { @@ -466,6 +487,15 @@ "node": ">=8" } }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/available-typed-arrays": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz", @@ -754,12 +784,6 @@ } } }, - "node_modules/decimal.js": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz", - "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==", - "dev": true - }, "node_modules/decompress-response": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", @@ -1250,9 +1274,9 @@ "dev": true }, "node_modules/fast-srp-hap": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/fast-srp-hap/-/fast-srp-hap-2.0.2.tgz", - "integrity": "sha512-wABhZRrFhlovqJQ1HygOUB4R6WZW2hmlpvVYh2dVCy8BPLabDrB/Tu6XI3B4QfmhtHk8s1OeiFqJHY7FBsphug==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/fast-srp-hap/-/fast-srp-hap-2.0.3.tgz", + "integrity": "sha512-4P8TBD0all202L9FbeSsWc9qDlpaYp065VbUwbuNYZDYdOJ02UlWaDkai6d/+6/I8/sdtVYAVd17PEZDKbqopQ==", "dev": true, "engines": { "node": ">=10.17.0" @@ -1329,6 +1353,21 @@ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", "dev": true }, + "node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/fs-minipass": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", @@ -1538,24 +1577,39 @@ "node": ">= 4" } }, + "node_modules/graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "dev": true + }, "node_modules/hap-nodejs": { - "version": "0.7.10", - "resolved": "https://registry.npmjs.org/hap-nodejs/-/hap-nodejs-0.7.10.tgz", - "integrity": "sha512-582WHUCRVKFtw1ITYvKsGrGw2Hhc/AINej0LuFhCYvzPqVf2/m+v5PdgEt4wqyJSTM9rG5uoVYp1t/hoDnlLsw==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/hap-nodejs/-/hap-nodejs-0.9.1.tgz", + "integrity": "sha512-NtGTGf9UwT3QDZZiz23i8DwnlASPT5mmNADTge3AxvwlTo24CLVjDksTDaZCqKJlvcv/wwkmb7B548pdC+2ASg==", "dev": true, "dependencies": { + "@homebridge/ciao": "~1.1.2", "bonjour-hap": "~3.6.2", - "debug": "^4.1.1", - "decimal.js": "^10.2.0", - "fast-srp-hap": "2.0.2", + "debug": "^4.3.1", + "fast-srp-hap": "2.0.3", "futoin-hkdf": "~1.3.2", + "ip": "^1.1.3", "node-persist": "^0.0.11", + "source-map-support": "^0.5.19", + "tslib": "^2.1.0", "tweetnacl": "^1.0.3" }, "engines": { "node": ">=10.17.0" } }, + "node_modules/hap-nodejs/node_modules/tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", + "dev": true + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -1601,17 +1655,17 @@ } }, "node_modules/homebridge": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/homebridge/-/homebridge-1.1.7.tgz", - "integrity": "sha512-A+cf5ZBatZu34wEVc1S5ztNtNjIbA31jwOMSZ6so8TeAQfcIYJRDHueHD7FgslMxkHol27nXt9vVMrugH4LtLA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/homebridge/-/homebridge-1.3.0.tgz", + "integrity": "sha512-3ex//Kox7wmgkI0DgesLGJtb/BIEtcuq/IEsXLpz7Kcg9DB+gNXUE0vm3RmSxZX6jPOyRkTDkoLivy2HhiEX3Q==", "dev": true, "dependencies": { "chalk": "^4.1.0", "commander": "5.1.0", - "hap-nodejs": "^0.7.10", - "node-persist": "^0.0.11", + "fs-extra": "^9.1.0", + "hap-nodejs": "0.9.1", "qrcode-terminal": "^0.12.0", - "semver": "^7.3.2", + "semver": "^7.3.4", "source-map-support": "^0.5.19" }, "bin": { @@ -2009,6 +2063,18 @@ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/leven": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", @@ -2231,12 +2297,12 @@ } }, "node_modules/object-is": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.4.tgz", - "integrity": "sha512-1ZvAZ4wlF7IyPVOcE1Omikt7UpaFlOQq0HlSti+ZvDH3UiD2brwGMwDbyV43jao2bKJ+4+WdPJHSd7kgzKYVqg==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", + "call-bind": "^1.0.2", "define-properties": "^1.1.3" }, "engines": { @@ -3077,6 +3143,15 @@ "through2-filter": "^3.0.0" } }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -3309,6 +3384,26 @@ "strip-json-comments": "^3.1.1" } }, + "@homebridge/ciao": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@homebridge/ciao/-/ciao-1.1.2.tgz", + "integrity": "sha512-31IfDKMqxfT+uVNXj0/TmYMou57gP8CUrh0vABzsc5QMsoCQ4Oo5uYQp0oJJyzxTBkF2pFvjR3XlWAapl0VyCg==", + "dev": true, + "requires": { + "debug": "^4.3.1", + "fast-deep-equal": "^3.1.3", + "source-map-support": "^0.5.19", + "tslib": "^2.0.3" + }, + "dependencies": { + "tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", + "dev": true + } + } + }, "@nodelib/fs.scandir": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", @@ -3342,9 +3437,9 @@ "dev": true }, "@types/node": { - "version": "14.14.28", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.28.tgz", - "integrity": "sha512-lg55ArB+ZiHHbBBttLpzD07akz0QPrZgUODNakeC09i62dnrywr9mFErHuaPlB6I7z+sEbK+IYmplahvplCj2g==", + "version": "14.14.31", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.31.tgz", + "integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==", "dev": true }, "@typescript-eslint/eslint-plugin": { @@ -3509,6 +3604,12 @@ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true + }, "available-typed-arrays": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz", @@ -3727,12 +3828,6 @@ "ms": "2.1.2" } }, - "decimal.js": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz", - "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==", - "dev": true - }, "decompress-response": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", @@ -4127,9 +4222,9 @@ "dev": true }, "fast-srp-hap": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/fast-srp-hap/-/fast-srp-hap-2.0.2.tgz", - "integrity": "sha512-wABhZRrFhlovqJQ1HygOUB4R6WZW2hmlpvVYh2dVCy8BPLabDrB/Tu6XI3B4QfmhtHk8s1OeiFqJHY7FBsphug==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/fast-srp-hap/-/fast-srp-hap-2.0.3.tgz", + "integrity": "sha512-4P8TBD0all202L9FbeSsWc9qDlpaYp065VbUwbuNYZDYdOJ02UlWaDkai6d/+6/I8/sdtVYAVd17PEZDKbqopQ==", "dev": true }, "fastq": { @@ -4193,6 +4288,18 @@ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", "dev": true }, + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "fs-minipass": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", @@ -4361,19 +4468,36 @@ } } }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "dev": true + }, "hap-nodejs": { - "version": "0.7.10", - "resolved": "https://registry.npmjs.org/hap-nodejs/-/hap-nodejs-0.7.10.tgz", - "integrity": "sha512-582WHUCRVKFtw1ITYvKsGrGw2Hhc/AINej0LuFhCYvzPqVf2/m+v5PdgEt4wqyJSTM9rG5uoVYp1t/hoDnlLsw==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/hap-nodejs/-/hap-nodejs-0.9.1.tgz", + "integrity": "sha512-NtGTGf9UwT3QDZZiz23i8DwnlASPT5mmNADTge3AxvwlTo24CLVjDksTDaZCqKJlvcv/wwkmb7B548pdC+2ASg==", "dev": true, "requires": { + "@homebridge/ciao": "~1.1.2", "bonjour-hap": "~3.6.2", - "debug": "^4.1.1", - "decimal.js": "^10.2.0", - "fast-srp-hap": "2.0.2", + "debug": "^4.3.1", + "fast-srp-hap": "2.0.3", "futoin-hkdf": "~1.3.2", + "ip": "^1.1.3", "node-persist": "^0.0.11", + "source-map-support": "^0.5.19", + "tslib": "^2.1.0", "tweetnacl": "^1.0.3" + }, + "dependencies": { + "tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", + "dev": true + } } }, "has": { @@ -4409,17 +4533,17 @@ } }, "homebridge": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/homebridge/-/homebridge-1.1.7.tgz", - "integrity": "sha512-A+cf5ZBatZu34wEVc1S5ztNtNjIbA31jwOMSZ6so8TeAQfcIYJRDHueHD7FgslMxkHol27nXt9vVMrugH4LtLA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/homebridge/-/homebridge-1.3.0.tgz", + "integrity": "sha512-3ex//Kox7wmgkI0DgesLGJtb/BIEtcuq/IEsXLpz7Kcg9DB+gNXUE0vm3RmSxZX6jPOyRkTDkoLivy2HhiEX3Q==", "dev": true, "requires": { "chalk": "^4.1.0", "commander": "5.1.0", - "hap-nodejs": "^0.7.10", - "node-persist": "^0.0.11", + "fs-extra": "^9.1.0", + "hap-nodejs": "0.9.1", "qrcode-terminal": "^0.12.0", - "semver": "^7.3.2", + "semver": "^7.3.4", "source-map-support": "^0.5.19" } }, @@ -4680,6 +4804,16 @@ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, "leven": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", @@ -4851,12 +4985,12 @@ "dev": true }, "object-is": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.4.tgz", - "integrity": "sha512-1ZvAZ4wlF7IyPVOcE1Omikt7UpaFlOQq0HlSti+ZvDH3UiD2brwGMwDbyV43jao2bKJ+4+WdPJHSd7kgzKYVqg==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", "dev": true, "requires": { - "call-bind": "^1.0.0", + "call-bind": "^1.0.2", "define-properties": "^1.1.3" } }, @@ -5480,6 +5614,12 @@ "through2-filter": "^3.0.0" } }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 81b649c6..4e3a6f25 100644 --- a/package.json +++ b/package.json @@ -59,11 +59,11 @@ "README.md" ], "devDependencies": { - "@types/node": "^14.14.28", + "@types/node": "^14.14.31", "@typescript-eslint/eslint-plugin": "^4.15.1", "@typescript-eslint/parser": "^4.15.1", "eslint": "^7.20.0", - "homebridge": "^1.1.7", + "homebridge": "^1.3.0", "rimraf": "^3.0.2", "typescript": "^4.1.5" }, diff --git a/src/configTypes.ts b/src/configTypes.ts index 5272b28f..cd9874cb 100644 --- a/src/configTypes.ts +++ b/src/configTypes.ts @@ -9,7 +9,6 @@ export type FfmpegPlatformConfig = { tlsmqtt?: boolean; usermqtt?: string; passmqtt?: string; - topic?: string; porthttp?: number; localhttp?: boolean; cameras?: Array; diff --git a/src/index.ts b/src/index.ts index 41142f21..6de3aa7a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -183,14 +183,6 @@ class FfmpegPlatform implements DynamicPlatformPlugin { {accessory: accessory, active: true, doorbell: true}); } } - if (this.config.topic) { - this.addMqttAction(this.config.topic + '/motion', cameraConfig.name!, - {accessory: accessory, active: true, doorbell: false}); - this.addMqttAction(this.config.topic + '/motion/reset', cameraConfig.name!, - {accessory: accessory, active: false, doorbell: false}); - this.addMqttAction(this.config.topic + '/doorbell', cameraConfig.name!, - {accessory: accessory, active: true, doorbell: true}); - } } }