-
Notifications
You must be signed in to change notification settings - Fork 1
zWay JS Extension
The file thc_zWay.js of the module thc_zWay implements some functions for the z-Way server that are used by THC. The defined functions are accessible via the z-Way HTTP interface.
This file is automatically loaded to the z-Way server by the thc_zWay module.
Returns the virtual device state
Parameters | Description |
---|---|
NI | Virtual device identifier |
Virtual device status
http://192.168.1.21:8083/JS/Run/Get_Virtual("DummyDevice_bn_5")
-> 1
Sets the virtual device state
Parameters | Description |
---|---|
NI | Virtual device identifier |
state | New state |
Virtual device status
http://192.168.1.21:8083/JS/Run/Set_Virtual("DummyDevice_bn_5",1)
-> 1
Configures audible notification for tag reader. This function binds the alarm notification to a binary switch Set(1) function which will issue an audible notification on a tag reader each time a valid code has been entered.
Configure_TagReader defines the following bindings (for device 22)
http://192.168.1.21:8083/JS/Run/zway.devices[22].Alarm.data[6][5].status.bind( function() {zway.devices[22].SwitchBinary.Set(true); });
http://192.168.1.21:8083/JS/Run/zway.devices[22].Alarm.data[6][6].status.bind( function() {zway.devices[22].SwitchBinary.Set(true); });
Parameters | Description |
---|---|
NI | device identifier |
-
http://192.168.1.21:8083/JS/Run/Configure_TagReader(22)
-> null
Learn the tag reader the last entered code. The tag reader will afterwards accept the new code as a valid one.
The following code learning sequence should be applied :
- Using the 'Home' or 'Away' button, enter a new code or use a new unknown RFID tag.
- Run the TagReader_LearnLastCode command. Provide a new UserId (=code storage location).
- Wakeup the tag reader. This can happen by entering a valid or invalid code. The tag reader will receive from the controller the command to learn the new code.
- Try now using the new code or the new RFID tag. The tag reader will recognize it as valid.
Parameters | Description |
---|---|
NI | Device identifier |
UserId | User identifier (code storage location) |
Information string if the code learning was successful or not
http://192.168.1.21:8083/JS/Run/TagReader_LearnLastCode(22, 2)
-> OK, registered code 52,52,52,52,52,52,0,0,0,0
Configure_TagReader, TagReader_ResetCode
Reset one or all codes a tag reader knows. If no UserId is defined all codes are reset, otherwise only the code assigned to the UserId. After running this command the tag reader needs to be waked up to receive the command to perform the reset.
Parameters | Description |
---|---|
NI | Device identifier |
UserId | User identifier (code storage location, optional) |
-
http://192.168.1.21:8083/JS/Run/TagReader_ResetCode(22) -> resets all codes
http://192.168.1.21:8083/JS/Run/TagReader_ResetCode(22,3) -> resets the UserId specific code
Configure_TagReader, TagReader_LearnLastCode
Get status from devices
Parameters | Description |
---|---|
DeviceList | List of devices organized in an array. Each array element represents a device. A device is itself described by an array composed by the zWave command class, and the device identifier. The device identifier is provided by the zWay configuration utility. The identifier is composed by the device number, the instance number, and the data record. All numbers are separated by a dot (.). |
Device statuses
http://192.168.1.21:8083/JS/Run/Get([["Control","Surveillance"],["SwitchBinary",7.1],["SensorBinary",2],["TagReader",22],["Battery",22],["SensorMultilevel","5.0.1"]])
-> [0,0,1,[1407694169,"unlock"],33,17.7]
http://192.168.1.21:8083/JS/Run/Get([["Virtual","DummyDevice_bn_5"]])
-> [0]
http://192.168.1.21:8083/JS/Run/Get([["Control","Surveillance"],["Control","Alarm"],["SwitchBinary",20.1]])
-> [0,0,0]
Set status for devices
Parameters | Description |
---|---|
DeviceList | List of devices organized in an array. Each array element represents a device. A device is itself described by an array composed by the zWave command class, and the device identifier. The device identifier is provided by the zWay configuration utility. The identifier is composed by the device number, the instance number, and the data record. All numbers are separated by a dot (.). |
State | Device status, usually 0 or 1 |
Device state
http://192.168.1.21:8083/JS/Run/Set([["Control","Surveillance"]],1)
-> [1]
http://192.168.1.21:8083/JS/Run/Set([["Virtual","DummyDevice_bn_5"]],1)
-> [1]
http://192.168.1.21:8083/JS/Run/Set([["SwitchBinary",20.1]],1)
-> [1]
THC, Tight Home Control - See THC index register - THC repository on github.com/Drolla/thc