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
2
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 2.0.0-beta.5 to 2.0.0-beta.6

25

nodes/battery.js

@@ -6,2 +6,20 @@ const OutputMsgFormatter = require("../src/runtime/OutputMsgFormatter");

module.exports = function (RED) {
const defaultConfig = {
name: "",
topic: "",
search_type: "device",
device_list: [],
device_name: "",
query: "",
outputs: 0,
output_rules: []
};
const defaultRule = {
type: "config",
format: "single",
onstart: true
};
class deConzItemBattery {

@@ -35,2 +53,5 @@ constructor(config) {

// Make sure that all expected config are defined
node.config = Object.assign({}, defaultConfig, node.config);
if (node.config.search_type === "device") {

@@ -53,3 +74,5 @@ node.config.device_list.forEach(function (item) {

}, opt);
this.config.output_rules.forEach((rule, index) => {
this.config.output_rules.forEach((saved_rule, index) => {
// Make sure that all expected config are defined
const rule = Object.assign({}, defaultRule, saved_rule);
// Only if it's not on start and the start msg are blocked

@@ -56,0 +79,0 @@ if (!(options.initialEvent === true && rule.onstart !== true)) {

@@ -7,2 +7,18 @@ const ConfigMigration = require("../src/migration/ConfigMigration");

module.exports = function (RED) {
const defaultConfig = {
name: "",
search_type: "device",
device_list: [],
device_name: "",
query: "",
outputs: 0,
output_rules: [],
};
const defaultRule = {
type: "state",
format: "single"
};
class deConzItemGet {

@@ -38,2 +54,4 @@ constructor(config) {

// Make sure that all expected config are defined
node.config = Object.assign({}, defaultConfig, node.config);

@@ -88,3 +106,6 @@ if (node.config.search_type === 'device' && node.config.device_list.length === 0) {

node.config.output_rules.forEach((rule, index) => {
node.config.output_rules.forEach((saved_rule, index) => {
// Make sure that all expected config are defined
const rule = Object.assign({}, defaultRule, saved_rule);
// Only if it's not on start and the start msg are blocked

@@ -91,0 +112,0 @@

@@ -7,2 +7,24 @@ const dotProp = require('dot-prop');

module.exports = function (RED) {
const defaultConfig = {
name: "",
topic: "",
search_type: "device",
device_list: [],
device_name: "",
query: "",
outputs: 0,
output_rules: [],
};
const defaultRule = {
type: "state",
format: "single",
output: "always",
onstart: true,
payload: [
"__complete__"
]
};
class deConzItemIn {

@@ -42,2 +64,5 @@ constructor(config) {

// Make sure that all expected config are defined
node.config = Object.assign({}, defaultConfig, node.config);
if (node.config.search_type === "device") {

@@ -62,2 +87,3 @@ node.config.device_list.forEach(function (item) {

//TODO wait for migration before sending events
handleDeconzEvent(device, changed, rawEvent, opt) {

@@ -70,3 +96,5 @@ let node = this;

}, opt);
this.config.output_rules.forEach((rule, index) => {
this.config.output_rules.forEach((saved_rule, index) => {
// Make sure that all expected config are defined
const rule = Object.assign({}, defaultRule, saved_rule);
// Only if it's not on start and the start msg are blocked

@@ -73,0 +101,0 @@ if (!(options.initialEvent === true && rule.onstart !== true)) {

@@ -5,5 +5,48 @@ const CommandParser = require("../src/runtime/CommandParser");

const ConfigMigration = require("../src/migration/ConfigMigration");
const dotProp = require("dot-prop");
const NodeType = 'deconz-output';
module.exports = function (RED) {
const defaultConfig = {
search_type: 'device',
device_list: [],
device_name: '',
query: '',
commands: [],
specific: {
delay: {type: 'num', value: '50'},
result: {type: 'at_end', value: ''}
}
};
const defaultCommand = {
type: "deconz_state",
domain: "lights",
arg: {
on: {type: "keep", value: ""},
alert: {type: "str", value: ""},
effect: {type: "str", value: ""},
colorloopspeed: {type: "num", value: ""},
open: {type: "keep", value: ""},
stop: {type: "keep", value: ""},
lift: {type: "num", value: ""},
tilt: {type: "num", value: ""},
group: {type: "num", value: ""},
scene: {type: "num", value: ""},
target: {type: "state", value: ""},
command: {type: "str", value: "on"},
payload: {type: "msg", value: "payload"},
delay: {type: "num", value: "2000"},
transitiontime: {type: "num", value: ""},
retryonerror: {type: "num", value: "0"},
aftererror: {type: "continue", value: ""},
bri: {direction: "set", type: "num", value: ""},
sat: {direction: "set", type: "num", value: ""},
hue: {direction: "set", type: "num", value: ""},
ct: {direction: "set", type: "num", value: ""},
xy: {direction: "set", type: "json", value: "[]"}
}
};
class deConzOut {

@@ -38,2 +81,5 @@ constructor(config) {

}
// Make sure that all expected config are defined
node.config = Object.assign({}, defaultConfig, node.config);
});

@@ -84,3 +130,5 @@

for (const [id, command] of node.config.commands.entries()) {
for (const [id, saved_command] of node.config.commands.entries()) {
// Make sure that all expected config are defined
const command = Object.assign({}, defaultCommand, saved_command);
if (command.type === 'pause') {

@@ -138,3 +186,3 @@ await Utils.sleep(Utils.getNodeProperty(command.arg.delay, this, message_in), 2000);

}
await Utils.sleep(delay - response.timings.phases.total);
await Utils.sleep(delay - dotProp.get(response, 'timings.phases.total', 0));
} catch (error) {

@@ -151,4 +199,4 @@ if (resultTiming !== 'never') {

type: 0,
code: error.response.statusCode,
message: error.response.statusMessage,
code: dotProp.get(error, 'response.statusCode'),
message: dotProp.get(error, 'response.statusMessage'),
description: `${error.name}: ${error.message}`,

@@ -168,3 +216,3 @@ apiEndpoint: request.endpoint

if (error.timings !== undefined) {
await Utils.sleep(delay - error.timings.phases.total);
await Utils.sleep(delay - dotProp.get(error, 'timings.phases.total', 0));
} else {

@@ -171,0 +219,0 @@ await Utils.sleep(delay);

2

package.json

@@ -51,3 +51,3 @@ {

},
"version": "2.0.0-beta.5",
"version": "2.0.0-beta.6",
"devDependencies": {

@@ -54,0 +54,0 @@ "grunt": "^1.3.0",

@@ -309,2 +309,6 @@ const ConfigMigrationHandler = require('./ConfigMigrationHandler');

if (this.config.command !== 'on')
command.arg.on = {type: 'set', value: 'true'};
if (this.config.command === 'bri' && !isNaN(this.config.payload))
command.arg.on = {type: 'set', value: Number(this.config.payload) > 0 ? 'true' : 'false'};
break;

@@ -311,0 +315,0 @@

@@ -23,2 +23,3 @@ const REDUtil = require("@node-red/util/lib/util");

static getNodeProperty(property, node, message_in, noValueTypes) {
if (typeof property !== 'object') return;
return Array.isArray(noValueTypes) && noValueTypes.includes(property.type) ?

@@ -25,0 +26,0 @@ property.type :

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