Hi, here is the code and configuration to use the tag reader with domoticz and z-way.
1/ add Domoticz dummy device to manage the alarme state:
in domoticz, we must add a dummy device to manage and store the alarme state ( arm or disarm)
first : add dummy hardware
second : add dummy device ( name for me is Alarme status)
2/configure the code to arm or disarm the alarme with the tag reader in z-way server
Go in z-way "expert mode" (1) and select "For expert" menu , select "expert command" (2).
Select tag reader device (3):
in "userCode" (4) link, set the code you want (5) to use, click the "Set" (6) user button.
3/configure the tag reader feed back ( tag reader emete sound when the code is right) , and the domoticz dummy device status change.
3.1/create a tagReader.js file in the automation folder of z-way server and put this code :
You must to put the right device ID , the rigth domoticz dummy device idx and the raspberry ip .
/*********** code start **********/
zway.devices[your device ID].Alarm.data[6][5].status.bind(function(){
console.log("tag reader: arm tag reader"); /* log */
zway.devices[your device ID].SwitchBinary.Set(255); /* Switch tag reader to "on" to send feed back */
sendEvent("On"); /* Set domoticz dummy device to "on" to save the alarme status */
});
zway.devices[your device ID].Alarm.data[6][6].status.bind(function(){
console.log("tag reader: disarm tag reader"); /* log */
zway.devices[your device ID].SwitchBinary.Set(255); /* Switch tag reader to "on" to send feed back */
sendEvent("Off"); /* Set domoticz dummy device to "off" to save the alarme status */
});
function sendEvent(status){
http.request({
methode: 'GET',
url:"http://your raspberry IP:8080/json.htm?type=command¶m=switchlight&idx=your domoticz device Id&switchcmd="+status,
header: {
"Content-Type": "application/json"
},
contentType: "application/json",
data: "",
async: true
});
console.log("http://your raspberry IP:8080/json.htm?type=command¶m=switchlight&idx=your domoticz device Idx&switchcmd="+status);
}
/*********** code end**********/
3.2 call this javascript code.
In the main.js file of z-way server, add this line after the line 'executeFile("storage.js");' :
executeFile("tagReader.js");
4/ configure event in domoticz :
configure your event to run buzzer when you door is open.
Like this :
