1 contributor
<script type="text/x-red" data-template-name="smart-socket-homekit-adapter">
<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">
<label for="node-input-site"><i class="fa fa-globe"></i> Site</label>
<input type="text" id="node-input-site" placeholder="vad">
</div>
<div class="form-row">
<label for="node-input-location"><i class="fa fa-home"></i> Location</label>
<input type="text" id="node-input-location" placeholder="living-room">
</div>
<div class="form-row">
<label for="node-input-accessory"><i class="fa fa-plug"></i> Accessory</label>
<input type="text" id="node-input-accessory" placeholder="tv">
</div>
</script>
<script type="text/x-red" data-help-name="smart-socket-homekit-adapter">
<p>
Consumes canonical HomeBus power telemetry for a single smart socket endpoint and projects it to a HomeKit <code>Outlet</code> service.
</p>
<p>
The node subscribes to:
<code><site>/home/<location>/power/<accessory>/last</code>,
<code>.../meta</code>,
<code>.../value</code>, and
<code>.../availability</code>.
</p>
<p>
It also accepts HomeKit control messages from the paired <code>homekit-service</code> node and republishes them as canonical HomeBus power commands on:
<code><site>/home/<location>/power/<accessory>/set</code>
</p>
<p>
Wire the first output of the <code>homekit-service</code> <code>Outlet</code> node back into this adapter input if you want HomeKit toggles to be translated into HomeBus commands.
</p>
<h3>Outputs</h3>
<ol>
<li>HomeKit Outlet payloads, for example <code>{ On: 1, OutletInUse: 1 }</code>.</li>
<li>MQTT-ready canonical HomeBus set publishes.</li>
<li>Dynamic <code>mqtt in</code> control messages for semantic MQTT bootstrap/live subscriptions.</li>
</ol>
<h3>HomeKit Service Setup</h3>
<p><code>Outlet</code></p>
<pre><code>{"OutletInUse":{}}</code></pre>
</script>
<script>
function requiredText(v) {
return !!(v && String(v).trim());
}
RED.nodes.registerType("smart-socket-homekit-adapter", {
category: "myNodes",
color: "#d7f0d1",
defaults: {
name: { value: "" },
outputTopic: { value: "" },
mqttBus: { value: "" },
site: { value: "", validate: requiredText },
location: { value: "", validate: requiredText },
accessory: { value: "", validate: requiredText },
mqttSite: { value: "" },
mqttRoom: { value: "" },
mqttSensor: { value: "" }
},
inputs: 1,
outputs: 3,
icon: "font-awesome/fa-plug",
label: function() {
return this.name || "smart-socket-homekit-adapter";
},
paletteLabel: "smart socket homekit"
});
</script>