drich Posted September 26, 2013 Posted September 26, 2013 I have a pair of switches that control a single light that is also activated by a motion detector. I'm trying to write some code that disables the motion detector when I double-click the switch, and renables it when I double-click it off. This seems like it should be really easy, but for the life of me I cannot get it to work! I have a program called "Hall Motion Disable" that has the following code: If ( Control 'Lighting / Hall Switch 1' is switched Fast On And Control 'Lighting / Hall Switch 1' is not switched Fast Off ) Or ( Control 'Lighting / Hall Switch 2' is switched Fast On And Control 'Lighting / Hall Switch 2' is not switched Fast Off ) Then Run Program 'Hall Light Timer' (Else Path) Else What I would expect is that I if I double-click either switch the program would show a status of True in the Program Summary, and if I double-click them off it would switch to False. However, the program status never goes to True. In fact, it shows that it has never even run. Am I missing something really obvious here? This seems like it should be a no-brainer. The two SwitchLincs are controllers in a scene along with another KeypadLinc that has a button I use for status, but other than that there isn't anything special about them. Fast-on on either switch does bring the light on at 100% immediately, so I know they are talking to each other and the ISY does show the light level correctly in the web gui. If no one has any obvious ideas, I'll grab some debug output from my playing with the switches tonight and see if that helps (pardon the pun) shed some light on the problem.
bsobel Posted September 27, 2013 Posted September 27, 2013 Ok, this is where the ISY language syntax doesn't make sense to (some of us). The second line 'and control is NOT' doesn't do what I think you expect it to do. Its normally used when you actually want to check for that event (e.g. fast off) but want the else clause to fire. As written I don't think the statement can every fire. I also don't think you need the 'is not switched' part of each test. If you remove that you should be fine.
LeeG Posted September 27, 2013 Posted September 27, 2013 This Program is triggered True when a Fast On is created and triggered False when a Fast Off is created. Suggest checking to be sure a program save is not pending, the program is Enabled, not in a Folder that has a False status. If ( Control 'SwitchLinc DB Dimmer v40' is switched Fast On And Control 'SwitchLinc DB Dimmer v40' is not switched Fast Off ) Or ( Control 'SwitchLinc Relay' is switched Fast On And Control 'SwitchLinc Relay' is not switched Fast Off ) Then Send X10 'A1/On (3)' Else Send X10 'A1/Off (11)' - No Actions - (To add one, press 'Action') If nothing obvious is found run Tools | Diagnostics | Event Viewer at LEVEL 3. Create the double tap and confirm the event trace actually shows a Fast On command.
TJF1960 Posted September 27, 2013 Posted September 27, 2013 Well, I may just be really tired, but as his program is written I too would expect the program to be true if either switch was fast on, and false if either switch was fast off. If it were me I think I would be looking to see if there are any comm. issues, maybe the ISY is not receiving the fast on/off commands from those switches.
bsobel Posted September 27, 2013 Posted September 27, 2013 As written with the ands I don't see how it could ever execute
LeeG Posted September 27, 2013 Posted September 27, 2013 I added Actions to the Then (X10 A1/On) and Else (X10 A1/Off) clauses. This is what the event trace should look like. Thu 09/26/2013 09:02:24 PM : [iNST-SRX ] 02 50 1D.38.00 00.00.01 CB 12 00 LTON-F (00) Thu 09/26/2013 09:02:24 PM : [std-Group ] 1D.38.00-->Group=1, Max Hops=3, Hops Left=2 Thu 09/26/2013 09:02:24 PM : [ 1D 38 0 1] DFON 0 Thu 09/26/2013 09:02:24 PM : [ 1D 38 0 1] ST 255 Thu 09/26/2013 09:02:24 PM : [X10-RSP ] 02 63 66 00 06 Thu 09/26/2013 09:02:24 PM : [ 20 29 9C 1] ST 255 Thu 09/26/2013 09:02:24 PM : [ X10] A1 Thu 09/26/2013 09:02:24 PM : [ X10] A1/On (3) Thu 09/26/2013 09:02:25 PM : [iNST-SRX ] 02 50 1D.38.00 22.80.0B 4B 12 01 LTON-F (01) Thu 09/26/2013 09:02:25 PM : [std-Cleanup ] 1D.38.00-->ISY/PLM Group=1, Max Hops=3, Hops Left=2 Thu 09/26/2013 09:02:25 PM : [iNST-DUP ] Previous message ignored. Thu 09/26/2013 09:02:57 PM : [iNST-SRX ] 02 50 1D.38.00 00.00.01 CB 14 00 LTOFF-F(00) Thu 09/26/2013 09:02:57 PM : [std-Group ] 1D.38.00-->Group=1, Max Hops=3, Hops Left=2 Thu 09/26/2013 09:02:57 PM : [ 1D 38 0 1] DFOF 0 Thu 09/26/2013 09:02:57 PM : [ 1D 38 0 1] ST 0 Thu 09/26/2013 09:02:57 PM : [X10-RSP ] 02 63 66 00 06 Thu 09/26/2013 09:02:57 PM : [ 20 29 9C 1] ST 0 Thu 09/26/2013 09:02:57 PM : [ X10] A1 Thu 09/26/2013 09:02:57 PM : [ X10] A1/Off (11) Thu 09/26/2013 09:02:58 PM : [iNST-SRX ] 02 50 1D.38.00 22.80.0B 4B 14 01 LTOFF-F(01) Thu 09/26/2013 09:02:58 PM : [std-Cleanup ] 1D.38.00-->ISY/PLM Group=1, Max Hops=3, Hops Left=2 Thu 09/26/2013 09:02:58 PM : [iNST-DUP ] Previous message ignored.
LeeG Posted September 27, 2013 Posted September 27, 2013 bsobel With If Control only one command is possible at a time. With the following If the first line is True when a Fast On is created and the second line is True when a Fast On is created because of "not switched Fast Off". See the event trace I posted above which shows the Then is executed with a Fast On and the Else is executed with a Fast Off. If ( Control 'SwitchLinc DB Dimmer v40' is switched Fast On And Control 'SwitchLinc DB Dimmer v40' is not switched Fast Off )
LeeG Posted September 27, 2013 Posted September 27, 2013 bsobel I find the sequence easier to understand if ORed together (just the way my mind works) but both AND and OR produce the same results If ( Control 'SwitchLinc DB Dimmer v40' is switched Fast On And Control 'SwitchLinc DB Dimmer v40' is not switched Fast Off ) Produces the same result as If ( Control 'SwitchLinc DB Dimmer v40' is switched Fast On Or Control 'SwitchLinc DB Dimmer v40' is not switched Fast Off )
drich Posted September 27, 2013 Author Posted September 27, 2013 Well, the trace shows my problem, I'm not getting a fast-on when I double-click on the SwitchLinc. Below is what I see when I walk across the room and do a double-click on it. Any ideas why a double-click wouldn't generate a fast-on? The lights connected to the switch do come up to 100% immediately, although the admin interface only shows them at 30%, which is what the current on-level is set to at night when the motion detector triggers. If I query the device, then the level jumps to "On". The devices involved: [*:2fljw7vr]12 1E B5 - Hall Switch 1[*:2fljw7vr]12 1D 83 - Hall Switch 2[*:2fljw7vr]14 10 62 - Hall motion detector[*:2fljw7vr]14 10 58 - Motion detector in the room I'm in Thu 09/26/2013 19:53:18 : [iNST-SRX ] 02 50 14.10.58 00.00.01 CB 11 01 LTONRR (01) Thu 09/26/2013 19:53:18 : [std-Group ] 14.10.58-->Group=1, Max Hops=3, Hops Left=2 Thu 09/26/2013 19:53:18 : [ 14 10 58 1] DON 1 Thu 09/26/2013 19:53:18 : [ 14 10 58 1] ST 255 Thu 09/26/2013 19:53:18 : [iNST-SRX ] 02 50 14.10.58 00.00.01 CB 11 01 LTONRR (01) Thu 09/26/2013 19:53:18 : [std-Group ] 14.10.58-->Group=1, Max Hops=3, Hops Left=2 Thu 09/26/2013 19:53:18 : [iNST-DUP ] Previous message ignored. Thu 09/26/2013 19:53:19 : [iNST-TX-I1 ] 02 62 00 00 1A CF 11 00 Thu 09/26/2013 19:53:19 : [ Time] 19:53:19 9(0) Thu 09/26/2013 19:53:19 : [iNST-ACK ] 02 62 00.00.1A CF 11 00 06 LTONRR (00) Thu 09/26/2013 19:53:19 : [ 15 4A F 1] ST 102 Thu 09/26/2013 19:53:23 : [iNST-SRX ] 02 50 14.10.62 00.00.01 C7 11 01 LTONRR (01) Thu 09/26/2013 19:53:23 : [std-Group ] 14.10.62-->Group=1, Max Hops=3, Hops Left=1 Thu 09/26/2013 19:53:23 : [ 14 10 62 1] DON 1 Thu 09/26/2013 19:53:23 : [iNST-SRX ] 02 50 14.10.62 00.00.01 C7 11 01 LTONRR (01) Thu 09/26/2013 19:53:23 : [std-Group ] 14.10.62-->Group=1, Max Hops=3, Hops Left=1 Thu 09/26/2013 19:53:23 : [iNST-DUP ] Previous message ignored. Thu 09/26/2013 19:53:30 : [iNST-SRX ] 02 50 14.10.58 00.00.01 CB 11 01 LTONRR (01) Thu 09/26/2013 19:53:30 : [std-Group ] 14.10.58-->Group=1, Max Hops=3, Hops Left=2 Thu 09/26/2013 19:53:30 : [ 14 10 58 1] DON 1 Thu 09/26/2013 19:53:31 : [iNST-SRX ] 02 50 14.10.58 00.00.01 CB 11 01 LTONRR (01) Thu 09/26/2013 19:53:31 : [std-Group ] 14.10.58-->Group=1, Max Hops=3, Hops Left=2 Thu 09/26/2013 19:53:31 : [iNST-DUP ] Previous message ignored. Thu 09/26/2013 19:53:31 : [iNST-TX-I1 ] 02 62 00 00 10 CF 13 00 Thu 09/26/2013 19:53:31 : [iNST-ACK ] 02 62 00.00.10 CF 13 00 06 LTOFFRR(00) Thu 09/26/2013 19:53:31 : [ 12 1D 83 1] ST 0 Thu 09/26/2013 19:53:31 : [ 12 1E B5 1] ST 0 Thu 09/26/2013 19:53:32 : [iNST-TX-I1 ] 02 62 00 00 19 CF 11 00 Thu 09/26/2013 19:53:32 : [ 1B 9E A2 6] ST 0 Thu 09/26/2013 19:53:32 : [iNST-ACK ] 02 62 00.00.19 CF 11 00 06 LTONRR (00) Thu 09/26/2013 19:53:32 : [ 12 1D 83 1] ST 76 Thu 09/26/2013 19:53:32 : [ 12 1E B5 1] ST 76 Thu 09/26/2013 19:53:32 : [iNST-TX-I1 ] 02 62 00 00 19 CF 11 00 Thu 09/26/2013 19:53:32 : [ 1B 9E A2 6] ST 255 Thu 09/26/2013 19:53:32 : [iNST-ACK ] 02 62 00.00.19 CF 11 00 06 LTONRR (00) Thu 09/26/2013 19:54:25 : [iNST-SRX ] 02 50 14.10.62 00.00.01 C7 13 01 LTOFFRR(01) Thu 09/26/2013 19:54:25 : [std-Group ] 14.10.62-->Group=1, Max Hops=3, Hops Left=1 Thu 09/26/2013 19:54:25 : [ 14 10 62 1] DOF 1 Thu 09/26/2013 19:54:25 : [ 14 10 62 1] ST 0 Thu 09/26/2013 19:54:25 : [ Time] 19:54:26 9(0) Thu 09/26/2013 19:54:25 : [iNST-SRX ] 02 50 14.10.62 00.00.01 C7 13 01 LTOFFRR(01) Thu 09/26/2013 19:54:25 : [std-Group ] 14.10.62-->Group=1, Max Hops=3, Hops Left=1 Thu 09/26/2013 19:54:25 : [iNST-DUP ] Previous message ignored. Thu 09/26/2013 19:54:30 : [iNST-SRX ] 02 50 14.10.58 00.00.01 CB 13 01 LTOFFRR(01) Thu 09/26/2013 19:54:30 : [std-Group ] 14.10.58-->Group=1, Max Hops=3, Hops Left=2 Thu 09/26/2013 19:54:30 : [ 14 10 58 1] DOF 1 Thu 09/26/2013 19:54:30 : [ 14 10 58 1] ST 0 Thu 09/26/2013 19:54:30 : [iNST-SRX ] 02 50 14.10.58 00.00.01 C7 13 01 LTOFFRR(01) Thu 09/26/2013 19:54:30 : [std-Group ] 14.10.58-->Group=1, Max Hops=3, Hops Left=1 Thu 09/26/2013 19:54:30 : [iNST-DUP ] Previous message ignored.
LeeG Posted September 27, 2013 Posted September 27, 2013 That can be a problem with Fast On/Off. It is sensitive to the speed of the double tap. With the event viewer running at LEVEL 3 so the actual command sent can be verified try a slightly slower or slightly faster double tap. The tendency can be too fast on the double tap. The second tap needs to be immediate but not necessarily rapid. It can take a little practice to get the speed right. The event viewer is the only way to know for sure what command the device is issuing. The device is coming up to 100% because that is what it should do with a second tap if a Fast On is not generated. First tap brings the device to Local On Level, second tap brings it to 100%. Visually it looks like a double tap Fast On/Off but the device is taking it as two single taps.
bsobel Posted September 28, 2013 Posted September 28, 2013 "but both AND and OR produce the same results" Sigh. Bill
drich Posted October 1, 2013 Author Posted October 1, 2013 LeeG, You got it, that was my problem. Apparently I was just double-clicking too fast. I never noticed it on the other switch where I use a similar idea (fast-off in the bedroom turns off the hall motion sensor at night so the lights don't come on and wake me up if anyone else is up). Since that one is a KeypadLinc, I just can't double-click it as fast as I can with the SwitchLinc. I modified my program so now it flashes the lights when I turn double-click, that way it is really obvious when I do it right. Thanks for the help!
drich Posted October 1, 2013 Author Posted October 1, 2013 As written with the ands I don't see how it could ever execute That's the thing that took a while for me to get my head around when programming the ISY. You aren't checking the state of the switch but the state when it changes. So most of the time the code does nothing, but when it changes state to either fast on or fast off, it executes. Writing code like this is the only way to get your program to execute the "then" branch when one thing happens and the "else" when the other happens. If you do something like If Control 'SwitchLinc DB Dimmer v40' is switched Fast On Then ... do something ... Else ... do something else ... your else block will never execute as there is nothing to make the program go false (unless you run it from another program, of course). Switching the switch fast-off will not make that if statement go false.
TJF1960 Posted October 1, 2013 Posted October 1, 2013 I modified my program so now it flashes the lights when I turn double-click, that way it is really obvious when I do it right. Thanks for the help! Another thing you can do is have the kpl or switchlinc beep after a successful fast on or off.
drich Posted October 3, 2013 Author Posted October 3, 2013 I modified my program so now it flashes the lights when I turn double-click, that way it is really obvious when I do it right. Thanks for the help! Another thing you can do is have the kpl or switchlinc beep after a successful fast on or off. I wish I could. These are old SwitchLincs, they can't beep. Thanks for the idea though!
Recommended Posts