-
Notifications
You must be signed in to change notification settings - Fork 0
/
globalcache.html
159 lines (150 loc) · 5.64 KB
/
globalcache.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<script type="text/x-red" data-template-name="globalcache-controller">
<div class="form-row">
<label for="node-config-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-config-input-host"><i class="icon-bookmark"></i> gc Host</label>
<input type="text" id="node-config-input-host">
</div>
<div class="form-row">
<label for="node-config-input-port"><i class="icon-bookmark"></i> gc Port</label>
<input type="text" id="node-config-input-port">
</div>
<div class="form-row">
<label for="node-config-input-mode"><i class="icon-bookmark"></i> gc Mode</label>
<select id="node-config-input-mode">
<option value="request-disconnect">request-disconnect</option>
<option value="always-connected">always-connected</option>
</select>
</div>
</script>
<script type="text/x-red" data-template-name="globalcache-out">
<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>
<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-unit_number"><i class="icon-bookmark"></i> Unit number</label>
<input type="text" id="node-input-unit_number">
</div>
<div class="form-row">
<label for="node-input-output"><i class="icon-bookmark"></i> Output</label>
<input type="text" id="node-input-output">
</div>
<div class="form-row">
<label for="node-input-gccommand"><i class="icon-bookmark"></i> Command</label>
<select id="node-input-gccommand">
<option value="empty">no cmd</option>
<option value="sendir">infrared</option>
<option value="setstate">relay</option>
</select>
</div>
</script>
<script type="text/x-red" data-template-name="globalcache-in">
<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>
<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-help-name="globalcache-out">
<p>
Use this to <b>send</b> telegrams via an gc daemon connected to a Global Cache device.<br/>
<b>msg.payload</b> must be a JavaScript object or a string
</p>
<p>
For example: <code>setstate,1:1,1</code> or <code>{"serial": "setstate,1:1,1"}</code>
</p>
<p>
If one specify three parameters: unit_number (optional, in fact), output and command, than all incoming string commands will be transformed into GlobalCache` packet: <code>[command],[unit_number]:[output],[command]</code>
<p>
<p>
For example, let configs be:
<ul>
<li>unit_number is empty</li>
<li>output is 3</li>
<li>and command is <code>sendir</code></li>
</ul>
<br/>
And command (inside of <code>msg.payload</code>) is <code>1,38000,1,1,105,84,22,3800</code>.
<br/>
Than ready packet (it will be sent into GC device) looks like:
<code>sendir,1:3,1,38000,1,1,105,84,22,3800</code>
</p>
<br/>
<p>
Send command in CCF mode:
</p>
<p>
<b>msg.payload</b> should contain code in CCF mode<br/>
<b>msg.format</b> must be equal <code>ccf</code> or <code>hex</code>
</p>
<br/>
<p>
Send command without Queue of commands:
</p>
<p>
<b>msg.justnow</b> should contain <code>true</code> value
</p>
</script>
<script type="text/x-red" data-help-name="globalcache-in">
<p>Use this to <b>inject</b> flows from GlobalCache device<br/>
</script>
<script type="text/javascript">
RED.nodes.registerType('globalcache-controller', {
category: 'config',
defaults: {
name: {value: ""},
host: {value: "127.0.0.1", required: true},
port: {value: 4998, required: false, validate: RED.validators.number()},
mode: {value: "request-disconnect", required: true}
},
label: function () {
return (this.name || 'gc' ) + "@" + this.host + ":" + this.port;
}
});
</script>
<script type="text/javascript">
RED.nodes.registerType('globalcache-out', {
category: 'output',
color: '#26b050',
defaults: {
name: {value: ""},
controller: {value: "", type: "globalcache-controller"},
unit_number: {value: "1", required: false},
output: {value: "1", required: false},
gccommand: {value: "empty", required: true}
},
inputs: 1,
outputs: 0,
align: 'right',
icon: "bridge-dash.png",
label: function () {
return (this.groupaddr || this.name || "gc");
}
});
</script>
<script type="text/javascript">
RED.nodes.registerType('globalcache-in', {
category: 'input',
color: '#26b050',
defaults: {
name: {value: ""},
controller: {value: "", type: "globalcache-controller"}
},
inputs: 0,
outputs: 1,
icon: "bridge-dash.png",
label: function () {
return (this.groupaddr || this.name || "gc");
}
});
</script>