1 contributor
<script type="text/x-red" data-template-name="z2m-pa-44z-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="vad">
</div>
<div class="form-row">
<label for="node-input-batteryType">Battery type</label>
<select id="node-input-batteryType">
<option value="alkaline">Alkaline (Recommended)</option>
<option value="nimh">Rechargeable NiMH</option>
</select>
</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-pa-44z-homebus">
<p>
Translates Zigbee2MQTT messages for Tuya <code>PA-44Z</code> smoke detectors 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/kitchen/smoke/smoke-sensor/value</code>,
<code>vad/home/kitchen/battery/smoke-sensor/last</code>,
<code>vad/home/kitchen/device_fault/smoke-sensor/meta</code>
</p>
<h3>Input</h3>
<p>
Expected Zigbee2MQTT telemetry topic:
<code>zigbee2mqtt/PA-44Z/<site>/<location>/<device_id></code> with a JSON payload.
</p>
<p>
Availability topic is also supported:
<code>zigbee2mqtt/PA-44Z/<site>/<location>/<device_id>/availability</code> with payload <code>online</code> or <code>offline</code>.
</p>
<p>
Typical subscription for this adapter:
<code>zigbee2mqtt/PA-44Z/#</code>
</p>
<p>
Output 2 controls a dynamic <code>mqtt in</code> node on the raw Zigbee2MQTT broker. On startup, the adapter emits
<code>{ action: "subscribe", topic: "zigbee2mqtt/PA-44Z/#" }</code>.
</p>
<p>
Used fields:
<code>smoke</code>, <code>battery</code>, <code>device_fault</code>, <code>silence</code>,
<code>test</code>, <code>smoke_concentration</code>, <code>availability</code>.
</p>
<p>
The adapter translates the reported battery for AAA rechargeable cells when <code>Battery type</code> is set to
<code>Rechargeable NiMH</code>. The remap approximates an alkaline percentage to voltage and then maps that voltage
onto a flatter NiMH discharge curve. Default behavior assumes alkaline cells.
</p>
<h3>Output</h3>
<ol>
<li>MQTT-ready publish messages, emitted as an array of messages on the semantic/output path.</li>
<li><code>mqtt in</code> control messages for the raw Zigbee2MQTT subscription.</li>
</ol>
<p>
Mapping:
<code>smoke -> smoke/value</code>,
<code>battery -> battery/value</code>,
<code>battery_low -> battery_low/value</code>,
<code>device_fault -> device_fault/value</code>,
<code>silence -> silence/value</code>,
<code>test -> test/value</code>,
<code>smoke_concentration -> smoke_concentration/value</code>.
</p>
</script>
<script>
RED.nodes.registerType("z2m-pa-44z-homebus", {
category: "myNodes",
color: "#d9ecfb",
defaults: {
name: { value: "" },
site: { value: "unknown" },
batteryType: { value: "alkaline" },
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-pa-44z-homebus";
},
paletteLabel: "pa-44z homebus"
});
</script>