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

homebridge-syntex-webhooks

Package Overview
Dependencies
Maintainers
1
Versions
1176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-syntex-webhooks - npm Package Compare versions

Comparing version 1.0.5-b23 to 1.0.5-b24

99

index.js

@@ -45,3 +45,3 @@ var request = require('request');

{
var Sensor = new SynTexWebHookSensorAccessory(this.sensors[i], storage);
var Sensor = new SynTexWebHookSensorAccessory(this.sensors[i]);
accessories.push(Sensor);

@@ -52,3 +52,3 @@ }

{
var Switch = new SynTexWebHookSwitchAccessory(this.switches[i], storage);
var Switch = new SynTexWebHookSwitchAccessory(this.switches[i]);
accessories.push(Switch);

@@ -104,3 +104,38 @@ }

updateDevice(device);
updateDevice(device).then(function(res) {
for(var i = 0; i < accessories.length; i++)
{
var accessory = accessories[i];
if(accessory.mac === urlParams.mac)
{
if(urlParams.type)
{
if(accessory.type === urlParams.type)
{
if(urlParams.value == 'true' || urlParams.value == 'false')
{
accessory.changeHandler((urlParams.value === 'true'));
}
else
{
accessory.changeHandler(urlParams.value);
}
}
}
else
{
if(urlParams.value == 'true' || urlParams.value == 'false')
{
accessory.changeHandler((urlParams.value === 'true'));
}
else
{
accessory.changeHandler(urlParams.value);
}
}
}
}
});

@@ -174,3 +209,3 @@ response.write("Success");

function SynTexWebHookSensorAccessory(sensorConfig, storage)
function SynTexWebHookSensorAccessory(sensorConfig)
{

@@ -181,3 +216,2 @@ this.mac = sensorConfig["mac"];

this.type = sensorConfig["type"];
storage = storage;

@@ -354,3 +388,3 @@ if(this.type === "contact")

function SynTexWebHookSwitchAccessory(switchConfig, storage)
function SynTexWebHookSwitchAccessory(switchConfig)
{

@@ -371,3 +405,2 @@ this.mac = switchConfig["mac"];

this.offHeaders = switchConfig["off_headers"] || "{}";
storage = storage;

@@ -535,27 +568,35 @@ this.service = new Service.Switch(this.name);

function updateDevice(obj)
async function updateDevice(obj)
{
if(obj.type)
{
var device = {
id: obj.mac,
value: obj.value,
type: obj.type
};
}
else
{
var device = {
id: obj.mac,
value: obj.value
};
}
return new Promise(resolve => {
if(obj.type)
{
var device = {
id: obj.mac,
value: obj.value,
type: obj.type
};
}
else
{
var device = {
id: obj.mac,
value: obj.value
};
}
storage.add(device, (err) => {
storage.add(device, (err) => {
if(err)
{
log('\x1b[31m%s\x1b[0m', "[ERROR]", "Storage.json konnte nicht aktualisiert werden!");
}
});
if(err)
{
log('\x1b[31m%s\x1b[0m', "[ERROR]", "Storage.json konnte nicht aktualisiert werden!");
resolve(false);
}
else
{
resolve(true);
}
});
});
}
{
"name": "homebridge-syntex-webhooks",
"version": "1.0.5-b23",
"version": "1.0.5-b24",
"description": "A webhook plugin for HTTP devices",

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

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