Skip to content

Module thc_zWay

Andreas Drollinger edited this page Nov 8, 2019 · 27 revisions

z-Way/Razberry interface

Setup, configuration and initialization

z-Way interface setup

The thc_zWay module implements the interface to the z-Way/Razberry Z-Wave controller. To include Z-Wave devices controlled via z-Way/Razberry, the following setup needs to be performed.

z-Way server setup

  • The z-Way server needs to be installed and running on the target system.
  • The Z-Wave devices need to be included into the Z-Wave network controlled by the z-Way server.
  • The THC-z-Way interface script (thc_zWay.js, see z-Way extension for THC) needs to be stored in the z-Way automation directory.

THC server setup

  • The THC server needs to be installed and running on the target system.

THC configuration (config.tcl)

Once this setup is completed the declared Z-Wave devices are accessible via the global thc::Get and thc::Set commands.

z-Way device definitions

z-Way devices are defined with the global thc::DefineDevice command. The 'Set' and 'Get' command specifiers need to be composed in the following way:

 {thc_zWay {<zWaveCommandGroup> <DeviceIdentifyer>}}

The device identifier is provided by the z-Way configuration utility. The identifier is composed by the device number, the instance number, and the data record. All numbers are separated by a dot (.).

The zWaveCommandGroup is provided by the Z-Wave device documentation. The following command groups are supported by the thc_zWay interface module:

  • SwitchBinary
  • SensorBinary
  • Battery
  • SensorMultilevel
  • SwitchMultilevel

In addition to the standard Z-Wave command groups the thc_zWay interface provides some convenience command groups:

Description
Virtual Allows accessing virtual devices from the z-way automation system.
TagReader Provides info about the last event of the BeNEXT tag reader. The <thc::Get> command returns a list of 2-3 elements. The first one corresponds to the last event time, the second one is one of the following event names: 'lock', 'unlock', 'tamper', 'wrongcode'. In case the event is 'wrongcode' the 3rd element corresponds to this wrong code.
SwitchMultiBinary Groups multiple binary switch instances of a device to a multi-bit instance. The device identifier requires 3 elements: Device number, instance number with the lower index, instance number with the higher index.
Control Allows implementing control states (=variables) on the z-Way server.

Examples

 thc::zWay::Init "http://192.168.1.21:8083" -user admain -password admin

 thc::DefineDevice Surveillance,state -get {thc_zWay "Virtual DummyDevice_bn_5"} \
                                      -set {thc_zWay "Virtual DummyDevice_bn_5"}

 thc::DefineDevice LightCellar,state    -get {thc_zWay "SwitchBinary 20.1"} \
                                      -set {thc_zWay "SwitchBinary 20.1"}

 thc::DefineDevice LightLiv2,state    -type level \
                                      -get {thc_zWay "SwitchMultilevel 12.2"} \
                                      -set {thc_zWay "SwitchMultilevel 12.2"}

 thc::DefineDevice Sirene,state       -get {thc_zWay "SwitchBinary 16.0"} \
                                      -set {thc_zWay "SwitchBinary 16.0"}
 thc::DefineDevice Sirene,battery     -get {thc_zWay "Battery 16.0"} -update 1h

 thc::DefineDevice TagReader1,state   -get {thc_zWay "TagReader 22"} \
                                      -set {thc_zWay "SwitchBinary 22"}
 thc::DefineDevice TagReader1,battery -get {thc_zWay "Battery 22"} -update 1h

 thc::DefineDevice MultiCellar,temp     -get {thc_zWay "SensorMultilevel 23.0.1"} -update 1m
 thc::DefineDevice MultiCellar,hum      -get {thc_zWay "SensorMultilevel 23.0.5"} -update 1m
 thc::DefineDevice MultiCellar,battery  -get {thc_zWay "Battery 23"} -update 1h

 thc::DefineDevice FourLevelFan,state -get {thc_zWay "SwitchMultiBinary 33.1.2"} \
                                      -set {thc_zWay "SwitchMultiBinary 33.1.2"}

Proc: thc::zWay::Init

Initializes the z-Way/Razberry interface. Init waits first until the z-Way server is accessible, and loads then the THC extension to the z-Way JavaScript interpreter.

z-Way 2.1.1 and above requires authentication. The user name and password of a user registered by the z-Way server needs to be provided.

Init needs to be called before any z-Way devices are declared.

Parameters

Parameters Description
URL Full qualified URL to access the z-Way server. The provided URL needs to be composed by the 'http://' prefix, the IP address as well as the port.
[-user <UserName>] User name for authentication (z-Way 2.1.1 or above)
[-password <UserName>] Password for authentication (z-Way 2.1.1 or above)

Returns

-

Examples

 thc::zWay::Init "http://192.168.1.21:8083" -user admain -password admin

See also

z-Way device definitions