javascript: syntax to call a LightScene

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
LAN-Opfer
Posts: 98
Joined: 03 Oct 2014 13:23

javascript: syntax to call a LightScene

Post 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
Z-Way v2.0.1-rc18 on Raspberry Pi
dolpheen
Posts: 119
Joined: 10 Feb 2015 00:38

Re: javascript: syntax to call a LightScene

Post 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.
Razberry B+ 2.0.1-rc25 on ZW500 + 15 devices / Razberry B 2.0.1-rc25 on ZW300 for test
LAN-Opfer
Posts: 98
Joined: 03 Oct 2014 13:23

Re: javascript: syntax to call a LightScene

Post 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
Z-Way v2.0.1-rc18 on Raspberry Pi
dolpheen
Posts: 119
Joined: 10 Feb 2015 00:38

Re: javascript: syntax to call a LightScene

Post 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.
Razberry B+ 2.0.1-rc25 on ZW500 + 15 devices / Razberry B 2.0.1-rc25 on ZW300 for test
Post Reply