Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

homebridge-dafang-mqtt-republish

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-dafang-mqtt-republish - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

11

config.schema.json

@@ -34,8 +34,2 @@ {

},
"homebridge_topic": {
"title": "Homebridge MQTT Topic",
"type": "string",
"placeholder": "homebridge",
"description": "MQTT topic that homebridge-camera-ffmpeg is subscribed to."
},
"cameras": {

@@ -63,7 +57,2 @@ "title": "Cameras",

},
"cooldown": {
"title": "Cooldown",
"type": "boolean",
"description": "Follow cooldown defined in the Homebridge Camera FFmpeg config."
},
"manufacturer": {

@@ -70,0 +59,0 @@ "title": "Manufacturer",

38

dist/index.js

@@ -20,10 +20,2 @@ "use strict";

this.mqttUrl = (this.config.tls ? 'mqtts://' : 'mqtt://') + server + ':' + port;
if (config.homebridge_topic) {
if (config.homebridge_topic == 'homebridge/motion') {
this.homebridge_topic = 'homebridge';
}
else {
this.homebridge_topic = config.homebridge_topic;
}
}
const cameraConfigs = config.cameras || [];

@@ -35,3 +27,3 @@ if (cameraConfigs.length == 0) {

cameraConfigs.forEach((camera) => {
this.log.info('Configuring "' + camera.name + '" on topic "' + camera.dafang_topic + (camera.cooldown ? '".' : '" with no cooldown.'));
this.log.info('Configuring "' + camera.name + '" on topic "' + camera.dafang_topic + '".');
let error = false;

@@ -57,5 +49,3 @@ if (!camera.name) {

name: camera.name,
dafang_topic: camera.dafang_topic,
cooldown: camera.cooldown || false,
motion: false
dafang_topic: camera.dafang_topic
});

@@ -428,23 +418,2 @@ }

}
handleMotion(camera, message) {
if (this.homebridge_topic) {
const isOn = this.parseBoolMsg(message);
if (isOn === undefined) {
return;
}
if (isOn) {
camera.motion = true;
this.publishMqtt(this.homebridge_topic + '/motion', camera.name);
}
else {
camera.motion = false;
if (!camera.cooldown) {
this.publishMqtt(this.homebridge_topic + '/motion/reset', camera.name);
}
else {
this.log.debug('Motion clear received, but following homebridge-camera-ffmpeg cooldown instead: ' + camera.name);
}
}
}
}
getService(accessory, type, subtype) {

@@ -508,5 +477,2 @@ if (accessory) {

switch (command) {
case '/motion':
this.handleMotion(camera, msg);
break;
case '/leds/blue':

@@ -513,0 +479,0 @@ this.handleBoolService(accessory, hap.Service.Lightbulb, '/leds/blue', msg);

2

package.json
{
"displayName": "Homebridge Dafang MQTT Republish",
"name": "homebridge-dafang-mqtt-republish",
"version": "2.2.0",
"version": "2.3.0",
"description": "Routes Dafang Hacks Motion Messages to homebridge-camera-ffmpeg and Exposes Features to HomeKit",

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

@@ -5,4 +5,6 @@ # homebridge-dafang-mqtt-republish

This plugin republishes MQTT motion messages from [Dafang Hacks](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks) into a format [homebridge-camera-ffmpeg](https://github.com/homebridge-plugins/homebridge-camera-ffmpeg) understands.
This plugin handles MQTT messages from [Dafang Hacks](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks) to allow control of many features from within HomeKit.
The "republish" in the name is because this started as a way to to republish motion MQTT messages for [homebridge-camera-ffmpeg](https://github.com/homebridge-plugins/homebridge-camera-ffmpeg), but that plugin now can handle MQTT messages from Dafang Hacks directly when properly configured, so that functionality has been removed from this.
## Installation

@@ -27,3 +29,2 @@

"port": 1883,
"homebridge_topic": "homebridge",
"cameras": [

@@ -42,7 +43,5 @@ {

- `tls`: Use TLS to connect to the MQTT server. (Default: false)
- `homebridge_topic`: MQTT topic that homebridge-camera-ffmpeg is subscribed to. If not set, motion alerts will not be passed on.
- `cameras`: _(Required)_ Array of Dafang Hacks camera configs (multiple supported).
- `name`: _(Required)_ Name of your camera. (Needs to be the same as in homebridge-camera-ffmpeg config)
- `dafang_topic`: _(Required)_ MQTT topic that your camera publishes to. (Must be unique per camera)
- `cooldown`: Follow cooldown defined in the Homebridge Camera FFmpeg config. (Default: false)
- `manufacturer`: Manufacturer for exposed accessories.

@@ -49,0 +48,0 @@ - `model`: Model for exposed accessories.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc