-
Notifications
You must be signed in to change notification settings - Fork 1
/
outlet.html
138 lines (124 loc) · 4.24 KB
/
outlet.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
<!--
NodeRED HomeKit MQTT
Copyright (C) 2017 Michael Jacobsen / Marius Schmeding.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script type="text/x-red" data-template-name="homekit-outlet-v2">
<div class="form-row">
<b>MQTT Settings</b>
</div>
<div class="form-row">
<label for="node-input-client"><i class="fa fa-globe"></i> MQTT Server</span></label>
<input type="text" id="node-input-client">
</div>
<div class="form-row">
<label for="node-input-nodename"><i class="fa fa-tag"></i> Nodename</span></label>
<input type="text" id="node-input-nodename" Nodename>
</div>
<div class="form-row">
<label for="node-input-dataid"><i class="fa fa-tag"></i> Data Id</span></label>
<input type="text" id="node-input-dataid" Data Id>
</div>
<div class="form-row">
<label for="node-input-wdt"><i class="fa fa-tag"></i> Watchdog</span></label>
<input type="text" id="node-input-wdt" 60>
</div>
<div class="form-row">
<b>HomeKit Settings</b>
</div>
<div class="form-row">
<label for="node-input-accessory">
<i class="fa fa-rocket"></i>
Accessory</label>
<input id="node-input-accessory">
</div>
<div class="form-row">
<label for="node-input-name">
<i class="fa fa-tag"></i>
Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<b>Default values</b>
</div>
<div class="form-row">
<label for="node-config-input-outletinuse" style="width: auto"><i class="fa fa-tag"></i> In Use</label>
<input type="checkbox" id="node-config-input-outletinuse" style="display: inline-block; width: auto; vertical-align: top;">
</div>
<div class="form-tips">
<b>Input</b><br/>
<code>msg.topic</code> must be one of these:<br/>
<i><nbsp>on (Bool)</i><br/>
<i><nbsp>outletinuse (Bool)</i><br/>
<br/>
<b>Outputs</b><br/>
<code>1:</code> Transactions<br/>
<code>2:</code> Log<br/>
<code>3:</code> Online/Offline status<br/>
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('homekit-outlet-v2', {
category: 'homekit_mqtt-function',
paletteLabel: 'Outlet',
defaults: {
client: {
type: "homekit-mqtt-client",
required: true
},
nodename: {
value: "",
required: true
},
dataid: {
value: "Outlet.",
required: true
},
wdt: {
value: 65,
required: true,
validate:RED.validators.number()
},
accessory: {
value: "",
type: "homekit-accessory-v2",
required: true
},
name: {
value: ""
},
serviceName: {
value: "Outlet",
required: true
},
outletinuse: {
value: true
}
},
inputs: 1,
outputs: 3,
icon: "homekit.png",
color: "#fcc127",
label: function() {
return this.name || "Outlet";
},
labelStyle: function() {
return this.name ? "node_label_italic" : ""
},
oneditprepare: function () {
if (typeof this.outletinuse === 'undefined') {
this.outletinuse = true
}
$("#node-config-input-outletinuse").prop("checked", this.outletinuse)
}
})
</script>