Skip to content

Provide inbound and outbound MQTT connectivity for zway

Notifications You must be signed in to change notification settings

kkckkc/ZWayMqttEndpoint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZWayMqttEndpoint

Provide inbound and outbound MQTT connectivity for zway (razberry). This allows control of ZWay devices through MQTT.

Installation

git clone [email protected]:kkckkc/ZWayMqttEndpoint.git
cd ZwayMqttEndpoint
node build.js
cp -R ZwayMqttEndpoint /opt/z-way-server/automation/modules
sudo service z-way-server restart

Activate ZWayMqttEndpoint app in zway admin

Overview

MQTT topics and messages supported

The following topics are used (<prefix> can be configured and is by default zway):

  1. <prefix>/<device-id>/update - app sends update on this topic whenever the state of a zway device is changed. The message is a JSON object with the following properties:

    1. id
    2. title
    3. icon
    4. type
    5. level
  2. <prefix>/status - request to get status of all devices. ZWayMqttEndpoint responds with status update (see 1) for all devices

  3. <prefix>/<device-id>/set - request to run zway command. Accepts JSON payload with two properties command and args

    Examples:

{ "command": "on" } { "command": "off" } { "command": "exact", "args": { "level": 50 } } ```

Code overview

The code consists of a number of components:

  1. index.js - contains the zway app

  2. mqtt.js - simple mqtt client with no external dependencies. Created in such a way that it is compatible with zway v8 runtime, but can also be run with node

  3. zway-api-mock.js - stubs etc to allow index.js to be run and tested outside of the zway v8 engine

  4. build.js - simple build script to create ZWayMqttEndpoint/index.js in the right format

About

Provide inbound and outbound MQTT connectivity for zway

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published