BCreekDave Posted October 22, 2015 Posted October 22, 2015 Hi Xathros, Due to the quantity and length of these programs, can you suggest the best method of posting? I somethines use the "Copy to Clipboard" or just the "Export" function. Thanks dave
Xathros Posted October 22, 2015 Posted October 22, 2015 Copy to clipboard is the way to go. Paste them into code blocks using "<>" on the toolbar.
BCreekDave Posted October 22, 2015 Posted October 22, 2015 (edited) Xathros Code as follows: One other note. I have the keypadlinc button setup as a controller and responder for a scene "GaragedoorMain" The iolinc is set as "Momentary B" with "LED on TX" checked. No other options checked. I have a momentary hold time of 0.2 seconds which seems to work OK. =================================================================================== Main Garage Door - [ID 0046][Parent 0024] Folder Conditions for 'Main Garage Door' If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Allow the programs in this folder to run. ----------------------------------------------------------------------------------- 000 ButtonOff - [ID 002E][Parent 0046] If $i.GDM_Dontwatch is 0 And Status 'A Mud Room Entry Keypad / B OpenClose Garage Door (GDM)' is Off Then $i.GDM_Requestedstatus = 0 $s.GDM = 1 Else - No Actions - (To add one, press 'Action') Function: When the button state is changed, remember if it was changed to on or off and start up the state machine. Details: All the '000' programs monitor the status of the KPL that is tied to the GDM Scene. We only have to monitor one of them, since when the scene is changed by any of KPL or Mobilinc it will affect all of them. The main state variable for all GDM programs is s.GDM, which tells us where in this state machine we are. We do not monitor that state variable in the 000 programs because other programs within this state machine will toggle the scene on and off, which in turn changes the button state, so while the state machine is running we ignore running the 000 programs using the i.GDM_DontWatch integer variable. The i.GDM_RequestedStatus stores if the request was to close (0) or open (1). from :http://forum.universal-devices.com/topic/11099-garage-door-control-with-kpl-and-mobilinc/page-3#entry152166 ----------------------------------------------------------------------------------- 000 ButtonOn - [ID 002D][Parent 0046] If $i.GDM_Dontwatch is 0 And Status 'A Mud Room Entry Keypad / B OpenClose Garage Door (GDM)' is not Off Then $i.GDM_Requestedstatus = 1 $s.GDM = 1 Else - No Actions - (To add one, press 'Action') See '000 ButtonOff' for a description. ----------------------------------------------------------------------------------- 001 DoorStateFalse - [ID 002F][Parent 0046] If $s.GDM is 1 And ( ( $i.GDM_Requestedstatus is 0 And Status 'Garage Main Door IOLINC-Senso' is On ) Or ( $i.GDM_Requestedstatus is 1 And Status 'Garage Main Door IOLINC-Senso' is Off ) ) Then $s.GDM += 1 Else - No Actions - (To add one, press 'Action') Function: We have just entered the state machine from a KPL button changing state. If the requested door status does not match the door sensor status then go to the next state. Info: It seems that we could tie the check of the sensor status into the 000 Button* states, but that does not work correctly because it would trigger the 000 state when the sensor status changes but the button status has not changed yet. This is because I have the sensor as a controller for the GD scene because I want to see the sensor as part of the scene in Mobilinc. ----------------------------------------------------------------------------------- 001 DoorStateTrue - [ID 0030][Parent 0046] If $s.GDM is 1 And ( ( $i.GDM_Requestedstatus is 0 And Status 'Garage Main Door IOLINC-Senso' is Off ) Or ( $i.GDM_Requestedstatus is 1 And Status 'Garage Main Door IOLINC-Senso' is On ) ) Then $s.GDM = 10 Else - No Actions - (To add one, press 'Action') Function: We have just entered the state machine from a KPL button changing state. If the requested door status matches the door sensor status then we are done. Info: See DoorStateFalse for info. ----------------------------------------------------------------------------------- 002 Init - [ID 0031][Parent 0046] If $s.GDM is 2 Then $i.GDM_Dontwatch = 1 $s.GDM_Counter = 10 $s.GDM += 1 Else - No Actions - (To add one, press 'Action') Function: The door was requested to move, so initialize variables used in the state machine and go to the next state. i.GDM_DontWatch: 1=Don't watch the state changes of the KPL's s.GDM_Counter: Loop counter for '002 Loop' program s.GDM: Main state variable, go to state 2 ----------------------------------------------------------------------------------- 002 Trigger - [ID 0032][Parent 0046] If $s.GDM is 2 Then Set 'Garage Main Door IOLINC-Relay' On Else - No Actions - (To add one, press 'Action') Function: The door was requested to move, so trigger it. Note: This could have been done in the Init program, but that delays the flashing of the scene for longer than I like... The IOLinc relay is in Momentary B mode so it is triggered by both on and off. I think this is important since I don't turn it off, although I could, but I don't care what state the relay is in. ----------------------------------------------------------------------------------- 003 DoorStatusClosed - [ID 0033][Parent 0046] If $s.GDM is 3 And $i.GDM_Requestedstatus is 0 And Status 'Garage Main Door IOLINC-Senso' is On Then Set Scene 'GarageDoorMain' Off $s.GDM = 10 Else - No Actions - (To add one, press 'Action') Function: While in the state and the door was requested to close, when the door is closed we are done. Make sure the scene is off and go to the cleanup state. Note: Logic "And Status" inverted due to my switch location ----------------------------------------------------------------------------------- 003 DoorStatusOpen - [ID 0034][Parent 0046] If $s.GDM is 3 And $i.GDM_Requestedstatus is 1 And Status 'Garage Main Door IOLINC-Senso' is Off Then Set Scene 'GarageDoorMain' On $s.GDM = 10 Enable Program 'Garage Lights SubRoutine' Else - No Actions - (To add one, press 'Action') See DoorStatusClosed for a description. ----------------------------------------------------------------------------------- 003 Loop - [ID 0035][Parent 0046] If $s.GDM is 3 And $s.GDM_Counter > 0 Then Set Scene 'GarageDoorMain' Off Wait 1 second Set Scene 'GarageDoorMain' On Wait 1 second $s.GDM_Counter -= 1 Else - No Actions - (To add one, press 'Action') Function: Toggle the scene on and off so the KPL buttons and Mobilinc icon change state. This gives visual feedback that we are waiting for the door. Decrement the counter s.GDM_Counter each time, which tracks our timeout function, and causes this program to restart until the counter reaches zero. We could have made the counter be the s.GDM... Oh well... (I wish the 'Wait' could use a variable!) ----------------------------------------------------------------------------------- 003 Timeout - [ID 0036][Parent 0046] If $s.GDM_Counter is 0 And $s.GDM is 3 Then $s.GDM += 1 Else - No Actions - (To add one, press 'Action') Function: If the s.GDM_Counter has reached zero while we are in the waiting state, then the door did not reach the state that was requested! So go into state 3 which handles the failures. (I had a reason for not handling them in this state, but can't remember why...) ----------------------------------------------------------------------------------- 004 FailedClose - [ID 0037][Parent 0046] If $s.GDM is 4 And $i.GDM_Requestedstatus is 0 Then Set Scene 'GarageDoorMain' On Send Notification to 'Daves MMS Text' content 'Garage Door Failed to Close' $s.GDM = 10 Else - No Actions - (To add one, press 'Action') Function: There was a request to close the door, but we timed out waiting. Make sure the scene is on since this state machine toggles the scene we are not sure where it ended up. Send a notification to tell us that there was a problem! Go to state 10 which does the cleanup. Note: I wonder if there could be a race condition... If the door sensor status happens to change after TimeOut and before this is triggered? But I really don't think that will happen... ----------------------------------------------------------------------------------- 004 FailedOpen - [ID 0038][Parent 0046] If $s.GDM is 4 And $i.GDM_Requestedstatus is 1 Then Set Scene 'GarageDoorMain' On Send Notification to 'Daves MMS Text' content 'Garage Door Failed to Open' $s.GDM = 10 Else - No Actions - (To add one, press 'Action') See FailedClose for a description. ----------------------------------------------------------------------------------- 005 GaragedoorPowerOutage - [ID 003A][Parent 0046] If $i.GDM_Dontwatch is -1 And ( Status 'A Mud Room Entry Keypad / B OpenClose Garage Door (GDM)' is Off Or Status 'A Mud Room Entry Keypad / B OpenClose Garage Door (GDM)' is 100% ) Then $s.GDM = 10 Else - No Actions - (To add one, press 'Action') ----------------------------------------------------------------------------------- 010 GarageDoorDone - [ID 0039][Parent 0046] If $s.GDM is 10 Then $i.GDM_Dontwatch = 0 $s.GDM = 0 $i.GDM_Dontwatch Init To -1 Else - No Actions - (To add one, press 'Action') State machine is all done so start watching again. Edited October 22, 2015 by BCreekDave
Xathros Posted October 22, 2015 Posted October 22, 2015 (edited) Yikes! This is gonna take me some time to digest and work out whats happening. Seems overly complex to me. All that should be needed is: KPL Button as a controller of a scene with IOLinc relay as responder. Relay in momentary B mode with 2 second delay. KPL Button in NonToggle-On mode. A scene "GarageStatusLED" with the KPL Button as responder. And a program like: If Status 'IOLinc_Sensor' is On Then Set Scene 'GarageStatusLED' Off Else Set Scene 'GarageStatusLED' On And, if you moved the switch to the other end of the door travel, you wouldn't even need the program! You could just make the IOLinc Sensor a controller of the GarageStatusLED scene. -Xathros Edited October 22, 2015 by Xathros
BCreekDave Posted October 22, 2015 Posted October 22, 2015 Yes, it is a long program. I think there is a lot of error checking with state and integer variables to verify that the door achieved the desired result and if it didn't, to be able to notify the user. There are sub-programs for power outage etc. I tend to like this for something like and entry door where security and safety is an issue. This along with a well placed camera.
oberkc Posted October 23, 2015 Posted October 23, 2015 So, is 'GarageDoorMain' the scene that includes the balky keypad button? I agree with xathros that this sure seems overly complex for the stated requirement. Since the particular scene is driven based on multiple criteria, it seems to me that it is nearly futile to try to solve this by a continuous bac,-and-forth series of questions. I can only suggest that it is a bit of forensic analysis should yield the answers you seek. If the KPL button is in a state that you believe to be incorrect, review the program that you expected to maintain the correct state and check the variables that make up the various conditions. Find the one that is causing the program to run false and trace the cause of that variable being other than what you expect. If all looks well on this front, consider the possibility that the ISY program is running as designed, but the commands are not getting to the keypad. Have you manually triggered any of these program (THEN path) to confirm that the commands are getting through? Are the "i" and "s" an indication of integer or state variable? I notice that when some program execute (THEN path), they change variable value for $s.gdm. Changing this value would subsequently trigger other programs. I also notice a particular value (3) of this variable has the potential to simultaneously trigger multiple programs and some of those programs have WAIT statements. Is it possible that these wait statements are being interrupted by the changing variable value and not running to completion? Could this be a problem?
BCreekDave Posted October 23, 2015 Posted October 23, 2015 I agree that trying to trace through the code is tedious and perhaps not the best plan of attack. Unless the author (Jimbo) or someone else has slayed this exact dragon in the past. It may very well be a timing issue. I am going to work on my setup to match the switch function to switch closed when the door is closed. This is the way that the program was originally intended, and may be more intrinsically safe. The "i" and "s" are in fact indicators of integer and state variable. I have confirmed that the commands are getting through. I can see the state and integer variables change, but it is hard to tell if they are changing at the right time. I am also going to disable the lights. While I can unhook the door, my neighbors must think I am nuts with the lights going on and off all the time while I debug. I will work on it on Saturday. Too many other projects going on before the weather turns. Thanks everyone for the suggestions. I am using this as always as a learning experience. By the way oberkc, hello from Beavercreek. I live close to 675. If you are driving by, look for the garage lights flashing!
oberkc Posted October 23, 2015 Posted October 23, 2015 I will be watching for the light show as I travel to he Greene Town Center tonight.
BCreekDave Posted November 5, 2015 Posted November 5, 2015 I want to post a follow up on this. Thinking the issue was my particular implementation with the door sense switch monitoring the door open rather than the typical door close position, I moved the switch to sense the door close, which also I think is intrinsically safer, given the limitation of the single input on the iolinc. This did not result in the desired solution. While the system worked triggering from Mobilinc or from the keypadlinc or directly from the PC via the isy admin console, triggering the door from the manual push button or the in-car button was not reflected in a status change on the keypadlinc button. Further investigation showed that when I replaced the caps in the 2413s, the link tables became corrupted and several devices had to be rebuilt. One of these was the keypadlinc. Looking at the button function for the garage door showed it to be missing as a responder for the scene for the garage door, in my install this scene is Garagedoormain. Once I rebuilt this link, than everything is back to working OK. Thanks for the help from oberkc and Xathros.
Xathros Posted November 5, 2015 Posted November 5, 2015 Excellent! I'm sure you will be happier with the switch as you have it now. Glad you got everything working. Thanks for posting back. -Xathros
paulbates Posted November 5, 2015 Posted November 5, 2015 I have my overhead garage lights added as a participant in the scene that is triggered by the door sensor is activated when the door goes up. No coding was needed. If the door is up, the lights are on, and vice versa. The GDO's lights stay on for a few minutes.
Recommended Posts