Skip to content

Commit

Permalink
Add support for list of Node IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjohnsontv committed Apr 19, 2021
1 parent fffdb53 commit ebce4a5
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 41 deletions.
48 changes: 24 additions & 24 deletions nodes/inovelli-led-manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
</div>
<div class="form-row nodeid-input">
<label for="node-input-nodeid"><i class="icon-tag"></i>Node ID</label>
<input type="number" id="node-input-nodeid" min="1">
<input type="text" id="node-input-nodeid">
</div>
<div class="form-row entityid-input">
<label for="node-input-entityid"><i class="icon-tag"></i>Entity ID</label>
Expand Down Expand Up @@ -286,37 +286,37 @@
</script>

<script type="text/x-red" data-help-name="inovelli-led-manager">
<p>This node will help construct the value for controlling LED notifications on an Inovelli Red Series switch. The output should be connected to a Home Assistant call service node.</p>
<dl class="message-properties">
<dt>Z-Wave Integration<span class="property-type">string</span></dt>
<dd>Your Z-Wave integration used in Home Assistant (zwave_js, ozw, or zwave)</dd>
<p>This node will help construct the value for controlling LED notifications on an Inovelli Red Series switch. The output should be connected to a Home Assistant call service node.</p>
<dl class="message-properties">
<dt>Z-Wave Integration<span class="property-type">string</span></dt>
<dd>Your Z-Wave integration used in Home Assistant (zwave_js, ozw, or zwave)</dd>

<dt>Entity ID<span class="property-type">string</span></dt>
<dd>(For Z-Wave JS) Entity (or a comma-delimited list of entity IDs) to set the configuration parameter on</dd>
<dt>Entity ID<span class="property-type">string</span></dt>
<dd>(For Z-Wave JS) Entity (or a comma-delimited list of entity IDs) to set the configuration parameter on</dd>

<dt>Node ID<span class="property-type">number</span></dt>
<dd>(For OpenZWave or Z-Wave) Node ID of the Inovelli switch you are trying to configure</dd>
<dt>Node ID<span class="property-type">number</span></dt>
<dd>(For OpenZWave or Z-Wave) Node ID (or a comma-delimited list of Node IDs) of the Inovelli switch you are trying to configure</dd>

<dt>Switch Series<span class="property-type">string</span></dt>
<dd>The series of your Inovelli switch. (Black or Red))</dd>
<dt>Switch Series<span class="property-type">string</span></dt>
<dd>The series of your Inovelli switch. (Black or Red))</dd>

<dt>Switch Type<span class="property-type">number|string</span></dt>
<dd>Determines which parameters to set. (On/Off, Dimmer, Fan/Light Dimmer)</dd>
<dt>Switch Type<span class="property-type">number|string</span></dt>
<dd>Determines which parameters to set. (On/Off, Dimmer, Fan/Light Dimmer)</dd>

<dt>Color<span class="property-type">number|string|array</span></dt>
<dd>Color you want to display (accepts color names, RGB arrays, hexadeciaml and 0-360 hue values)</dd>
<dt>Color<span class="property-type">number|string|array</span></dt>
<dd>Color you want to display (accepts color names, RGB arrays, hexadeciaml and 0-360 hue values)</dd>

<dt>Brightness Level (On)<span class="property-type">number</span></dt>
<dd>Brightness level of the LED light (0-10) when on</dd>
<dt>Brightness Level (On)<span class="property-type">number</span></dt>
<dd>Brightness level of the LED light (0-10) when on</dd>

<dt>Brightness Level (Off)<span class="property-type">number</span></dt>
<dd>Brightness level of the LED light (0-10) when off</dd>
<dt>Brightness Level (Off)<span class="property-type">number</span></dt>
<dd>Brightness level of the LED light (0-10) when off</dd>

<dt>LZW36: Fan Brightness Level (On)<span class="property-type">number</span></dt>
<dd>Brightness level of the LED light (0-10) when on</dd>
<dt>LZW36: Fan Brightness Level (On)<span class="property-type">number</span></dt>
<dd>Brightness level of the LED light (0-10) when on</dd>

