Setting Z-Wave parameters via Luup

I would like to control the raising and lowering time of my Merten roller shutter devices. The raising and lowering time can be adjusted by changing Z-Wave parameters 177-180 (see http://www.merten.de/download/DL_doku/V5025_581_01_web.pdf, page 23). Can this be done via Luup as part of a scene?

More general question:
How can Z-Wave parameters be adjusted via Lua/Luup?

Of course, one could modify the appropriate configuration file and reload/reboot Vera,
but there must be an easier - and safer - way to achieve this.

Ap15e, what you want to accomplish should be easy: Go to DEVICES, find your Merten, click the + button at right, and then the ADVANCED button below.

Parameters, 177, 178, 179 or 180 may already be present and contain a value - which you can change - or you may have to add a new Variable/Value pair by typing them in (click ADD). Click SAVE to keep all changes.

(I’m not sure what “New Service:” means, as newer Luup firmware altered the language of these Advanced fields … you may need to experiment, or ask MCV for clarification. Sorry.)

MCV, is there a clear Wiki entry for adding these “Capabilities” to a device?? Should be one!

Right, setting Z-Wave parameters via Vera’s GUI is no challenge.

But what I am looking for is a way to configure these parameters via Lua/Luup.

Oops, I had suspected you already knew the UI approach!

I’ll be interested to see if someone like ‘guessed’ can help you out with a Luup approach.

Pseudocode (untested):

[ul][li]res := urn:micasaverde-com:serviceId:HomeAutomationGateway1 → GetVariable(DeviceNum, ‘urn:micasaverde-com:serviceId:ZWaveDevice1’, ‘VariablesSet’)[/li]

[li]modify res[/li]

[li]urn:micasaverde-com:serviceId:HomeAutomationGateway1 → SetVariable(DeviceNum, ‘urn:micasaverde-com:serviceId:ZWaveDevice1’, ‘VariablesSet’, res)[/li]

[li]urn:micasaverde-com:serviceId:HaDevice1 → Reconfigure()[/li][/ul]

But there are at least two difficulties (1.0.918):

[ul][li]DeviceNum is declared as ui1, but some of my devices have DeviceNum > 16000[/li]

[li]GetVariable does not work (even for devices with DeviceNum < 256; GetStatus plus parsing could be used as a workaround)[/li][/ul]

MCV, could you take a look at these issues, please?

Found a quite elegant solution to the problem.

Link to source code:

Very nice one! I think this can be used in other cases too.
ACT ZRM /ZDM has night lights within the switches which can be turned on/off by parameters.

What I’m thinking about is, when it’s day, they could be turned off and otherwise in the night…
I’ll give it a try the next few days. Thank you for this so far :wink:

Does setting the raising and lowering times result in “dimmable” Merten roller shutter devices, that then support levels?

If yes: do I have to get these times by stopwatch or is there a kind of “stopwatch-/calibration-script” for a scene?

If no: is there another way to make them understand level-commands?

Replace the merten shutter devices with duewi shutter devices, see http://forum.micasaverde.com/index.php?topic=3359.0 - or ask merten to provide a firmware upgrade, which supports dimming …

If you are going to use my script for merten shutter devices, you should add a check, that the ‘Reconfigure’ was successful.

http://forum.micasaverde.com/index.php?topic=3512.msg17078#msg17078 might be of interest, too.

@micasaverde

There should be luup function for setting Z-Wave parameters.

I have a Vera Lite installed and it is functioning superbly. Also, I have a GE ZW3003 dimmer which is also working quite well.

I would like to use the blue LED on the ZW3003 as a signal to indicate that my part of my system is armed. I have tried to get the LUA code to turn the LED on and off by setting the ConfiguredVariable parameter, but that has not been successful.
Here’s the code:

luup.variable_set(“urn:micasaverde-com:serviceId:Dimming1”,“ConfiguredVariable”,“3,1d,2”,nn) where nn is my device no.
(The “3,1d,2” turns the LED off.)

Also tried: luup.variable_set(“urn:micasaverde-com:serviceId:ZWaveDevice1”,“ConfiguredVariable”,“3,1d,2”,nn)
and this: luup.variable_set(“urn:micasaverde-com:serviceId:Dimming1”,“VariablesSet”,“3,1d,2”,nn)
and this: luup.variable_set(“urn:micasaverde-com:serviceId:ZWaveDevice1”,“VariablesSet”,“3,1d,2”,nn)

The device/Vera accepts the code, but the device does not change the parameter. Ap15e posted some code in GoogleDocs a while back, but that code is locked.

I have been writing code forever, but this stuff is new to me, and frankly, it is not well documented. Any help would be appreciated.

Does anyone has some sample code that allows turning the LED on and off?

Does the device even support the modification of the led? The only devices that I know of that allow the modification of the led is the Leviton scene and zone controllers.

  • Garrett

Setting Variables via variable_set does just that, these values are not propagated to the physical device. You’ll probably need to muck with the SendData service method… If those devices are able to take commands, and you can work out how to send it in ZWave form.

For the Leviton’s, there’s a built in method as Garrett indicates:
http://wiki.micasaverde.com/index.php/Leviton_LED_Debugging

@jimshaughn,

Welcome!

You’d probably have to do a [tt]Reconfigure[/tt] on the device to actually get the settings updated in the device itself, not just the variable in Vera.
[tt]Reconfigure[/tt] is a bit of a crude method though, as it does ‘too much’. However, I’m not aware of a call (other than low-level Z-Wave) to rewrite just the configuration parameter in the device.

Also, I’m guessing the LED parameter takes 0 or 1 as a value, but perhaps anything other than 0 is fine to invert.

Are you going to invert the LED with every state toggle, also?

Edit:
partial cross-reply with @guessed; the low-level Z-Wave command I mentioned, is the [tt]SendData[/tt] @guessed is referring to.

[quote=“garrettwp, post:12, topic:164851”]Does the device even support the modification of the led? The only devices that I know of that allow the modification of the led is the Leviton scene and zone controllers.

  • Garrett[/quote]
    The doc for the GE ZW3003 switch says that:
    0 = LED is on if switch is off (default)
    1 = LED is on if switch is on
    2 = LED is off always
    By setting this manually in Configuration Settings under Device Options on the Vera, it works as advertised. So one would assume it should also be programmable because the result gets posted to the Advanced variable, “urn:micasaverde-com:ServiceId:ZWaveDevice1, ConfiguredVariable”. Go figure.

[quote=“guessed, post:13, topic:164851”]Setting Variables via variable_set does just that, these values are not propagated to the physical device. You’ll probably need to muck with the SendData service method… If those devices are able to take commands, and you can work out how to send it in ZWave form.

For the Leviton’s, there’s a built in method as Garrett indicates:
http://wiki.micasaverde.com/index.php/Leviton_LED_Debugging[/quote]

Guessed, I am not sure what you mean, "… does just that, … " Do you mean it gets posted in Vera, but not transmitted to the physical device? That would match the symptoms, except that the ConfiguredVariable field does sometimes change, but it is not consistent. I’m not certain why. Perhaps I should be more rigorous in my testing.

[quote=“oTi@, post:14, topic:164851”]You’d probably have to do a [tt]Reconfigure[/tt] on the device to actually get the settings updated in the device itself, not just the variable in Vera.
[tt]Reconfigure[/tt] is a bit of a crude method though, as it does ‘too much’. However, I’m not aware of a call (other than low-level Z-Wave) to rewrite just the configuration parameter in the device.

Also, I’m guessing the LED parameter takes 0 or 1 as a value, but perhaps anything other than 0 is fine to invert.

Are you going to invert the LED with every state toggle, also?

Edit:
partial cross-reply with @guessed; the low-level Z-Wave command I mentioned, is the [tt]SendData[/tt] @guessed is referring to.[/quote]

The parameter it takes is: “3,1d,n”, where n is the value I mention in reply to Garret above. The 3 means parameter 3 in the switch (7 sets the dimming rate, 9 sets the steps in dimmer’s rocker, etc. etc.) … 1d is the format, that is, 1 byte decimal. All this works fine manually, so I suspect you are correct that this is never getting downloaded to the device. And yes, I plan to set the value when the switch changes from off to on, or vice versa,but is also being driven by other events such as a sensor being tripped.

Any help on “Reconfigure” and the SendData command would be appreciated.

Guessed, I am not sure what you mean, "... does just that, ... " Do you mean it gets posted in Vera, but not transmitted to the physical device? That would match the symptoms, except that the ConfiguredVariable field does sometimes change, but it is not consistent. I'm not certain why. Perhaps I should be more rigorous in my testing.
Yeap, it literally sets the value of the variable and then stops. Typically consumers of a plugin would call [i]Actions[/i] on that plugin to manipulate it's state.

In turn, these actions would make some sort of actual call to the physical device, it in’s native protocol,and then the action’s implementation would update one or more of the plugin’s state variables with the “new state” information.

When you call [tt]luup.variable_set[/tt] directly, you miss out on the part that calls the physical device.

In reverse, there are times that the physical device itself will communicate with Vera, over Z-Wave or whatever. When this happens, Vera “copies” that latest state information into the State variables so they’ll be “in sync” with the device (more or less, barring a multitude of bugs)

You can think of these variables as a cache of the current state of the device. While you can tweak the cache value(s) directly, it has no impact on the physical device itself.

That said, if you’re able to manipulate the device itself via the UI and get the desired [LED] behavior then you can just see what [Vera] API’s those URL’s are calling and then reproduce that. This can be captured either in a tool like Wireshark (Browser → Vera interactions) or by putting Vera into verbose logging mode and observing the output of /var/log/cmh/LuaUPnP.log as you interact in the UI.

In both cases, these techniques should give you a lot of clues as to next-steps. I don’t have any GE devices in my home so I’m not going to be handy for this exercise.

Ah, interesting; they must have added that in newer versions of the device. (An additional always-on mode would have been handy for your application.)

And yes, I plan to set the value when the switch changes from off to on, or vice versa[...]
That's what I figured. I would not recommend using a [tt]Reconfigure[/tt] action ([tt]urn:micasaverde-com:serviceId:HaDevice1[/tt]) on the device then. I believe it is the underlying action for the [tt]Configure node right now[/tt] button in the GUI. As said, that does too much and takes a while.

That leaves a DIY workaround with [tt]SendData[/tt]. Give the following a go:

luup.call_action('urn:micasaverde-com:serviceId:ZWaveNetwork1','SendData',{Node='<nodeID>',Data='112 4 3 1 <mode>'},1)

Where [tt][/tt] is the Z-Wave NodeID ([tt]Settings[/tt]->[tt]ID[/tt] / [tt]Advanced[/tt]->[tt]altid[/tt]), so not the [tt]Device#[/tt], of the device, and [tt][/tt] is:
[tt]0: LED is on if switch is off[/tt]
[tt]1: LED is on if switch is on[/tt]
[tt]2: LED is off always[/tt]

Tried it on the in-wall dimmer and outlet.

Also, keep in mind that the GE’s do not support instant updates, so getting the status change relayed to Vera may not be (reliably) instant.

Took a break at the beach, now back at it.
It seems if I replace my GE dimmer with a Leviton, then my problem is solved with some code. Before I invest $100 though, I wanted to check a couple of things with you guys.

  1. Does the Leviton dimmer provide instant status update? I think you said that it did.
  2. With some LUA code, the dimmer’s LED can be updated dynamically according to the description in Garret’s wiki at
    http://wiki.micasaverde.com/index.php/Leviton_LED_Debugging
  3. What is the best Leviton dimmer to buy?
  1. Yes, all leviton devices support instant status updates.

  2. Only works on scene and zone controllers.

  3. Depends on what you are controlling.

  • Garrett

As @garrettwp said, it (only) depends on what you are controlling: use an ‘I’ for incandescent, ‘M’ for magnetic low-voltage , ‘E’ for electronic low-voltage loads; make sure not to exceed the W/VA rating (and possible de-rating if used in multi-gang). Example: VRI06 for incandescent lighting, no more than 600W total. (Side note: The incandescent ones have no neutral. Attempting to use those with LED lighting may yield limited success. So for LED lighting you may want to have a look at other options; folks have documented their results in various topics.)