1 contributor
<script type="text/x-red" data-template-name="z2m-snzb-04p-homebus">
<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="unknown">
</div>
<div class="form-row">
<label for="node-input-batteryLowThreshold">Battery low threshold (%)</label>
<input type="number" id="node-input-batteryLowThreshold" min="0" max="100" placeholder="20">
</div>
</script>
<script type="text/x-red" data-help-name="z2m-snzb-04p-homebus">
<p>
Translates Zigbee2MQTT messages for SONOFF <code>SNZB-04P</code> contact sensors into canonical HomeBus topics.
</p>
<p>
Canonical topic shape:
<code><site>/home/<location>/<capability>/<device_id>/<stream></code>
</p>
<p>
Example outputs:
<code>vad/home/entry/contact/front-door/value</code>,
<code>vad/home/entry/battery/front-door/last</code>,
<code>vad/home/entry/contact/front-door/meta</code>
</p>
<p>
Expected Zigbee2MQTT telemetry topic:
<code>zigbee2mqtt/SNZB-04P/<site>/<location>/<device_id></code>.
</p>
<p>
Used fields:
<code>contact</code>, <code>battery</code>, <code>battery_low</code>, <code>voltage</code>,
<code>tamper</code>, <code>availability</code>, <code>online</code>.
</p>
<ol>
<li>MQTT-ready publish messages, emitted as an array.</li>
<li><code>mqtt in</code> control messages for the raw Zigbee2MQTT subscription.</li>
</ol>
</script>
<script>
RED.nodes.registerType("z2m-snzb-04p-homebus", {
category: "myNodes",
color: "#d9ecfb",
defaults: {
name: { value: "" },
site: { value: "unknown" },
batteryLowThreshold: { value: 20, validate: RED.validators.number() },
mqttSite: { value: "" },
mqttBus: { value: "" },
mqttRoom: { value: "" },
mqttSensor: { value: "" }
},
inputs: 1,
outputs: 2,
icon: "font-awesome/fa-sitemap",
label: function() {
return this.name || "z2m-snzb-04p-homebus";
},
paletteLabel: "snzb-04p homebus"
});
</script>