Page 1 of 1

Create a scene in ExpertUI for use with Enerwave ZWN-SC7

Posted: 30 Oct 2016 01:40
by flybynt
I have the newest version of the software and I am familiar with creating scenes in <my_IP>:8083/smarthome/#/ interface but the EnerWave ZWN-SC7 7 button scene controller is not able to leverage that functionality as they are created as virtual devices. I can have been able to successfully register the ZWN-SC7 with my Razbery controller for my RPI but I cant figure out a way to assign a scene ID using the "Expert Commands" tab when I have selected the device status for the ZWN-SC7 in the Expert UI at <my_IP>:8083/expert/#/

The link to the manual for the product is not a lot of help either. It can be found here:
http://www.zwaveproducts.com/product-do ... WN-SC7.pdf

I seem to remember a widget or toggle button in previous releases of the software that could be referenced at <my_IP>:8083/z-way-ha or something like that but it does nothing in my release currently.

Any help is appreciated as I have said that any type of virtual device that I might create in the standard UI are not visible in the expert UI.

Re: Create a scene in ExpertUI for use with Enerwave ZWN-SC7

Posted: 18 Nov 2016 07:19
by flybynt
This actually did not turn out to be too hard once I connected the ZWN-SC7 to power and included it into my network. After looking at the JSON that the device return when I queried the device it became clear the scene numbers corresponded to each button on the AWN-SC7 controller and not the Razberry as I had originally thought.

I was able to examine the JSON object tree by using my browser and pointing at the zway API vai http like this:

http://192.168.1.10:8083/ZWaveAPI/Run/devices[xx]

The data should look something like this:

