Use Wall Switch Button Press as Variable

variables

#1

1) Give a description of the problem
Unable to figure out how to use the press of a GE wall switch as a variable in a Piston.

2) What is the expected behavior?
I would like to have a door contact turn on a light when it opens, and then turn off the light after a set amount of time regardless of door contact status. I would like to ignore the turn off timer IF the ON button is pressed on the light switch.

3) What is happening/not happening?
I can’t figure out how to use the button press as a variable.


#2

What DTH are you using? You have to use one that supports the double up and double down as buttons. The one that have has assigns the double up as button 1 and double down and button 2. They can only be pushed, not held. Then they are exposed like any other button would be in WebCore.


#3

I guess I don’t know to change the DTH. These are GE/Lasco dimmer switches. I am using whatever DTH is there by default. Can you provide an example of how these button presses would appear in the webcore?


#4

This sounds do-able even with a primitive DH:

define
boolean lightOverride
end define

IF light switch changes to ON
Then set variable lightOverride = true
END IF

IF light switch changes to OFF
Then set variable lightOverride = false
END IF

IF door contact changes to open
Then turn on light
Wait X minutes
    IF lightOverride is false
    Then turn off light
    END IF
END IF

(Notice the last IF is embedded inside another IF)


#5

He is trying to use the double tap function as an independant button press. This is only possible if you use the Custom DTH. You can find one on the ST forum.


#6

My bad. I didn’t notice him mentioning double taps.


#7

Your function would not work either. You can’t tell the difference between the switch being turned on by the motion sensor rather than the physical switch. Your function would set the variable whether it was turned on manually or with the motion sensor. The physical interaction function in WebCore also doesn’t work. Once the switch is on, it is on. You can’t turn it on again by hitting the up side of the switch. That would not be recognized as a state change. The only way to do this would be to use the double tap function of the DTH.


#8

There must be another thread that I am unaware of, because I see no mention of a “motion sensor” being a part of the setup. That being said, my piston above is rock solid for what was asked for in the original post.


#9

Sorry, contact. That makes a HUGE difference. LMAO


#10

Thanks everyone for your comments. I did not mention a double tap, however I’ve read somewhere that that function does not work.

I have loaded two different Device Handlers and changed them on the dimmer switch that I am working with both of which said that they had enhanced functions like these: Actuator, Health Check, Indicator, Polling, Refresh, Sensor, Switch, Switch Level

I thought that one of these functions would allow the button press to be used as a variable, but neither of the two device handlers that I loaded offered any different features or variables in webcore.

Ryan, what do you mean when you say that the “The physical interaction function in WebCore also doesn’t work.” ??

It seems really weird that the button press cannot be captured independently of the switch action… The webcore really feel likes the least intuitive logic engine I have ever seen. It is very disappointing sometimes.


#11

I do not know your level when it comes to variables, so I apologize if I am stating the obvious here…

Variables do not automatically populate. For them to be written to, there has to be "Set variable" code somewhere in the piston… (There is an exception to this, but let’s save that for another time)


Here is a barebones example to capture & store the variable:

Which will add a brief description to the Dashboard when the light changes. (so you know it’s working)
Clipboard01

If you import this piston, just point it to your GE wall switch. Afterwards, any advanced options for your Device Handler can be found if you edit the line:
"Bulb's switch changes to on"
Take a look at the drop down menus there. (particularly under the word “switch”)


#12

Actually, the physical interaction function in webCoRE does work — you have to have switches and an appropriate DTH for those switches that support it. ST’s default Z-Wave Switch DTH does not support physical interaction anymore.


#13

Okay, @elf, i have a whole bunch more hairs over here…you wanna split them too? LOL. Bottom line, no DTH that I’ve ever seen differentiates between physical press and software press.

And what I meant is that there is no function of the device of “button up pressed”. There is only switch on. However, there are two “button” functions for the GE switches. If you double press up, that translates to button 1 being pressed and if you double tap down, that can translate to button 2 being pressed. But you need a DTH that supports that .


#14

Nah … I have lots of split-ends in my hair to deal with :laughing: :stuck_out_tongue_winking_eye:

I’m aware of two that are in the IDE:
My Device Handlers -> +Create New Device Handler -> From Example
They’re both named Z-Wave Switch :man_shrugging:

I’m using the second one for my GE paddle switches, and it’s been working fine for detecting physical and programmatical “presses” of the switches. From the device’s List Events, you’ll get:

Programmatic “presses”

Physical presses

So, for theses switches (and appropriate DTH), webCoRE supports interaction through either its’ Interaction option, or you can also test for $currentEventDevicePhysical:

I switched to using the DTH (without any modifications) since ST decided to drop interaction in their default Z-Wave Switch handler the later half of last year. Their reasoning being that it was too unreliable. I get a false-positive from this DTH about once in 3 to 4 months — just as reliable (or better) than what I generally get from using SmartThings as a whole :thinking:

OK, back on topic LOL


#15

Okay, but the switch is still turning on, right? You don’t see them as button presses. If the switch is on, for whatever reason, you can’t turn it on again, right?


#16

Correct … they turn on from an off state only, which answers you 2nd question. They are on/off events, not button-press events (like what you’d get from a Minimote or keypad, for example.)

Correct … they only turn on from an off state and turn off from an on state. I.E. , the switch’s DTH state doesn’t really allow one to turn the switch off if it’s already off because “pressing” the switch again (either physically or programmatically) just turns it on … and vise versa …


#17

Elf, when I try to create a new device handler with either Z-Wave switch i guess this error.

Any idea why that is? I am using a 1st gen hub, if that helps.


#18

Looks like they modified the examples since the time I used the 2nd one.

Delete the last three definitions, high-lighted below:

That should allow you to create the custom handler … and while you’re at it, change the name (1st definition on the same line) to make it easier to identify your version :smile:

Let us know if this works for your GE switches, i.e., if interaction works.


#19

I was able to save the new device handler after making the modifications shown above. I was then able to go into My Devices and edit my switch (which is a dimmer, I hope i mentioned that earlier) but when I click the update button, it goes to blank page. I had this problem when trying other DTHs but they would finally update after several attempts. Is this because I am using a regular Z-Wave Switch DTH with a dimmer switch?


#20

Yeah … the DTH you’re using lists only switches in the code — no dimmers.