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

node-red-contrib-deconz

Package Overview
Dependencies
Maintainers
1
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-deconz - npm Package Compare versions

Comparing version 0.5.6 to 0.6.0

static/js/node-red-contrib-deconz-event.js

112

deconz.js

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

node.meta = deviceMeta;
node.sendState(deviceMeta);
if (node.config.outputAtStartup) {
node.sendState(deviceMeta);
}
} else {

@@ -142,2 +144,3 @@ node.status({

//*************** GET Node ***************

@@ -400,2 +403,20 @@ function deConzItemGet(config) {

//*************** Event Node ***************
function deConzItemEvent(config) {
RED.nodes.createNode(this, config);
var node = this;
node.config = config;
node.cleanTimer = null;
node.status({}); //clean
//get server node
node.server = RED.nodes.getNode(config.server);
if (!node.server) return status_no_server(node);
devices[node.id] = 'event';
}
RED.nodes.registerType("deconz-event", deConzItemEvent);
//*************** Server Node ***************

@@ -415,3 +436,3 @@ function deConzServerNode(n) {

this.discoverDevices = function (callback, forceRefresh = false) {
node.discoverDevices = function (callback, forceRefresh = false) {
if (forceRefresh || node.items === undefined) {

@@ -465,3 +486,3 @@ node.log('discoverDevices: Refreshing devices list');

this.getDeviceMeta = function (callback, uniqueid) {
node.getDeviceMeta = function (callback, uniqueid) {
var result = null;

@@ -485,3 +506,3 @@

this.getItemsList = function (callback, forceRefresh = false) {
node.getItemsList = function (callback, forceRefresh = false) {
node.discoverDevices(function(items){

@@ -542,2 +563,18 @@ node.items_list = [];

if ("event" == item && "t" in dataParsed && dataParsed.t == "event") {
var node = RED.nodes.getNode(nodeId);
if (node && "type" in node && node.type === "deconz-event") {
var serverNode = RED.nodes.getNode(node.server.id);
node.send({'payload': dataParsed, 'device': serverNode.items[dataParsed.uniqueid]});
clearTimeout(node.cleanTimer);
node.status({
fill: "green",
shape: "dot",
text: 'event'
});
node.cleanTimer = setTimeout(function () {
node.status({}); //clean
}, 3000);
}
}

@@ -602,41 +639,2 @@ if (dataParsed.uniqueid === item) {

// break;
// case "ZHALightLevel":
// // characteristic.CurrentRelativeHumidity = state.humidity;
// break;
// case "ZHAPresence":
// // characteristic.CurrentRelativeHumidity = state.humidity;
// break;
// case "ZHAOpenClose":
// // characteristic.ContactSensorState = state.humidity;
// break;
// case "ZHASwitch":
// // characteristic.ContactSensorState = state.humidity;
// break;
// case "CLIPLightlevel":
// // characteristic.ContactSensorState = state.humidity;
// break;
// case "CLIPHumidity":
// // characteristic.ContactSensorState = state.humidity;
// break;
// case "CLIPTemperature":
// // characteristic.ContactSensorState = state.humidity;
// break;
// case "CLIPPresence":
// // characteristic.ContactSensorState = state.humidity;
// break;
// case "CLIPOpenClose":
// // characteristic.ContactSensorState = state.humidity;
// break;
// case "CLIPSwitch":
// // characteristic.ContactSensorState = state.humidity;
// break;
// case "CLIPGenericStatus":
// // characteristic.ContactSensorState = state.humidity;
// break;
// case "CLIPGenericFlag":
// // characteristic.ContactSensorState = state.humidity;
// break;
// case "Daylight":
// // characteristic.ContactSensorState = state.humidity;
// break;
// }

@@ -646,7 +644,7 @@ // }

if (state['temperature'] !== undefined){
characteristic.CurrentTemperature = state.temperature/100;
characteristic.CurrentTemperature = state['temperature']/100;
}
if (state['humidity'] !== undefined){
characteristic.CurrentRelativeHumidity = state.humidity/100;
characteristic.CurrentRelativeHumidity = state['humidity']/100;
}

@@ -657,5 +655,5 @@

}
if (state['fire'] !== undefined){
characteristic.SmokeDetected = state.fire;
characteristic.SmokeDetected = state['fire'];
}

@@ -671,33 +669,33 @@

if (state['presence'] !== undefined){
characteristic.MotionDetected = state.presence;
characteristic.MotionDetected = state['presence'];
}
if (state['open'] !== undefined){
characteristic.ContactSensorState = state.open;
characteristic.ContactSensorState = state['open'];
}
if (state['vibration'] !== undefined){
characteristic.ContactSensorState = state.vibration;
characteristic.ContactSensorState = state['vibration'];
}
if (state['on'] !== undefined){
characteristic.On = state.on;
characteristic.On = state['on'];
}
if (state['bri'] !== undefined){
characteristic.Brightness = state.bri/2.55
characteristic.Brightness = state['bri']/2.55
}
if (state['hue'] !== undefined){
characteristic.Hue = state.hue/182;
characteristic.Hue = state['hue']/182;
}
if (state['sat'] !== undefined){
characteristic.Saturation = state.sat/2.55
characteristic.Saturation = state['sat']/2.55
}
if (state['ct'] !== undefined){
characteristic.ColorTemperature = state.ct;
if (state.ct < 140) characteristic.ColorTemperature = 140;
else if (state.ct > 500) characteristic.ColorTemperature = 500;
characteristic.ColorTemperature = state['ct'];
if (state['ct'] < 140) characteristic.ColorTemperature = 140;
else if (state['ct'] > 500) characteristic.ColorTemperature = 500;
}

@@ -704,0 +702,0 @@ }

@@ -34,3 +34,3 @@ {

},
"version": "0.5.6"
"version": "0.6.0"
}

@@ -21,2 +21,6 @@ RED.nodes.registerType('deconz-input', {

value: ""
},
outputAtStartup: {
value: true,
required: true,
}

@@ -23,0 +27,0 @@ },

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