gregkinney Posted October 3 Posted October 3 I have this program: shades down if temp over 95 - [ID 026A][Parent 006C] If 'WeatherLink / WeatherLink' Temperature > 97.0°F And From 2:45:00PM To 2:50:00PM (same day) Then Set 'Zwave / Shades - Kitchen' 28% Wait 20 seconds Set 'Zwave / Shades - Kitchen Door' Off Wait 20 seconds Set 'Zwave / Shades - Butlers' Off Wait 20 seconds Set 'Xscenes / Shades - Dining' Fast Off Wait 20 seconds Set 'Zwave / Shades - Tasha Ofc S' Off Wait 20 seconds Set 'Xscenes / Shades - Theater' Fast Off Wait 20 seconds Set 'Zwave / Shades - Mud Room' Off Wait 20 seconds Run Program 'shades study winter down' (Then Path) Wait 3 seconds Disable Program 'shades down if temp over 95' Else - No Actions - (To add one, press 'Action') #enabled The 20 second gaps are because sometimes the zwave signal seems to trip over itself - I had more success by spacing the commands out. This program runs great on its own. However, I use HTTP shortcuts on my phone to do often used tasks. So if I want to close these shades, I use my http shortcut which uses a "runThen" action from the REST API. However, it will run for maybe 30 seconds to 1 min, and then stop. It will never complete. I assumed there was a timeout or something while it was waiting to receive a completed response from the API, so I created this program, thinking it would respond immediately with a completed response: shades sun - [ID 030B][Parent 006C] If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Run Program 'shades down if temp over 95' (Then Path) Else - No Actions - (To add one, press 'Action') but it's the same end result - it runs for 30-60 seconds and stops. Does anyone have any suggestions how I can achieve my goal? Quote
gregkinney Posted October 3 Author Posted October 3 (edited) Just remembered I use this program by HTTP command often, and it works fine: temp hallway down 1hr - [ID 00BE][Parent 0004] If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Set 'Ecobee / Ecobee - Hallway' Setpoint Down Set 'Ecobee / Ecobee - Hallway' Schedule Mode Hold Wait 1 hour and 2 seconds Set 'Ecobee / Ecobee - Hallway' Schedule Mode Running Wait 4 seconds Set 'Ecobee / Ecobee - Hallway' Schedule Mode Running Else - No Actions - (To add one, press 'Action') #enabled Edited October 3 by gregkinney Quote
DennisC Posted October 4 Posted October 4 Not an answer to your question, just an alternate solution: Try using UD Mobile instead. Much more reliable and easy to set up. Quote
gregkinney Posted October 4 Author Posted October 4 (edited) @DennisC Yes I might have to change if I can't find a reliable way to accomplish this. But this way is pretty cool. I don't even have to open an app. The shortcuts reside next to the home screen on my phone Edited October 4 by gregkinney Quote
Solution IndyMike Posted October 4 Solution Posted October 4 17 hours ago, gregkinney said: I have this program: shades down if temp over 95 - [ID 026A][Parent 006C] If 'WeatherLink / WeatherLink' Temperature > 97.0°F And From 2:45:00PM To 2:50:00PM (same day) Then Set 'Zwave / Shades - Kitchen' 28% Wait 20 seconds Set 'Zwave / Shades - Kitchen Door' Off Wait 20 seconds Set 'Zwave / Shades - Butlers' Off Wait 20 seconds Set 'Xscenes / Shades - Dining' Fast Off Wait 20 seconds Set 'Zwave / Shades - Tasha Ofc S' Off Wait 20 seconds Set 'Xscenes / Shades - Theater' Fast Off Wait 20 seconds Set 'Zwave / Shades - Mud Room' Off Wait 20 seconds Run Program 'shades study winter down' (Then Path) Wait 3 seconds Disable Program 'shades down if temp over 95' Else - No Actions - (To add one, press 'Action') #enabled I'm thinking that the IF clause is re-evaluating to false after you have run the "Then section" of the program. Your 20 second waits will allow the program to exit. Try separating into two programs (1 program for IF and 1 for Then). 3 Quote
larryllix Posted October 4 Posted October 4 As per @IndyMike above, your If section is getting re-evaluated and running Else, which will stop the Then section from completing. Remove the time frame and make it a single time so it only can evaluate once per day, and not re-evaluate. There is no hysteresis in your temperature evaluation and the logic can bobble True/False quicky inside your five minute window. If 'WeatherLink / WeatherLink' Temperature > 97.0°F And At 2:45:00PM Quote
Ross Posted October 4 Posted October 4 @gregkinney I don't have an answer for you but I always have more questions... So when you press the button on your home screen, does it open a browser and then you have to clear it or does it just execute the command and the home screen doesn't change? I like the idea of a quick one-button execution with nothing else to do. iPhone or Android? Thanks, Ross Quote
gregkinney Posted October 4 Author Posted October 4 @larryllix Thank you for the suggestion but that didn't work. I did use your idea though to simplify the program and I just picked 2:45pm so now I don't have to disable the program after it runs. @IndyMike thank you, your suggestion worked! I can never wrap my head around the fact that the 'if' keeps evaluating while the 'then' is running. Makes no sense to me. @Ross Android. It's a great app called "http shortcuts". It's free, not sure if it's on iPhone. One quick button, nothing else to do. You can pick the icon. I then also group some of them into folders. 1 Quote
Ross Posted October 28 Posted October 28 @gregkinney I really like the app and finding more and more uses for it - thank you! Since this is person or phone specific, I created a solution for when you might want to provide (trusted) others access to your ISY. Good for family or guests without having to help them with their phone/laptop/desktop. I created a webpage which can be shared so that others can run programs or change State Variables. It's easily customizable - I don't have to do the same thing to my wife's phone as I do with mine - I'll just put an icon on her home screen which links to the changeable webpage. It's 2 clicks instead of one, but saves time in the long run. Thanks again, Ross Quote
dbwarner5 Posted October 29 Posted October 29 @gregkinney this page is an excellent reference page to better understand how programs "execute" in ISY. https://wiki.universal-devices.com/ISY-99i/ISY-26_INSTEON:Scope,_Precedence_and_Execution_Order#Statement_Execution_Order --> Statement Execution Order Within the Then or Else clause of a program, statements are executed from top to bottom in the order in which they occur. When a statement calls another program, the called program begins executing, and the calling program immediately continues execution with the next statement in sequence--it does not wait for the called program to complete before continuing. A series of statements within a Then clause (or within an Else clause), up to the next Wait or Repeat statement, are atomic. In other words, all such statements are executed before the conditions of the program are retested. The program's conditions are reevaluated each time a Wait or Repeat statement is encountered, and at the end of each iteration of a Repeat loop. What this means is that if a program's Then clause changes a condition which causes the program's overall condition to become false (or if the program's Else clause changes a condition which causes the program's overall condition to become true), the current atomic statement group will complete, and at that point execution will transfer from the Then clause (or the Else clause) to the Else clause (or the Then clause). Therefore, if a Then clause (or an Else clause) contains no Wait or Repeat statements, the entire clause is atomic, and will complete before the program's conditions are reevaluated. Quote
gregkinney Posted October 29 Author Posted October 29 @Ross thanks, I will check that out sometime. It looks really interesting. @dbwarner5 thank you! That's great information. And it makes me angry. Goes against the logic of any other programming language I have experience with. Because it seems so backwards to me, I can never remember to use this logic and I screw it up the first time. 1 Quote
larryllix Posted October 30 Posted October 30 5 hours ago, gregkinney said: @Ross thanks, I will check that out sometime. It looks really interesting. @dbwarner5 thank you! That's great information. And it makes me angry. Goes against the logic of any other programming language I have experience with. Because it seems so backwards to me, I can never remember to use this logic and I screw it up the first time. Event triggered software systems can really screw up linear programmers. They definitely present some quirks. Think domino chains with lots of split out paths. 2 Quote
dbwarner5 Posted October 30 Posted October 30 20 hours ago, gregkinney said: @Ross thanks, I will check that out sometime. It looks really interesting. @dbwarner5 thank you! That's great information. And it makes me angry. Goes against the logic of any other programming language I have experience with. Because it seems so backwards to me, I can never remember to use this logic and I screw it up the first time. @gregkinney I understand the frustration. My son, who has a computer science degree from Univ of Michigan, just refuses to get his head around it. lol. It does call for often "isolating" certain activity you may want in a separate program w/o an IF which gets called to run the THEN, so that if you have waits, there is no IF to reevaluate and therefore no chance the program will stop before completion. Often a tripping spot for everyone. Quote
gregkinney Posted October 30 Author Posted October 30 Yes, that is what I have done to "fix" the issues. A significant amount of my programs involve network resources and those must be spaced out about 2 seconds each in order for them to all fire correctly, so I have a slew of waits. This all makes sense now 😄 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.