{"0":{"commandClasses":{"32":{"name":"Basic","data":{"invalidateTime":1479360236,"updateTime":1479360231,"type":"empty","value":null,"supported":{"invalidateTime":1479360236,"updateTime":1479360231,"type":"bool","value":true},"version":{"invalidateTime":1479360236,"updateTime":1479360231,"type":"int","value":1},"security":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"bool","value":false},"interviewDone":{"invalidateTime":1479360230,"updateTime":1479360236,"type":"bool","value":true},"interviewCounter":{"invalidateTime":1479360230,"updateTime":1479360236,"type":"int","value":9},"level":{"invalidateTime":1479360236,"updateTime":1479360231,"type":"empty","value":null}},"id":32},"43":{"name":"SceneActivation","data":{"invalidateTime":1479393440,"updateTime":1479393441,"type":"empty","value":null,"supported":{"invalidateTime":1479393440,"updateTime":1479393441,"type":"bool","value":false},"version":{"invalidateTime":1479393440,"updateTime":1479393441,"type":"int","value":1},"security":{"invalidateTime":1479393440,"updateTime":1479393441,"type":"bool","value":false},"interviewDone":{"invalidateTime":1479393440,"updateTime":1479393441,"type":"bool","value":false},"interviewCounter":{"invalidateTime":1479393440,"updateTime":1479393441,"type":"int","value":10},"currentScene":{"invalidateTime":1479393440,"updateTime":1479436518,"type":"int","value":1},"dimmingDuration":{"invalidateTime":1479393440,"updateTime":1479436518,"type":"int","value":255}},"id":43},"45":{"name":"SceneControllerConf","data":{"1":{"invalidateTime":1479360237,"updateTime":1479360236,"type":"empty","value":null,"scene":{"invalidateTime":1479360236,"updateTime":1479360247,"type":"int","value":1},"duration":{"invalidateTime":1479360236,"updateTime":1479360247,"type":"int","value":0}},"2":{"invalidateTime":1479360237,"updateTime":1479360236,"type":"empty","value":null,"scene":{"invalidateTime":1479360236,"updateTime":1479360248,"type":"int","value":2},"duration":{"invalidateTime":1479360236,"updateTime":1479360248,"type":"int","value":0}},"3":{"invalidateTime":1479360237,"updateTime":1479360236,"type":"empty","value":null,"scene":{"invalidateTime":1479360236,"updateTime":1479360249,"type":"int","value":3},"duration":{"invalidateTime":1479360236,"updateTime":1479360249,"type":"int","value":0}},"4":{"invalidateTime":1479360237,"updateTime":1479360236,"type":"empty","value":null,"scene":{"invalidateTime":1479360236,"updateTime":1479360237,"type":"empty","value":null},"duration":{"invalidateTime":1479360236,"updateTime":1479360237,"type":"empty","value":null}},"5":{"invalidateTime":1479360237,"updateTime":1479360236,"type":"empty","value":null,"scene":{"invalidateTime":1479360236,"updateTime":1479360250,"type":"int","value":5},"duration":{"invalidateTime":1479360236,"updateTime":1479360250,"type":"int","value":0}},"6":{"invalidateTime":1479360237,"updateTime":1479360236,"type":"empty","value":null,"scene":{"invalidateTime":1479360236,"updateTime":1479360250,"type":"int","value":6},"duration":{"invalidateTime":1479360236,"updateTime":1479360250,"type":"int","value":0}},"7":{"invalidateTime":1479360237,"updateTime":1479360236,"type":"empty","value":null,"scene":{"invalidateTime":1479360236,"updateTime":1479360250,"type":"int","value":7},"duration":{"invalidateTime":1479360236,"updateTime":1479360250,"type":"int","value":0}},"invalidateTime":1479360230,"updateTime":1479360231,"type":"empty","value":null,"supported":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"bool","value":true},"version":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"int","value":1},"security":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"bool","value":false},"interviewDone":{"invalidateTime":1479360230,"updateTime":1479360237,"type":"bool","value":true},"interviewCounter":{"invalidateTime":1479360230,"updateTime":1479360237,"type":"int","value":8}},"id":45},"114":{"name":"ManufacturerSpecific","data":{"invalidateTime":1479360234,"updateTime":1479360231,"type":"empty","value":null,"supported":{"invalidateTime":1479360234,"updateTime":1479360231,"type":"bool","value":true},"version":{"invalidateTime":1479360234,"updateTime":1479360232,"type":"int","value":1},"security":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"bool","value":false},"interviewDone":{"invalidateTime":1479360230,"updateTime":1479360234,"type":"bool","value":true},"interviewCounter":{"invalidateTime":1479360230,"updateTime":1479360234,"type":"int","value":9},"vendorId":{"invalidateTime":1479360233,"updateTime":1479360234,"type":"int","value":282},"vendor":{"invalidateTime":1479360233,"updateTime":1479360234,"type":"string","value":null},"productId":{"invalidateTime":1479360233,"updateTime":1479360234,"type":"int","value":2819},"productType":{"invalidateTime":1479360233,"updateTime":1479360234,"type":"int","value":2049},"serialNumber":{"invalidateTime":1479360234,"updateTime":1479360231,"type":"empty","value":null}},"id":114},"133":{"name":"Association","data":{"1":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"empty","value":null,"max":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"int","value":32},"nodes":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"binary","value":[1]}},"2":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"empty","value":null,"max":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"int","value":32},"nodes":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"binary","value":[1]}},"3":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"empty","value":null,"max":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"int","value":32},"nodes":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"binary","value":[1]}},"4":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"empty","value":null,"max":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"int","value":32},"nodes":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"binary","value":[1]}},"5":{"invalidateTime":1479393959,"updateTime":1479393960,"type":"empty","value":null,"max":{"invalidateTime":1479393959,"updateTime":1479393960,"type":"int","value":32},"nodes":{"invalidateTime":1479393959,"updateTime":1479393960,"type":"binary","value":[1]}},"6":{"invalidateTime":1479393959,"updateTime":1479393960,"type":"empty","value":null,"max":{"invalidateTime":1479393959,"updateTime":1479393960,"type":"int","value":32},"nodes":{"invalidateTime":1479393959,"updateTime":1479393960,"type":"binary","value":[1]}},"7":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"empty","value":null,"max":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"int","value":32},"nodes":{"invalidateTime":1479393958,"updateTime":1479393959,"type":"binary","value":[1]}},"invalidateTime":1479360230,"updateTime":1479360231,"type":"empty","value":null,"supported":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"bool","value":true},"version":{"invalidateTime":1479360231,"updateTime":1479360232,"type":"int","value":1},"security":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"bool","value":false},"interviewDone":{"invalidateTime":1479360230,"updateTime":1479360237,"type":"bool","value":true},"interviewCounter":{"invalidateTime":1479360230,"updateTime":1479360236,"type":"int","value":9},"groups":{"invalidateTime":1479360235,"updateTime":1479360236,"type":"int","value":7},"specificGroup":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"empty","value":null}},"id":133},"134":{"name":"Version","data":{"invalidateTime":1479360232,"updateTime":1479360233,"type":"empty","value":null,"supported":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"bool","value":true},"version":{"invalidateTime":1479360231,"updateTime":1479360233,"type":"int","value":1},"security":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"bool","value":false},"interviewDone":{"invalidateTime":1479360230,"updateTime":1479360233,"type":"bool","value":true},"interviewCounter":{"invalidateTime":1479360230,"updateTime":1479360231,"type":"int","value":9},"ZWLib":{"invalidateTime":1479360232,"updateTime":1479360233,"type":"int","value":2},"ZWProtocolMajor":{"invalidateTime":1479360232,"updateTime":1479360233,"type":"int","value":3},"ZWProtocolMinor":{"invalidateTime":1479360232,"updateTime":1479360233,"type":"int","value":42},"SDK":{"invalidateTime":1479360232,"updateTime":1479360233,"type":"string","value":"4.54.01"},"applicationMajor":{"invalidateTime":1479360232,"updateTime":1479360233,"type":"int","value":1},"applicationMinor":{"invalidateTime":1479360232,"updateTime":1479360233,"type":"int","value":5},"hardwareVersion":{"invalidateTime":1479360232,"updateTime":1479360233,"type":"empty","value":null},"firmwareCount":{"invalidateTime":1479360232,"updateTime":1479360233,"type":"int","value":0}},"id":134}},"data":{"invalidateTime":1479277034,"updateTime":1479277035,"type":"empty","value":null,"dynamic":{"invalidateTime":1479277034,"updateTime":1479277035,"type":"bool","value":false},"genericType":{"invalidateTime":1479277034,"updateTime":1479277035,"type":"int","value":2},"specificType":{"invalidateTime":1479277034,"updateTime":1479277035,"type":"int","value":2},"nodeInfoFrame":{"invalidateTime":1479277034,"updateTime":1479277035,"type":"empty","value":null}},"id":0}}


