-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path99-zwave.html
85 lines (73 loc) · 3.97 KB
/
99-zwave.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!--
Copyright 2014 Jonathan Leach.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Sample html file that corresponds to the 99-sample.js file -->
<!-- This creates and configures the onscreen elements of the node -->
<!-- If you use this as a template, replace IBM Corp. with your own name. -->
<!-- First, the content of the edit dialog is defined. -->
<script type="text/x-red" data-template-name="zwave">
<!-- data-template-name identifies the node type this is for -->
<!-- Each of the following divs creates a field in the edit dialog. -->
<!-- Generally, there should be an input for each property of the node. -->
<!-- The for and id attributes identify the corresponding property -->
<!-- (with the 'node-input-' prefix). -->
<!-- The available icon classes are defined in Twitter Bootstrap -->
<div class="form-row">
<label for="node-input-port"><i class="icon-tasks"></i> Port</label>
<input type="text" id="node-input-port" placeholder="/dev/ttyUSB0">
</div>
<div class="form-row">
<label for="node-input-nodeid"><i class="icon-tasks"></i> Node ID</label>
<input type="text" id="node-input-nodeid" placeholder="">
</div>
<!-- By convention, most nodes have a 'name' property. The following div -->
<!-- provides the necessary field. -->
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<!-- Next, some simple help text is provided for the node. -->
<script type="text/x-red" data-help-name="zwave">
<!-- data-help-name identifies the node type this help is for -->
<!-- This content appears in the Info sidebar when a node is selected -->
<!-- The first <p> is used as the pop-up tool tip when hovering over a -->
<!-- node in the palette. -->
<p>Output node to send messages to a ZWave network using a USB ZWave interface
supported by openZWave.</p>
<p>input is object called <b>msg</b> containing <b>msg.nodeId</b> and
<b>msg.payload</b>. payload can be a integer 0-99 to set a level or true/false for binary switches.
Node ID can either be passed in <b>msg.nodeId</b> or set in config</p>
</script>
<!-- Finally, the node type is registered along with all of its properties -->
<!-- The example below shows a small subset of the properties that can be set-->
<script type="text/javascript">
RED.nodes.registerType('zwave',{
category: 'output', // the palette category
color:"#fdf0c2",
defaults: { // defines the editable properties of the node
name: {value:""}, // along with default values.
port: {value:"/dev/ttyUSB0", required:true},
nodeid: {value:""}
},
inputs:1, // set the number of inputs - only 0 or 1
outputs:0, // set the number of outputs - 0 to n
icon: "light.png", // set the icon (held in public/icons)
align: "right",
label: function() { // sets the default label contents
return this.name||"zwave";
},
labelStyle: function() { // sets the class to apply to the label
return this.name?"node_label_italic":"";
}
});
</script>