node-red-contrib-homekit-mqtt
Version:
Node-RED nodes to simulate Apple HomeKit devices
145 lines (132 loc) • 5 kB
HTML
<!--
NodeRED HomeKit MQTT
Copyright (C) 2017 Michael Jacobsen.
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/>.
-->
<!--
Configuration Node
-->
<script type="text/x-red" data-template-name="homekit-mqtt-client">
<div class="form-row">
<label for="node-config-input-broker"><i class="fa fa-globe"></i> <span data-i18n="mqtt-client.label.broker"></span></label>
<input type="text" id="node-config-input-broker">
</div>
<div class="form-row">
<label for="node-config-input-nodename"><i class="fa fa-tag"></i> <span data-i18n="mqtt-client.label.nodename"></span></label>
<input type="text" id="node-config-input-nodename" data-i18n="[placeholder]mqtt-client.placeholder.nodename">
</div>
<div class="form-row">
<label for="node-config-input-domain"><i class="fa fa-tag"></i> <span data-i18n="mqtt-client.label.domain"></span></label>
<input type="text" id="node-config-input-domain" data-i18n="[placeholder]mqtt-client.label.domain">
</div>
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="mqtt-client.label.name"></span></label>
<input type="text" id="node-config-input-name" data-i18n="[placeholder]mqtt-client.label.name">
</div>
</script>
<script type="text/x-red" data-help-name="homekit-mqtt-client">
<p>HomeKit MQTT Client - configuration<p>
</script>
<script type="text/javascript">
RED.nodes.registerType('homekit-mqtt-client', {
category: 'config',
defaults: {
broker: {type:"mqtt-broker", required:true},
nodename: {value:"", required:true},
domain: {value:"domain", required:true},
name: {value:""}
},
color:"#4286f4",
icon: "bridge.png",
label: function() {
return this.name||"homekit-mqtt-client";
},
labelStyle: function() {
return this.name?"node_label_italic":"";
}
});
</script>
<script type="text/x-red" data-template-name="homekit-raw">
<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">
<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-tips">
<b>Input</b><br/>
<code>msg.topic</code> is part of the RPC method name.<br/>
<code>msg.payload</code> becomes the RPC args.<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-raw', {
category: 'homekit_mqtt-function',
paletteLabel: 'Raw',
defaults: {
client: {
type: "homekit-mqtt-client",
required: true
},
nodename: {
value: "",
required: true
},
dataid: {
value: "",
required: true
},
wdt: {
value: 60,
required: true,
validate:RED.validators.number()
},
name: {
value: ""
},
},
inputs: 1,
outputs: 3,
icon: "homekit.png",
color: "#fcc127",
label: function() {
return this.name || "Raw";
},
labelStyle: function() {
return this.name ? "node_label_italic" : ""
}
})
</script>