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 0.1.0 to 0.1.1

21

config.schema.json

@@ -20,3 +20,4 @@ {

"type": "string",
"placeholder": "127.0.0.1"
"placeholder": "127.0.0.1",
"description": "The address of your MQTT server."
},

@@ -26,3 +27,4 @@ "port": {

"type": "integer",
"placeholder": "1883"
"placeholder": "1883",
"description": "The port of your MQTT server."
},

@@ -41,13 +43,18 @@ "cameras": {

"type": "string",
"placeholder": "Camera Name"
},
"required": true,
"description": "Name of your camera. (Needs to be the same as in homebridge-camera-ffmpeg config)"
},
"dafang_topic": {
"title": "Dafang MQTT Topic",
"type": "string",
"placeholder": "myhome/dafang"
},
"required": true,
"placeholder": "myhome/dafang",
"description": "MQTT topic that your camera publishes to."
},
"homebridge_topic": {
"title": "Homebridge MQTT Topic",
"type": "string",
"placeholder": "homebridge/motion"
"required": true,
"placeholder": "homebridge/motion",
"description": "MQTT topic that homebridge-camera-ffmpeg is subscribed to."
}

@@ -54,0 +61,0 @@ }

@@ -23,5 +23,5 @@ const mqtt = require('mqtt');

this.log('MQTT Connection Opened');
this.config.cameras.forEach(camera => {
client.subscribe(camera.dafang_topic + '/motion');
});
this.config.cameras.forEach(camera => {
client.subscribe(camera.dafang_topic + '/motion');
});
});

@@ -31,11 +31,14 @@ client.on('message', (topic, message) => {

this.log.debug('Received MQTT Message - ' + topic + ': ' + msg);
this.config.cameras.forEach(camera => {
if (camera.dafang_topic + '/motion' == topic) {
if (msg == 'ON') {
this.log.debug('Publishing MQTT Message - ' + camera.homebridge_topic + ': ' + camera.name);
client.publish(camera.homebridge_topic, camera.name);
}
}
});
this.config.cameras.forEach(camera => {
if (camera.dafang_topic + '/motion' == topic) {
if (msg == 'ON') {
this.log.debug('Publishing MQTT Message - ' + camera.homebridge_topic + ': ' + camera.name);
client.publish(camera.homebridge_topic, camera.name);
} else if (msg == 'OFF') {
this.log.debug('Publishing MQTT Message - ' + camera.homebridge_topic + '/reset: ' + camera.name);
client.publish(camera.homebridge_topic + '/reset', camera.name);
}
}
});
});
}
{
"displayName": "Homebridge Dafang MQTT Republish",
"name": "homebridge-dafang-mqtt-republish",
"version": "0.1.0",
"version": "0.1.1",
"description": "Republishes MQTT Motion Messages from Dafang Hacks into a Format homebridge-camera-ffmpeg Understands",

@@ -6,0 +6,0 @@ "repository": {

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