mynodes / adapters / smart-socket / homebus-adapter / z2m-smart-socket-homebus.html
1 contributor
72 lines | 2.62kb
<script type="text/x-red" data-template-name="z2m-smart-socket-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>
</script>

<script type="text/x-red" data-help-name="z2m-smart-socket-homebus">
  <p>
    Translates Zigbee2MQTT smart socket telemetry for <code>A1Z</code> and <code>S60ZBTPF</code> into canonical HomeBus control topics.
  </p>
  <p>
    The adapter standardizes both models to the same HomeBus capability set, with <code>state</code> mapped to
    <code>&lt;site&gt;/home/&lt;location&gt;/power/&lt;device_id&gt;/...</code>.
  </p>
  <p>
    Supported canonical projections:
    <code>power</code>,
    <code>power_restore_mode</code>,
    <code>countdown</code>,
    <code>lock</code>,
    <code>indicator_mode</code>,
    <code>button_mode</code>,
    <code>protection_enabled</code>.
  </p>
  <h3>Inputs</h3>
  <p>
    Raw Zigbee2MQTT telemetry:
    <code>zigbee2mqtt/A1Z/&lt;site&gt;/&lt;location&gt;/&lt;device_id&gt;</code> or
    <code>zigbee2mqtt/S60ZBTPF/&lt;site&gt;/&lt;location&gt;/&lt;device_id&gt;</code>
  </p>
  <p>
    Raw availability is also supported on the sibling <code>/availability</code> topic.
  </p>
  <p>
    Canonical HomeBus power commands are accepted on:
    <code>&lt;site&gt;/home/&lt;location&gt;/power/&lt;device_id&gt;/set</code>
    with payload <code>true</code>, <code>false</code>, <code>on</code>, <code>off</code>, or <code>toggle</code>.
  </p>
  <h3>Outputs</h3>
  <ol>
    <li>MQTT-ready HomeBus and <code>sys</code> publish messages.</li>
    <li>MQTT-ready Zigbee2MQTT raw command publishes, for example <code>zigbee2mqtt/A1Z/vad/kitchen/coffee/set</code>.</li>
    <li>Dynamic <code>mqtt in</code> control messages that subscribe to <code>zigbee2mqtt/A1Z/#</code> and <code>zigbee2mqtt/S60ZBTPF/#</code>.</li>
  </ol>
</script>

<script>
  RED.nodes.registerType("z2m-smart-socket-homebus", {
    category: "myNodes",
    color: "#d9ecfb",
    defaults: {
      name: { value: "" },
      site: { value: "unknown" },
      mqttSite: { value: "" },
      mqttBus: { value: "" },
      mqttRoom: { value: "" },
      mqttSensor: { value: "" }
    },
    inputs: 1,
    outputs: 3,
    icon: "font-awesome/fa-plug",
    label: function() {
      return this.name || "z2m-smart-socket-homebus";
    },
    paletteLabel: "smart socket homebus"
  });
</script>