Page 1 of 1

javascript: syntax to call a LightScene

Posted: 02 Mar 2015 23:19
by LAN-Opfer
...I need a Little help:
http://xxx.xxx.xxx.xxx:8083/ZAutomation ... command/on
starts a lightscene.
But what is the Syntax to do the same in a custom JavaScript??


Uwe

Re: javascript: syntax to call a LightScene

Posted: 03 Mar 2015 01:45
by dolpheen
There is an object 'controller' created in z-way-server javascript.
This object is passed to the module on creation, or you can use a global 'controller' variable.

To run the command for ex. on ZWayVDev_zway_7-0-37

Code: Select all

controller.devices.get('ZWayVDev_zway_7-0-37').performCommand('on');
or you can test in a browser with

Code: Select all

[your razberry ip]:8083/JS/Run/controller.devices.get('ZWayVDev_zway_7-0-37').performCommand('on')
There are a lot of good references in automation/modules folder of z-way server.

Re: javascript: syntax to call a LightScene

Posted: 03 Mar 2015 20:19
by LAN-Opfer
thx

Code: Select all

[your razberry ip]:8083/JS/Run/controller.devices.get('ZWayVDev_zway_7-0-37').performCommand('on')
the code works :-)

But how could I find the number of my Scene? I only find LightScene_44 for example. But I could not find ZWayVDev_zway_x-0-xx - where is the assignment for this?

Is the documentation on my Raspberry in ...Automation/modules?? I see only a readme.md there.

Uwe

Re: javascript: syntax to call a LightScene

Posted: 04 Mar 2015 18:22
by dolpheen
You can list all your virtual devices with /JS/Run/controller.devices, 'id' property is a name for device that you can use to perform command on.