It became clear that I could then access the SWN-SC7 controller by binding a javascript function to the SceneActivation.data.currentScene portion of JSON node that corresponds to the device in API for the zway object maintained by the razberry controller which took the following form below where xx represents the device ID for the SWN-SC7 controller and yy & zz represent device IDs for light switches that have been included in my system. I also made sure that the zway device ID that represents the Razberry controller was set in each of the Association groups that the controller supports. The following code implements a simple toggle switch type logic for a given scene.

zway.devices[xx].SceneActivation.data.currentScene.bind(function() {
var scene = this.value;
switch (scene) {
case 1:
level = zway.devices[yy].SwitchBinary.data.level == false ? true : false;
console.log("SWN-SC7 controller: Scene #" + scene + " to level: " + (level == true ? 'On' : 'Off'));
zway.devices[yy].SwitchBinary.Set(level);
zway.devices[yy].SwitchBinary.Set(level);
break;
case 2:
level = zway.devices[yy].Basic.data.level > 0 ? 0 : 255;
console.log("SWN-SC7 controller: Scene #" + scene + " to level: " + (level == 255 ? 'On' : 'Off'));
zway.devices[zz].Basic.Set(level);
zway.devices[zz].Basic.Set(level);
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
default:
console.log("SWN-SC7 controller: Unknown scene");
}
});



I then just attached this code to the Razberry by using a "Load custom JS code" app.


The Zway API document was very helpful and can be found here:

http://razberry.z-wave.me/docs/zway.pdf

What is cool is that the pdf gives us an easy way access to virtual devices and such as well.


Once I had this done I was able to press a button and control my devices. I was able to look at the log output and see my log statements along with the zway traffic by doing the following command after having a shh terminal window open. It was

tail -f /var/log/z-way-server.log

I hope this helps someone use this nifty little device. I will most likely convert this to an app that can be used easily in the future.