Provide inbound and outbound MQTT connectivity for zway (razberry). This allows control of ZWay devices through MQTT.
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
The following topics are used (<prefix>
can be configured and is by default zway
):
-
<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:- id
- title
- icon
- type
- level
-
<prefix>/status
- request to get status of all devices. ZWayMqttEndpoint responds with status update (see 1) for all devices -
<prefix>/<device-id>/set
- request to run zway command. Accepts JSON payload with two propertiescommand
andargs
Examples:
{ "command": "on" } { "command": "off" } { "command": "exact", "args": { "level": 50 } } ```
The code consists of a number of components:
-
index.js
- contains the zway app -
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 -
zway-api-mock.js
- stubs etc to allowindex.js
to be run and tested outside of the zway v8 engine -
build.js
- simple build script to createZWayMqttEndpoint/index.js
in the right format