[OBSOLETE] ZWN-SC7 Enerwave 7 Button Scene Controller

got this response from support and lo and behold I can configure the smartapp!

I went ahead and got the Phrase SmartApp removed for you. I’m so sorry for the inconvenience.

In the future, if you see it again, you can remove it by doing the following:

  1. Log into the IDE at https://graph.api.smartthings.com
  2. Click My Locations
  3. Click List SmartApps
  4. Click “Edit” by Installed SmartApps
  5. Click “Uninstall” next to the SmartApp you want to remove
  6. Click Done

hopefully this means that the switch works - I won’t find out until I get home :slight_smile:

Can you guys please test https://github.com/ady624/ZWN-SC7-Enerwave-7-Button-Scene-Controller/blob/master/ZWN-SC7.DeviceType.groovy?

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
script1470764767146626986535.groovy: 183: expecting ‘)’, found ‘else’ @ line 183, column 5.
else {
^

1 error

Oops, this line needs an additional closing parenthesis at the end, before the accolade:

if ((getDataByName("numButtons") != "$cmd.supportedGroupings") || (getDataByName("numberOfButtons") != (int) cmd.supportedGroupings) {

becomes

if ((getDataByName("numButtons") != "$cmd.supportedGroupings") || (getDataByName("numberOfButtons") != (int) cmd.supportedGroupings)) {

Applied the fix. Will test when I get home for lunch here shortly.

Added it to Github, thank you.

All 7 buttons worked, held doesn’t but I’m sure that’s not supported by the device itself.

1 Like

No sign of “held” in the DTH…

And if you hold button 7 it tries to reset, so that’s just the way it is. :slight_smile:

1 Like

Hi Eric, is the debounce published anywhere?

@ady624, your update looks good but I think is the same as mine (just changed the event text). Did you do anything else?

In general I’m hoping that someone steps up and makes the definitive device with all these edits so we can pull on it and improve it. I wouldn’t mind getting more of these, they are a pretty useful device. If no one does, I will volunteer, I’m just slow and don’t like to keep people waiting for support.

2 Likes

I also added the numberOfButtons attribute and code to update it.

2 Likes

There are two debounce techniques used here. They are both in @mattjfrank github. That is where the most recent handler and SmartApp were as far as I know.

The device handler has a debounce in it that was there when I got involved with the device. I’m not sure who added that one. It didn’t always work because it keeps its debounce tracking information in “state”, which isn’t saved until execution is finished. So you would have two button presses that were close enough together that they both would make it past the debounce check. You can see that in line 114 of the device handler.

After lot’s of issues with this device because of the debounce problem, I got involved to find a work around. Also, when I got involved I found a small coding oversight in the SmartApp that made the app only fire off about 50% of the time when there was slowness in the SmartThings platform. I fixed that and added a debounce technique starting at line 155 of the SmartApp.

Like I mentioned, it is possible that Enerwave fixed the double button presses in later hardware/firmware revisions. Also, if the SmartThings platform is running fast enough, a double press may not cause a device to toggle on and then off, but it was a problem several months ago. Also, if you don’t use the buttons to toggle things, then you probably would never see the issue because SmartApps would merely send a double “on” or “off” command which wouldn’t cause any harm.

4 Likes

I can’t get my SC7 to join the network.

It is right next to a Linear Dimmer that joined fine. The hub is upstairs. Do I need to have ther SC7 close to the hub?

The debounce is no longer in the git you posted. I thought I was crazy, and that you had found it and I couldn’t. :smiley:

I prefer debounce in DTH, because it’s closer to the device. I’ll try to see if I can pull it from revisions, but if you happen to have the code it would be helpful.

Thanks!

Some people had to. I did not (mine two floors away, in a basement). If you want to be lazy like me, move a zwave plug halfway between it and your hub, repair your network, give it all time, then exclude it, then include it. To my detriment, I often work harder at doing it the easy way, than the hard way. :wink:

I keep a hundred foot Ethernet cable on a reel, also have an old router setup as a client bridge. Makes the hub VERY portable with a small UPS (for the router.) Easier than pulling things out of their electrical boxes…

1 Like

I moved the hub close to the SC7 switch and it found it immediately. So far, the switch is working as advertised.

Thanks again to the community for help!

Yes… The device appear to not use the zwave mesh for initial setup/config (may be a zwave security standard, not sure), thus you need close to hub and/or program it before you stuff it in your electrical box. There is also issues with initial setup/config when mounted in a metal electrical box.

It is definitely there. It isn’t labeled “debounce”, but that is what this portion of code does. Starting at line 114:

// The controller likes to repeat the command... ignore repeats
  if (state.lastScene == cmd.sceneId && (state.repeatCount < 4) && (now() - state.repeatStart < 2000)) {
      log.debug "Button ${cmd.sceneId} repeat ${state.repeatCount}x ${now()}"
        state.repeatCount = state.repeatCount + 1
        createEvent([:])
    }

Essentially it works like this:

  • when a button is pressed, it checks to see if it is the same button that was pressed on the previous press.
  • it also checks if the previous button press happened less than 2 seconds ago.
  • in addition it checks to see if this “debounce” method has been entered less than 4 times (not sure what this is for). Maybe to keep it from getting in a stuck state.

I prefer to have it in the device handler as well, but the problem was that the above process would not always work because of a race condition. In SmartThings when you store data in a “state” variable (i.e. state.repeatStart), it only gets written to storage when the process finishes executing. So, if you press the button a single time and it reports two button presses, the following race condition occurs:

  • the device reports button 1 is pressed.
  • the device handler checks to see if the same button was pressed less than two seconds ago.
  • if it hasn’t it creates the button event and sets state.repeatStart to the current time, but at this point it does not write it to storage so . . .
  • the device reports button 1 is pressed again (because the device likes to do this for some reason).
  • the device handler checks to see if the same button was pressed less than two seconds ago. Because the first process has not finished executing, it thinks that it hasn’t and creates a button event.
  • the process for the first button finishes executing and writes state.repeatStart to storage.
  • the process for the seconds button press finishes executing and writes state.repeatStart to storage.

atomicstate writes immediately to storage, but it is not compatible with device handlers. It’s use would make the above process much more sound.

This is a versatile switch with a lot of options thanks to the developer. Each button can toggle, turn on or off, and run a routine.

http://www.ebay.com/itm/Z-Wave-7-Button-Scene-Controller-ZWN-SC7-/111808057038?hash=item1a08478ece

so for the record - this solved all my problems with the switch!

2 Likes