Skip to content

Commit

Permalink
added more functionality, normalise hashmaps emitted and consumed by …
Browse files Browse the repository at this point in the history
…OZW, better logging
  • Loading branch information
ekarak committed Sep 10, 2014
1 parent d52bbc9 commit 10c45f7
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 270 deletions.
103 changes: 27 additions & 76 deletions 10-zwave.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,135 +32,86 @@
</div>
</script>

<script type="text/x-red" data-template-name="zwave-node">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Node Name</label>
<input type="text" id="node-input-name" placeholder="Entrance light switch">
</div>
<div class="form-row">
<label for="node-input-controller"><i class="icon-bookmark"></i> Controller</label>
<input type="text" id="node-input-controller">
</div>
</script>

<script type="text/x-red" data-template-name="zwave-in">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Node Name</label>
<input type="text" id="node-input-name" placeholder="Entrance light switch">
</div>
<input type="text" id="node-input-name" placeholder="ZWave command">
</div>
<div class="form-row">
<label for="node-input-controller"><i class="icon-bookmark"></i> Controller</label>
<input type="text" id="node-input-controller">
</div>
<div class="form-row">
<label for="node-input-nodeid"><i class="icon-bookmark"></i> ZWave Node Id</label>
<input type="text" id="node-input-nodeid">
</div>
<div class="form-row">
<label for="node-input-cmdclass"><i class="icon-bookmark"></i> ZWave Command Class</label>
<select style="width: 90px" id="node-input-cmdclass" value="37">
<option value="37">COMMAND_CLASS_SWITCH_BINARY (switches/relays)</option>
<option value="38">COMMAND_CLASS_SWITCH_MULTILEVEL (dimmers)</option>
</select>
</div>
<div class="form-row">
<label for="node-input-cmdidx"><i class="icon-bookmark"></i> ZWave Command Index</label>
<input type="text" id="node-input-cmdidx">
</div>

</script>

<script type="text/x-red" data-template-name="zwave-out">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Node Name</label>
<input type="text" id="node-input-name" placeholder="Entrance light switch">
<input type="text" id="node-input-name" placeholder="ZWave status">
</div>
<div class="form-row">
<label for="node-input-controller"><i class="icon-bookmark"></i> Controller</label>
<input type="text" id="node-input-controller">
</div>
<div class="form-row">
<label for="node-input-nodeid"><i class="icon-bookmark"></i> ZWave Node Id</label>
<input type="text" id="node-input-nodeid">
</div>
<div class="form-row">
<label for="node-input-cmdclass"><i class="icon-bookmark"></i> ZWave Command Class</label>
<select style="width: 90px" id="node-input-cmdclass" value="37">
<option value="37">COMMAND_CLASS_SWITCH_BINARY (switches/relays)</option>
<option value="38">COMMAND_CLASS_SWITCH_MULTILEVEL (dimmers)</option>
</select>
</div>
<div class="form-row">
<label for="node-input-cmdidx"><i class="icon-bookmark"></i> ZWave Command Index</label>
<input type="text" id="node-input-cmdidx">
</div>
</script>

<!-- ============================================================================================== -->

<script type="text/x-red" data-help-name="zwave-in">
<p><b>Input node for a specific ZWave device.</b><br/>Fires events when a ZWave ValueID is changed. See OpenZWave documentation on ValueIDs.</p>
<p><b>Input node for ZWave events.</b><br/>
Fires node-red events when a ZWave ValueID is changed. See OpenZWave documentation on ValueIDs.</p>
</script>

<script type="text/x-red" data-help-name="zwave-out">
<p><b>Output node for a specific ZWave device.</b><br/>Use this to control individual ZWave devices. See OpenZWave documentation on ValueIDs.</p>
</script>

<script type="text/x-red" data-help-name="zwave-node">
<p><b>A generic ZWave network function node.</b>Can be used to send arbitrary commands to the ZWave network and recieve notifications from it.</p>
<p><b>Output node for ZWave commands.</b><br/>
Use this to control individual ZWave devices. See OpenZWave documentation on ValueIDs.<br/>
<b>msg.topic</b> can be: <b>setLevel, setValue, switchOn, switchOff</b><br/>
<b>msg.payload</b> has these sub-elements:<br/>
<br/>&nbsp;&nbsp;<b>msg.payload.nodeId: (REQUIRED for all topics)</b> zwave node to send the command to (eg. 2)
<br/>&nbsp;&nbsp;<b>msg.payload.cmdclass</b> (eg. 37 for switches)
<br/>&nbsp;&nbsp;<b>msg.payload.cmdidx</b> (0 for most command classes)
<br/>&nbsp;&nbsp;<b>msg.payload.instance</b> (1 or 2 for multi-instance devices eg FGS-211)
<br/>&nbsp;&nbsp;<b>msg.payload.val</b> (eg. 100 to dim to 100%)
</p>
</script>

<script type="text/javascript">
RED.nodes.registerType('zwave-controller', {
category:'config',
category: 'config',

defaults: {
name: {value:""},
port: {value: "/dev/ttyUSB0", required:true},
driverattempts: {value: 3, required:true, validate:RED.validators.number()},
pollinterval: {value: 500, required:true, validate:RED.validators.number()}
pollinterval: {value: 500, required:true, validate:RED.validators.number()},
},
});
RED.nodes.registerType('zwave-node', {
category:'function',
color: 'pink',
defaults: {
name: {value:""},
controller: {value:"", type:"zwave-controller"},
},
inputs:1,
outputs:1,
icon: "zwave.png",
label: function() {
return this.name||"zwave"+(this.nodeId||"");
}
label: function() {
return("openzwave@"+this.port);
}
});
RED.nodes.registerType('zwave-in',{
category:'input',
color: 'yellow',
color: 'pink',
defaults: {
name: {value:""},
controller: {value:"", type:"zwave-controller"},
nodeid: {value:2, required:true, validate:RED.validators.number()},
cmdclass: {value:37, required:true},
cmdidx: {value:0, required:true}

},
inputs:0,
outputs:1,
icon: "zwave.png",
label: function() { return (this.homeid || ""); }
label: function() { return (this.name || ""); }
});
RED.nodes.registerType('zwave-out',{
category:'output',
color: 'yellow',
color: 'pink',
defaults: {
name: {value:""},
controller: {value:"", type:"zwave-controller"},
nodeid: {value:2, required:true, validate:RED.validators.number()},
cmdclass: {value:37, required:true},
cmdidx: {value:0, required:true}
},
inputs:1,
outputs:0,
icon: "zwave.png",
label: function() { return (this.homeid || ""); }
label: function() { return (this.name || ""); }
});
</script>
Loading

0 comments on commit 10c45f7

Please sign in to comment.