node-red-contrib-homekit-mqtt
Version:
Node-RED nodes to simulate Apple HomeKit devices
177 lines (158 loc) • 6.01 kB
HTML
<!--
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-thermostat-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-input-targettemperature"><i class="fa fa-cog"></i> TargetTemperature</label>
<input type="text" id="node-input-targettemperature" placeholder="-1">
</div>
<div class="form-row">
<label for="node-input-targetheatingcoolingstate"><i class="fa fa-cog"></i> TargetHeatingCoolingState</span></label>
<select id="node-input-targetheatingcoolingstate">
<option value="-1">Do not set default value (-1)</option>
<option value="0">Off (0)</option>
<option value="1">Heat (1)</option>
<option value="2">Cool (2)</option>
<option value="3">Auto (3)</option>
</select>
</div>
<div class="form-row">
<label for="node-input-coolingthresholdtemperature"><i class="fa fa-cog"></i> CoolingThresholdTemperature</label>
<input type="text" id="node-input-coolingthresholdtemperature" placeholder="-1">
</div>
<div class="form-row">
<label for="node-input-heatingthresholdtemperature"><i class="fa fa-cog"></i> HeatingThresholdTemperature</label>
<input type="text" id="node-input-heatingthresholdtemperature" placeholder="-1">
</div>
<div class="form-row">
<label for="node-input-targetrelativehumidity"><i class="fa fa-cog"></i> TargetRelativeHumidity</label>
<input type="text" id="node-input-targetrelativehumidity" placeholder="-1">
</div>
<div class="form-tips">
<b>Input</b><br/>
<code>msg.topic</code> must be one of these:<br/>
<i><nbsp>currentheatingcoolingstate</i> (UInt8)<br/>
<i><nbsp>targetheatingcoolingstate</i> (UInt8)<br/>
<i><nbsp>currenttemperature</i> (Float)<br/>
<i><nbsp>targettemperature</i> (Float)<br/>
<i><nbsp>currentrelativehumidity</i> (Float)<br/>
<i><nbsp>targetrelativehumidity</i> (Float)<br/>
<i><nbsp>coolingthresholdtemperature</i> (Float)<br/>
<i><nbsp>heatingthresholdtemperature</i> (Float)<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-thermostat-v2', {
category: 'homekit_mqtt-function',
paletteLabel: 'Thermostat',
defaults: {
client: {
type: "homekit-mqtt-client",
required: true
},
nodename: {
value: "",
required: true
},
dataid: {
value: "Thermostat.",
required: true
},
wdt: {
value: 65,
required: true,
validate:RED.validators.number()
},
accessory: {
value: "",
type: "homekit-accessory-v2",
required: true
},
name: {
value: ""
},
serviceName: {
value: "Thermostat",
required: true
},
targettemperature: {
value: -1
},
targetheatingcoolingstate: {
value: -1
},
coolingthresholdtemperature: {
value: -1
},
heatingthresholdtemperature: {
value: -1
},
targetrelativehumidity: {
value: -1
}
},
inputs: 1,
outputs: 3,
icon: "homekit.png",
color: "#fcc127",
label: function() {
return this.name || "Thermostat";
},
labelStyle: function() {
return this.name ? "node_label_italic" : ""
}
})
</script>