Sending commands to another device

I have a Leviton VRCS4 switch which I have written a driver to use as a simple 4-button switch. This works fine as I simply use Automation to connect each button to the set of lights that I want to control. So far, so good. I am finding that the latency of the new LUA technology very acceptable.

Now I am trying to use the dimmer function on the switch which would affect dimming levels of the connected device. My first plan was to:

  • Use preferences to configure the device id of the switch to be controlled.
  • Use the last button pressed to indicate which switch would be affected
  • Send commands to that switch to affect a dimming level change.

I know that this is not a general solution but would fit my purposes. Of course, that means that I need to be able to emit an event to the other devices.

Can this be done using LUA?

The other alternative to pursue is to use Associations and configure the relevant switch to the group but that involves decoding more behaviors of the VRCS4 as there is no technical doc as to how they work.


Are you saying you can’t find the technical documentation for the VRCS4? Because every certified zwave device must post its technical documentation as part of its certification process, and these (which are called “conformance statements“) are all published on the Z wave alliance website. So you can always look them up.

In this particular case, that specific model does not support zwave direct association, so that’s not going to help you.

You can use local zwave scenes (which the Leviton documentation confusingly call associating the devices, but it isn’t zwave direct association. Note that it also says that the target device must support scene commands.)

That’s covered in the user manual

Also note that this refers to a very specific group of commands called “zwave local scenes.“ It is not the same as “Z wave central scenes,“ which is the more modern version of this functionality. So you’re going to be limited to controlling a very small set of pretty much out of date devices if you do use this method.

1 Like

Exactly, and that’s why I am trying to figure out if I can control the linked devices from my Lua driver. That would mean that I would need to be able to send commands to other devices from my driver. Or do I need to dive into SmartApps to do this?

1 Like

Devices generally can not send events to other devices in the Edge (Lua) environment. The only exception is where they have a parent/child relationship.

Having your button controller device send events directly thru the hub to another unrelated device (like a lamp) isn’t possible.

You’d need to use some external method of communication, be it zwave scenes or association device to device.


Z wave local scenes were never done programmatically. Something physical happened with one zwave device which caused a command to be sent directly to another Z wave device. It didn’t go through the hub at all, so any edge Driver would be irrelevant. Push a button, another light comes on. But you couldn’t issue a command to make that happen. That’s just part of the Z wave specification.

Anyway, I didn’t want to get too far afield on this, but since you brought up the Z wave possibility, I just wanted to mention it.

I’m pretty sure to do what you want in the SmartThings architecture you need an automation, either a routine, a rule, or a custom smartapp hosted elsewhere.

The only exception I could think of Might be @TAustin ‘s mqtt project, which technically isn’t an exception, but lets you run a smartapp and a broker on a local server. But at least keeps you out of the cloud.

Integration Solutions using MQTT

Is there a good reference that explains how zwave scenes are intended to work?

In the independent third-party standard? There’s a lot of documentation over at the zwave alliance site. I don’t know that any of it is particularly concise or easy to get through, though. We used to have to take courses to get certified in z wave, the docs weren’t really intended for self study. :thinking:

I think most self trained home developers start with the site, which is easier to use, and everything’s on webpages.

Just remember that local scenes and central scenes are completely different command sets. Local scenes go directly from one Z wave device to another Z wave device. Central scenes go from the trigger device to the hub.

Local scenes were really only popular for two or three years, basically for wall-mounted multi button devices to control different groupings of other Z wave switches.

But because the command didn’t go through the hub, you couldn’t show status in an app.

Once smart phones became popular, local scenes were pretty useless. that’s when central scenes were developed, because if the hub knew about it, then the app could know about it. So most zwave manufacturers just stopped making devices that supported local scenes.

1 Like

I should add that because z wave materials were all under nondisclosure agreements and limited to people with memberships in the alliance, there are almost no third-party books about it. I think there’s only one available to the public, and it’s out of date now, but since local scenes are also pretty much out of date, they may be covered in it, to be honest I’m not sure.

The basics are still valid, and if you like reading Network engineering textbooks where the English translation may not be perfect (I believe the original was in German), then you’ll probably really like this book. But it’s not a “for dummies“ format and I think it was last updated about five years ago, so it’s not current.

Can you explain how did you upload the driver/handler to smartthings, I can not figure it out, after the transition my vrcs4 stop working I can’t upload a new handler.

I worked around this using rules. Seems to be working quite well, but time will tell.

FYI, I have a smartapp that subscribes to events and creates actions on a rule the first time it sees the event…So I guess it isnt local the first event for the device, but thereafter it is local.

1 Like

vrcs/vrcz 4’s do follow standard zwave scene associations, however they also have a vendor-specific led control, that I used to handle via a smartapp, to sync switch state to it. the S variety also rely on this led state to determine if they should send off or on commands, since they are toggle buttons, not a rocker. The smartapp needed ability to subscribe to events from multiple non-child devices, as well as be able to send raw zwave (or trigger a function) on the device itself. Last time I looked it didn’t see like all this was possible w/ lua/edge, so gave up, but willing to take another look if things changed.

1 Like

I’ve been working on an edge driver for VRCS4 and have gotten the LEDs to kind of work. The device kicks back that the LED setting was an illegal command but it still sets / resets them correctly and with the right color.

The next step was to try to configure associations so that I could see if I could get the dimmer (button 5) to work.

1 Like

it should work if w/o additional “code” if your buttons are done w/ scene association, as it sends dimming commands to the last hit associated entities. If you are running the buttons through the controller, it would require you to manage that yourself though. Do you have your current driver source somewhere?