<dt>LZW36: Fan Brightness Level (Off)<span class="property-type">number</span></dt>
<dd>Brightness level of the LED light (0-10) when off</dd>
<dt>LZW36: Fan Brightness Level (Off)<span class="property-type">number</span></dt>
<dd>Brightness level of the LED light (0-10) when off</dd>

</dl>
</dl>
</script>
27 changes: 20 additions & 7 deletions nodes/inovelli-led-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ module.exports = function (RED) {
fanHSL = [convert.rgb.hsl(fanColor)[0], 100, 50];
fanKeyword = convert.rgb.keyword(convert.hsl.rgb(fanHSL));
fanHue = parseInt((fanHSL[0] * (17 / 24)).toFixed(0));
node.status(`Fan Color: ${fanKeyword}, On/Off:${fanBrightness}/${fanBrightnessOff}`);
node.status(
`Fan Color: ${fanKeyword}, On/Off:${fanBrightness}/${fanBrightnessOff}`
);
params = {
20: fanHue,
21: fanBrightness,
Expand All @@ -213,7 +215,9 @@ module.exports = function (RED) {
lightHSL = [convert.rgb.hsl(lightColor)[0], 100, 50];
lightKeyword = convert.rgb.keyword(convert.hsl.rgb(lightHSL));
lightHue = parseInt((lightHSL[0] * (17 / 24)).toFixed(0));
node.status(`Light Color: ${lightKeyword}, On/Off:${lightBrightness}/${lightBrightnessOff}`);
node.status(
`Light Color: ${lightKeyword}, On/Off:${lightBrightness}/${lightBrightnessOff}`
);
params = {
18: lightHue,
19: lightBrightness,
Expand All @@ -224,7 +228,9 @@ module.exports = function (RED) {
lightHSL = [convert.rgb.hsl(lightColor)[0], 100, 50];
lightKeyword = convert.rgb.keyword(convert.hsl.rgb(lightHSL));
lightHue = parseInt((lightHSL[0] * (17 / 24)).toFixed(0));
node.status(`Light Color: ${lightKeyword}, On/Off:${lightBrightness}/${lightBrightnessOff}`);
node.status(
`Light Color: ${lightKeyword}, On/Off:${lightBrightness}/${lightBrightnessOff}`
);
params = {
13: lightHue,
14: lightBrightness,
Expand All @@ -235,7 +241,9 @@ module.exports = function (RED) {
lightHSL = [convert.rgb.hsl(lightColor)[0], 100, 50];
lightKeyword = convert.rgb.keyword(convert.hsl.rgb(lightHSL));
lightHue = parseInt((lightHSL[0] * (17 / 24)).toFixed(0));
node.status(`Light Color: ${lightKeyword}, On/Off:${lightBrightness}/${lightBrightnessOff}`);
node.status(
`Light Color: ${lightKeyword}, On/Off:${lightBrightness}/${lightBrightnessOff}`
);
params = {
5: lightHue,
6: lightBrightness,
Expand All @@ -261,11 +269,16 @@ module.exports = function (RED) {
if (domain === "zwave_js") {
const entity_id = payload.entity_id || entityid;
id = entity_id ? { entity_id } : {};
generateMsg(id);
} else if (["ozw", "zwave"].includes(domain)) {
const node_id = payload.node_id || nodeid;
id = node_id ? { node_id } : {};
var node_id = payload.node_id || nodeid;
const nodes = node_id.split(",").map(Number);
for (let x in nodes) {
node_id = nodes[x];
id = node_id ? { node_id } : {};
generateMsg(id);
}
}
generateMsg(id);
} else {
node.status(`Error! Check debug window for more info`);
}
Expand Down
5 changes: 2 additions & 3 deletions nodes/inovelli-notification-manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<option value="5">Pulse</option>`;

$("#node-input-zwave").change(function () {
var zwave = $("#node-input-zwave").val();
switch (this.value) {
case "zwave_js":
$(".nodeid-input").hide();
Expand Down Expand Up @@ -154,7 +153,7 @@
</div>
<div class="form-row nodeid-input">
<label for="node-input-nodeid"><i class="icon-tag"></i>Node ID</label>
<input type="number" id="node-input-nodeid" min="1">
<input type="text" id="node-input-nodeid">
</div>
<div class="form-row entityid-input">
<label for="node-input-entityid"><i class="icon-tag"></i>Entity ID</label>
Expand Down Expand Up @@ -242,7 +241,7 @@
<dd>(For Z-Wave JS) Entity (or a comma-delimited list of entity IDs) to set the configuration parameter on</dd>

<dt>Node ID<span class="property-type">number</span></dt>
<dd>(For OpenZWave or Z-Wave) Node ID of the Inovelli switch you are trying to configure</dd>
<dd>(For OpenZWave or Z-Wave) Node ID (or a comma-delimited list of node IDs) of the Inovelli switch you are trying to configure</dd>

<dt>Switch Type<span class="property-type">number|string</span></dt>
<dd>Determines which parameter to set. (LZW30-SN, LZW31-SN, LZW36 (fan and/or light))</dd>
Expand Down
13 changes: 9 additions & 4 deletions nodes/inovelli-notification-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function (RED) {

this.zwave = zwave;
this.entityid = entityid;
this.nodeid = parseInt(nodeid, 10);
this.nodeid = nodeid;
this.color = parseInt(color, 10);
this.brightness = parseInt(brightness, 10);
this.duration = parseInt(duration, 10);
Expand Down Expand Up @@ -289,12 +289,17 @@ module.exports = function (RED) {
const entity_id = payload.entity_id || entityid;
id = entity_id ? { entity_id } : {};
service = "bulk_set_partial_config_parameters";
sendNotification(service, id);
} else if (["ozw", "zwave"].includes(domain)) {
const node_id = payload.node_id || nodeid;
id = node_id ? { node_id } : {};
var node_id = payload.node_id || nodeid;
const nodes = node_id.split(",").map(Number);
service = "set_config_parameter";
for (let x in nodes) {
node_id = nodes[x];
id = node_id ? { node_id } : {};
sendNotification(service, id);
}
}
sendNotification(service, id);
} else {
node.status(`Error! Check debug window for more info`);
}
Expand Down
2 changes: 1 addition & 1 deletion nodes/inovelli-scene-manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<dd>Your Z-Wave integration used in Home Assistant (zwave_js or ozw)</dd>

<dt>Node ID<span class="property-type">number</span></dt>
<dd>Node ID, or a comma delimited list of Node IDs, of the Inovelli switch you are trying to configure</dd>
<dd>Node ID (or a comma-delimited list of node IDs) of the Inovelli switch you are trying to configure</dd>

<dt>Switch Type<span class="property-type">number|string</span></dt>
<dd>Determines which Inovelli switch is being used. (LZW30-SN, LZW31-SN, LZW36, LZW45)</dd>
Expand Down
3 changes: 2 additions & 1 deletion nodes/inovelli-scene-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = function (RED) {
const { payload } = msg;
const domain = payload.event.domain;
const event_type = payload.event_type;
const nodes = nodeid.split(',').map(Number);
const node_id = parseInt(payload.event.node_id);
const event_types = {
zwave_js: "zwave_js_value_notification",
Expand Down Expand Up @@ -42,7 +43,7 @@ module.exports = function (RED) {
}
validateDomain(presetZwave, domain);

if (nodeid.includes(node_id) === true && error === 0) {
if (nodes.includes(node_id) === true && error === 0) {
const LZW30Map = {
0: {
button: 2,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-ha-inovelli-manager",
"version": "0.0.3",
"version": "0.0.4",
"repository": {
"type": "git",
"url": "https://github.com/ryanjohnsontv/node-red-contrib-ha-inovelli-manager.git"
Expand Down

0 comments on commit ebce4a5

Please sign in to comment.