|
Bogdan Timofte
authored
2 weeks ago
|
1
|
<script type="text/x-red" data-template-name="z2m-pa-44z-homebus">
|
|
|
2
|
<div class="form-row">
|
|
|
3
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
|
4
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
|
5
|
</div>
|
|
|
6
|
<div class="form-row">
|
|
|
7
|
<label for="node-input-site"><i class="fa fa-globe"></i> Site</label>
|
|
|
8
|
<input type="text" id="node-input-site" placeholder="vad">
|
|
|
9
|
</div>
|
|
|
10
|
<div class="form-row">
|
|
|
11
|
<label for="node-input-batteryType">Battery type</label>
|
|
|
12
|
<select id="node-input-batteryType">
|
|
|
13
|
<option value="alkaline">Alkaline (Recommended)</option>
|
|
|
14
|
<option value="nimh">Rechargeable NiMH</option>
|
|
|
15
|
</select>
|
|
|
16
|
</div>
|
|
|
17
|
<div class="form-row">
|
|
|
18
|
<label for="node-input-batteryLowThreshold">Battery low threshold (%)</label>
|
|
|
19
|
<input type="number" id="node-input-batteryLowThreshold" min="0" max="100" placeholder="20">
|
|
|
20
|
</div>
|
|
|
21
|
</script>
|
|
|
22
|
|
|
|
23
|
<script type="text/x-red" data-help-name="z2m-pa-44z-homebus">
|
|
|
24
|
<p>
|
|
|
25
|
Translates Zigbee2MQTT messages for Tuya <code>PA-44Z</code> smoke detectors into canonical HomeBus topics.
|
|
|
26
|
</p>
|
|
|
27
|
<p>
|
|
|
28
|
Canonical topic shape:
|
|
|
29
|
<code><site>/home/<location>/<capability>/<device_id>/<stream></code>
|
|
|
30
|
</p>
|
|
|
31
|
<p>
|
|
|
32
|
Example outputs:
|
|
|
33
|
<code>vad/home/kitchen/smoke/smoke-sensor/value</code>,
|
|
|
34
|
<code>vad/home/kitchen/battery/smoke-sensor/last</code>,
|
|
|
35
|
<code>vad/home/kitchen/device_fault/smoke-sensor/meta</code>
|
|
|
36
|
</p>
|
|
|
37
|
<h3>Input</h3>
|
|
|
38
|
<p>
|
|
|
39
|
Expected Zigbee2MQTT telemetry topic:
|
|
|
40
|
<code>zigbee2mqtt/PA-44Z/<site>/<location>/<device_id></code> with a JSON payload.
|
|
|
41
|
</p>
|
|
|
42
|
<p>
|
|
|
43
|
Availability topic is also supported:
|
|
|
44
|
<code>zigbee2mqtt/PA-44Z/<site>/<location>/<device_id>/availability</code> with payload <code>online</code> or <code>offline</code>.
|
|
|
45
|
</p>
|
|
|
46
|
<p>
|
|
|
47
|
Typical subscription for this adapter:
|
|
|
48
|
<code>zigbee2mqtt/PA-44Z/#</code>
|
|
|
49
|
</p>
|
|
|
50
|
<p>
|
|
|
51
|
Output 2 controls a dynamic <code>mqtt in</code> node on the raw Zigbee2MQTT broker. On startup, the adapter emits
|
|
|
52
|
<code>{ action: "subscribe", topic: "zigbee2mqtt/PA-44Z/#" }</code>.
|
|
|
53
|
</p>
|
|
|
54
|
<p>
|
|
|
55
|
Used fields:
|
|
|
56
|
<code>smoke</code>, <code>battery</code>, <code>device_fault</code>, <code>silence</code>,
|
|
|
57
|
<code>test</code>, <code>smoke_concentration</code>, <code>availability</code>.
|
|
|
58
|
</p>
|
|
|
59
|
<p>
|
|
|
60
|
The adapter translates the reported battery for AAA rechargeable cells when <code>Battery type</code> is set to
|
|
|
61
|
<code>Rechargeable NiMH</code>. The remap approximates an alkaline percentage to voltage and then maps that voltage
|
|
|
62
|
onto a flatter NiMH discharge curve. Default behavior assumes alkaline cells.
|
|
|
63
|
</p>
|
|
|
64
|
<h3>Output</h3>
|
|
|
65
|
<ol>
|
|
|
66
|
<li>MQTT-ready publish messages, emitted as an array of messages on the semantic/output path.</li>
|
|
|
67
|
<li><code>mqtt in</code> control messages for the raw Zigbee2MQTT subscription.</li>
|
|
|
68
|
</ol>
|
|
|
69
|
<p>
|
|
|
70
|
Mapping:
|
|
|
71
|
<code>smoke -> smoke/value</code>,
|
|
|
72
|
<code>battery -> battery/value</code>,
|
|
|
73
|
<code>battery_low -> battery_low/value</code>,
|
|
|
74
|
<code>device_fault -> device_fault/value</code>,
|
|
|
75
|
<code>silence -> silence/value</code>,
|
|
|
76
|
<code>test -> test/value</code>,
|
|
|
77
|
<code>smoke_concentration -> smoke_concentration/value</code>.
|
|
|
78
|
</p>
|
|
|
79
|
</script>
|
|
|
80
|
|
|
|
81
|
<script>
|
|
|
82
|
RED.nodes.registerType("z2m-pa-44z-homebus", {
|
|
|
83
|
category: "myNodes",
|
|
|
84
|
color: "#d9ecfb",
|
|
|
85
|
defaults: {
|
|
|
86
|
name: { value: "" },
|
|
|
87
|
site: { value: "unknown" },
|
|
|
88
|
batteryType: { value: "alkaline" },
|
|
|
89
|
batteryLowThreshold: { value: 20, validate: RED.validators.number() },
|
|
|
90
|
mqttSite: { value: "" },
|
|
|
91
|
mqttBus: { value: "" },
|
|
|
92
|
mqttRoom: { value: "" },
|
|
|
93
|
mqttSensor: { value: "" }
|
|
|
94
|
},
|
|
|
95
|
inputs: 1,
|
|
|
96
|
outputs: 2,
|
|
|
97
|
icon: "font-awesome/fa-sitemap",
|
|
|
98
|
label: function() {
|
|
|
99
|
return this.name || "z2m-pa-44z-homebus";
|
|
|
100
|
},
|
|
|
101
|
paletteLabel: "pa-44z homebus"
|
|
|
102
|
});
|
|
|
103
|
</script>
|