Z-Wave JS UI

repository·master·Indexed 23 days ago

https://github.com/zwave-js/zwave-js-ui

A comprehensive Z-Wave Control Panel and MQTT Gateway (version 11.22.0) that provides a web-based management interface for Z-Wave networks. It features a graphical UI for node management, firmware updates, and network visualization, alongside a configurable MQTT bridge for integration with smart home ecosystems like Home Assistant, OpenHAB, and Domoticz. The system includes APIs for gateway settings, user authentication, configuration templates, and debug session management.

Tokens
36.3K
Snippets
64
Records
179
Agent score
79%

What's inside zwave-js-ui

  1. Overview of Z-Wave JS UI

    master

    Z-Wave JS UI is a full-featured Z-Wave Control Panel and MQTT Gateway. It provides a graphical user interface to manage Z-Wave networks and can act as a bridge to expose Z-Wave devices to an MQTT broker.

    Key Capabilities

    • Control Panel UI: Manage nodes, perform firmware updates, configure group associations, and access full Z-Wave JS APIs.
    • MQTT Gateway: Fully configurable Z-Wave to MQTT device exposure.
    • Network Management: Includes a Network Graph for visualizing node communication, Zniffer support for traffic debugging, and diagnostic tools like Healthcheck and Link quality tools.
    • Security & Maintenance: Supports HTTPS, user authentication, and automated/scheduled backups of the NVM and store directory (including safety backups before inclusion/exclusion operations).
    • Scene Management: Create and trigger scenes via MQTT APIs with timeout support.
    • File Access: Access files in the persistent store folder directly through the UI.
    • Logging: View debug logs directly within the interface.
  2. Create Scheduled Jobs with Cron

    master

    You can execute custom driver functions on a schedule using the Scheduled Jobs table. Jobs use standard cron expressions.

    Properties:

    • Name: Job identifier.
    • Enabled: Toggle the job.
    • On Init: Run the job immediately upon gateway initialization.
    • Cron: The schedule (e.g., 0 0 * * * for daily at midnight).
    • Code: The valid driver function code to execute.
  3. Create custom Home Assistant components via customDevices.js

    master

    Z-Wave JS UI automatically creates sensor, cover, binary_sensor, and switch components. For complex types like climate or fan, you must define custom configurations.

    Setup

    1. Create a file named customDevices.js or customDevices.json in the store folder.
    2. The file must exist before application startup, or you must restart the application after creating it.

    Configuration Format

    The key is the Z-Wave device id (<manufacturerid>-<productid>-<producttype>). The value is an array of Home Assistant component objects.

    To find a specific node's Device id:

    1. Go to the Control Panel.
    2. Select a node in the table.
    3. Select the Node tab.
    4. The ID is displayed under the Node Actions dropdown menu.
  4. Understand MQTT Payload formats

    master

    When publishing updates via MQTT, you can choose from three payload formats:

    JSON Time-Value

    Best for time-series databases. Contains a timestamp and the value.

    {
      "time": 1548683523859,
      "value": 10
    }

    Entire ValueId Object

    Contains full metadata about the Z-Wave value. Useful for deep inspection.

    {
      id: "38-0-targetValue",
      nodeId: 8,
      commandClass: 38,
      commandClassName: "Multilevel Switch",
      endpoint: 0,
      property: "targetValue",
      propertyName: "targetValue",
      propertyKey: undefined,
      type: "number",
      readable: true,
      writeable: true,
      description: undefined,
      label: "Target value",
      default: undefined,
      genre: "user",
      min: 0,
      max: 99,
      step: undefined,
      unit: undefined,
      list: false,
      value: undefined,
      lastUpdate: 1604044669393,
    }

    Just value

    Contains only the raw Numeric, String, or Bool value.

  5. How plugins work in Z-Wave JS UI

    master

    Plugins are NodeJS packages that extend Z-Wave JS UI by providing access to the Z-Wave client, MQTT client, and the Express application instance.

    Plugins are loaded using ES dynamic import() and must export a default class. The lifecycle of a plugin is managed by the application: the constructor is called when the plugin is loaded, and the destroy() method is called when the application shuts down or settings are updated. This allows plugins to clean up event listeners, intervals, or other stateful resources.

    interface PluginContext {
      zwave: ZwaveClient
      mqtt: MqttClient
      app: Router       // Express router
      logger: ModuleLogger
    }
    
    interface CustomPlugin extends PluginContext {
      name: string
      destroy(): Promise<void>
    }
  6. Manage channel subscriptions via Socket.IO

    master

    Events in Z-Wave JS UI are organized into channels. To receive events, you must explicitly subscribe to them. Subscriptions are additive; calling SUBSCRIBE with new channels adds them to your current list rather than replacing it.

    Subscribing

    Send a SUBSCRIBE event with an array of channel names. You can use an acknowledgement callback to verify your active subscriptions.

    Unsubscribing

    Send an UNSUBSCRIBE event with an array of channel names to stop receiving events for those specific channels.

    Subscribe to all channels

    Use the special keyword all to subscribe to every available channel at once.

  7. Configure Device Value IDs for specific device types

    master

    The Device values configuration table (under the General section) allows you to create valueId specific configurations that apply to all devices of the same type in your network.

    Important Notes:

    • A device must complete its interview before it appears in the dropdown list.
    • For battery-powered devices, manually wake them up if they do not appear.

    Configuration Properties:

    • Device: The device type (based on device_id: <manufacturerid>-<productid>-<producttype>).
    • Value: The valueId to configure.
    • Device Class: Custom device_class for Home Assistant discovery (e.g., for multilevel sensors, binary sensors, or meters).
    • Topic: The MQTT topic (used after prefix, node name, and location). Ignored if gateway type is not Manual.
    • QoS / Retain: Overrides MQTT settings.
    • Post operation: Convert values using expressions like /10, /100, *10, or *100.
    • Parse send / Parse receive: Custom synchronous JavaScript functions function(value,valueId,node,logger) to parse values sent to or received from MQTT.
    • Enable Poll: Enables polling of this value using Z-Wave JS pollValue.
    • Poll interval: Seconds between poll requests.
  8. Configure Gateway values for multiple devices

    master

    When adding values to the Gateway values table, the UI shows only one device for each type. This is a feature designed to speed up network setup.

    By adding the specific values you want to bridge to MQTT for a single device of a certain type (e.g., a single light switch for an 'on/off' command), Z-Wave JS UI will automatically bridge those same values for all other devices of that same type in your network, avoiding the need for manual per-device configuration.

  9. Perform Lifeline vs. Route healthchecks

    master

    The type of health check performed via the DIAGNOSE button depends on the target node selected in the Network Graph:

    • Lifeline healthcheck: Performed when the target node is the controller. This checks the connection between the node and the controller.
    • Route healthcheck: Performed when the target node is any other node in the network. This checks the routing paths for that specific node.

    Note that Route healthcheck results may vary in detail depending on the specific capabilities and support of the node being checked. If results are unclear, click the ? button in the dialog for a detailed explanation of the findings.