Command line examples for switching

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
McD
Posts: 17
Joined: 28 Mar 2013 14:15

Command line examples for switching

Post by McD »

The start is always the hardest. Reading sensor data with the RaZberry already works fine, switching with z-way demo software as well, but automatisation with my custom installation still is not working.

I am looking for command line example for using the z-wave switches with the RaZberry.

Before implementation I would like to test these with curl, but my attempts failed so far.

Example:

With a statement of

$ /usr/bin/curl -LN http://_ip_address_:8083/ZWaveAPI/Data/1364468134

I receive a json string, which I can parse for the info I am looking for.

What is missing now, is what to send with curl to set the value of a switch to 255 (ON) or 0 (OFF)?

Thank you

McD
Posts: 17
Joined: 28 Mar 2013 14:15

I found one solution...

Post by McD »

..just for helping others in the same situation.

What you read in the razberry.pdf on page 31 did not work with my setup. Nothing happend when I used ...Basic.Set(255) to switch on the lights...

On my system this here worked:

$curl -s -LN --globoff 'http://_ip_address_:8083/ZWaveAPI/Run/devices[2].instances[0].commandClasses[32].Set(255)'
>null

(This will switch on device 2)

$ curl -s -LN --globoff 'http://_ip_address_:8083/ZWaveAPI/Run/devices[2].instances[0].commandClasses[32].data.level.valueOf()'
>255

(This indicates the level (255=ON) for device 2)

$ curl -s -LN --globoff 'http://_ip_address_:8083/ZWaveAPI/Run/devices[2].instances[0].commandClasses[32].Set(0)'
>null

(This will switch off device 2)

$ curl -s -LN --globoff 'http://_ip_address_:8083/ZWaveAPI/Run/devices[2].instances[0].commandClasses[32].data.level.valueOf()'
> 0

(This indicates the level (0=OFF) for device 2)
McD
Posts: 17
Joined: 28 Mar 2013 14:15

software update changed things...

Post by McD »

..after the software update today, these will only work, when using

..commandClasses[37]...

Why?
SpamNeinDanke
Posts: 21
Joined: 26 Mar 2013 21:34

Command classes

Post by SpamNeinDanke »

Hi McD,

according to the command class descriptions ( http://wiki.micasaverde.com/index.php/Z ... nd_Classes ) you were using the CC BASIC. Now you are using SWITCH_BINARY which seems to be the correct command class for your purpose. I however do not know why the behavior changed in Z-Way.

BASIC should also be capable of doing what you origionally could as it has to implement ther functions ( http://wiki.zwaveeurope.com/index.php?t ... tion_Layer )

SET: set a value between 0 and 255 (0x00 …0xff);
GET: ask the device to report a value;
REPORT: response to the Get command. Reports a value between 0 and 255 (0x00 … 0xff);
User avatar
PoltoS
Posts: 7571
Joined: 26 Jan 2011 19:36

Please post us the log using

Post by PoltoS »

Please post us the log using 32.
McD
Posts: 17
Joined: 28 Mar 2013 14:15

...information and log

Post by McD »

I do
$ /usr/bin/curl -s -LN --globoff 'http://__ip_address__:8083/ZWaveAPI/Run/devices[X].instances[0].commandClasses[32].Set(255)'

and I receive this error message:
Uncaught TypeError: Cannot call method 'Set' of undefined


In the log file, after many many attempts to fill the JS buffer (please see other thread about this problem) I get this:

Executing script: zway.devices[X].instances[0].commandClasses[32].Set(255)
result: Error: Uncaught TypeError: Cannot call method 'Set' of undefined

Does this help?

(For finding a problem it would be really helpful to have an instant log file, which logs the events and messages in the order they appeared. Having this buffered JS log is a problem.)
dholland
Posts: 9
Joined: 24 Mar 2013 18:39

It looks like you're using

Post by dholland »

It looks like you're using /Run/devices[X] instead of /Run/devices[2] in the above post. If that's true, it would throw the error.
Post Reply