Gestures with HS-WD200+
Tom Yarmas
tom at yarmas.com
Tue Apr 16 15:47:00 EDT 2019
Here is the script that works.
This is the On script (which is the only place you need the scene script):
on centralScene(theButton, theGesture)
write log "central scene processing for " & (thisUnit) & " theButton=" & theButton & " theGesture=" & theGesture
if theButton = "1" then
if theGesture = "131" then -- double click
-- write log "double click ON"
-- since the switch doesn't control it's local load when doing a double click the first thing we should do is control it
turnon "Basement Hall Lights"
-- brighten "other room light" to 75
-- turnon "yet another light in the room"
end if
if theGesture is equal to "128" then
write log "single click ON"
end if
if theGesture is equal to "132" then
write log "triple click ON"
end if
end if
if theButton is equal to "2" then
-- write log "the bottom paddle was pushed"
if theGesture is equal to "131" then
-- write log "double click OFF"
turnoff "Basement Hall Lights"
end if
end if
end centralScene
— the following is the normal part of the on script that happens only when a single button push happens
-- Since we are setting the LEDs manually, turn on the LEDs when the lights are on
tell xUnit "Basement Lights" to setData(23, 1, 7)
tell xUnit "Basement Lights" to setData(24, 1, 7)
tell xUnit "Basement Lights" to setData(25, 1, 7)
tell xUnit "Basement Lights" to setData(26, 1, 7)
tell xUnit "Basement Lights" to setData(27, 1, 7)
This is the off script:
-- Since we are setting the LEDs manually, turn off the LEDs when the lights are off
tell xUnit "Basement Lights" to setData(27, 1, 0)
tell xUnit "Basement Lights" to setData(26, 1, 0)
tell xUnit "Basement Lights" to setData(25, 1, 0)
tell xUnit "Basement Lights" to setData(24, 1, 0)
tell xUnit "Basement Lights" to setData(23, 1, 0)
I am using LEDs in the basement ceiling lights, so I usually have the unit in Xtension dimmed considerably. I am also using 2 of the LEDs on the switch to indicate that my garage doors are open. I turn them red when the doors are open in the garage door unit script. For those reasons, I am manually turning on the LEDs at the switch in the on/off scripts.
-tom
> On Apr 16, 2019, at 2:43 PM, scott at macplus <scott at macplus.com> wrote
>
> Can you post both of your on and off scripts.
> I was just going to do this same thing.
> Thanks
>
>> On Apr 16, 2019, at 9:46 AM, Tom Yarmas <tom at yarmas.com <mailto:tom at yarmas.com>> wrote:
>>
>> Thanks, that worked. I had to put theGesture value in quotes as well.
>>
>> -tom
>>
>>> On Apr 16, 2019, at 12:15 PM, James Sentman <james at sentman.com <mailto:james at sentman.com>> wrote:
>>>
>>>
>>>
>>>> On Apr 15, 2019, at 8:04 PM, Tom Yarmas <tom at yarmas.com <mailto:tom at yarmas.com>> wrote:
>>>>
>>>> Trying to get the central scene scripting to work with these HomeSeer switches.
>>>>
>>>> If I put the following in the on script, it works and gives me the proper log message:
>>>> on centralScene( theButton, theGesture)
>>>> write log “central scene processing for “ & thisUnit & “ theButton=“ & theButton & “ theGesture=“ & theGesture
>>>> end centralScene
>>>> However, when I put the more complex example in the on script, it seems to ignore it.
>>>>
>>>> I put this in the on script:
>>>> on centralScene(theButton, theGesture)
>>>> if theButton is equal to 1 then
>>>
>>>
>>> For some odd reason that I don’t have a handle on yet, theButton value is sometimes sent as a string instead of a number, so you can’t compare it to a number. You can try doing this:
>>>
>>>
>>> if theButton is equal to “1” then
>>>
>>> and that will probably catch it, after you’ve verified that works I would actually do it like this:
>>>
>>>
>>> if (theButton as number) is equal to 1 then
>>>
>>> which will work in the future after I figure out why that is happening and fix it.
>>>
>>>>
>>>>
>>>> Also, am I correct that I do not need to trap a single click with the centralScene handler? So I would want the normal on script stuff to follow the end of the centralScene part?
>>>
>>> The on/off script will run normally with the reception of a single click, so you can just put your code there. However, they may be called more than once if the ramp rate is long enough that the Vera reports an interim value between the on and off. If you wish to have other things controlled by a single click of the paddle it would be better to put it into the centralScene handler unless it doesn’t matter if it’s triggered more than once.
>>>
>>>
>>>
>>> Thanks,
>>> James
>>>
>>>
>>> James Sentman http://www.PlanetaryGear.org <http://www.planetarygear.org/> http://MacHomeAutomation.com <http://machomeautomation.com/>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> XTensionList mailing list
>>> XTensionList at machomeautomation.com <mailto:XTensionList at machomeautomation.com>
>>> http://mail.machomeautomation.com/mailman/listinfo/xtensionlist <http://mail.machomeautomation.com/mailman/listinfo/xtensionlist>
>>
>> _______________________________________________
>> XTensionList mailing list
>> XTensionList at machomeautomation.com <mailto:XTensionList at machomeautomation.com>
>> http://mail.machomeautomation.com/mailman/listinfo/xtensionlist
>
> _______________________________________________
> XTensionList mailing list
> XTensionList at machomeautomation.com
> http://mail.machomeautomation.com/mailman/listinfo/xtensionlist
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.machomeautomation.com/pipermail/xtensionlist/attachments/20190416/07e6d1db/attachment.html>
More information about the XTensionList
mailing list