gregkinney Posted June 24, 2020 Posted June 24, 2020 Sometimes when this program runs, it misses one of the network resource commands. The network resource commands are global cache IP2IR commands to do things like turn on the TV. The program has been used every day for a year and all commands have been tested to work separately. 3 out of 4 times, this program will run without an issue. But sometimes, it will start missing a command, and then it usually keeps missing it every time it runs from there on. If I reboot the ISY, it runs and doesn't miss commands for a week or two. Does this make sense to anyone? Are there some better practices I can do to make this run smoothly? Or should I schedule the ISY to reboot nightly? bath tv on fox - [ID 0010][Parent 0040] If Control 'Bath / Bath His Vanity' is switched Fast On And $BathTV is 0 Then Resource 'pioneer.on' Enable Program 'bath tv vol up x4' Enable Program 'bath tv vol up x4 shower' Enable Program 'bath tv vol up x4 closet' Enable Program 'showeron' Enable Program 'closeton' Wait 2 seconds Resource 'Bath.TV.On' Wait 2 seconds Resource 'Bath.Dish.On' Wait 2 seconds Resource 'pioneer.inputsatcbl' Wait 2 seconds Resource 'pioneer.z2on' Wait 2 seconds Resource 'pioneer.z3on' Wait 2 seconds Resource 'pioneer.z2inputsatcbl' Wait 2 seconds Resource 'Bath.Dish.num2' Wait 2 seconds Resource 'Bath.Dish.num5' Wait 2 seconds Resource 'pioneer.z3inputsatcbl' Wait 2 seconds Resource 'Bath.TV.On' Wait 1 second Resource 'Bath.TV.On' Wait 1 second Resource 'Bath.Dish.On' $BathTV = 1 Else - No Actions - (To add one, press 'Action')
Teken Posted June 24, 2020 Posted June 24, 2020 Sometimes when this program runs, it misses one of the network resource commands. The network resource commands are global cache IP2IR commands to do things like turn on the TV. The program has been used every day for a year and all commands have been tested to work separately. 3 out of 4 times, this program will run without an issue. But sometimes, it will start missing a command, and then it usually keeps missing it every time it runs from there on. If I reboot the ISY, it runs and doesn't miss commands for a week or two. Does this make sense to anyone? Are there some better practices I can do to make this run smoothly? Or should I schedule the ISY to reboot nightly? bath tv on fox - [iD 0010][Parent 0040]If Control 'Bath / Bath His Vanity' is switched Fast On And $BathTV is 0Then Resource 'pioneer.on' Enable Program 'bath tv vol up x4' Enable Program 'bath tv vol up x4 shower' Enable Program 'bath tv vol up x4 closet' Enable Program 'showeron' Enable Program 'closeton' Wait 2 seconds Resource 'Bath.TV.On' Wait 2 seconds Resource 'Bath.Dish.On' Wait 2 seconds Resource 'pioneer.inputsatcbl' Wait 2 seconds Resource 'pioneer.z2on' Wait 2 seconds Resource 'pioneer.z3on' Wait 2 seconds Resource 'pioneer.z2inputsatcbl' Wait 2 seconds Resource 'Bath.Dish.num2' Wait 2 seconds Resource 'Bath.Dish.num5' Wait 2 seconds Resource 'pioneer.z3inputsatcbl' Wait 2 seconds Resource 'Bath.TV.On' Wait 1 second Resource 'Bath.TV.On' Wait 1 second Resource 'Bath.Dish.On' $BathTV = 1Else - No Actions - (To add one, press 'Action') If you have a lot of inbound network traffic to the controller this is one possible reason. This sort of problem will also happen when there are lots of overlapping programs completing tasks like blinking lights, beep, flash LED. Programs that have very short counting say less than 5 seconds. If you have any sort of pending writes this too can cause the same. Rebooting the controller is a band aid to a much larger problem as all you’re doing is flushing out the memory / network cache queue. Until it becomes full again and the system grinds to a halt. Sent from my iPhone using Tapatalk
gregkinney Posted June 24, 2020 Author Posted June 24, 2020 So it sounds like I need to adhere to some sort of "best practices" way of doing program execution. Can you offer a suggestion of how to achieve that? I'm thinking that I need to make a better attempt at the order of my logic...maybe have the other programs that are enabled come after the network resources fire?
Teken Posted June 24, 2020 Posted June 24, 2020 19 minutes ago, gregkinney said: So it sounds like I need to adhere to some sort of "best practices" way of doing program execution. Can you offer a suggestion of how to achieve that? I'm thinking that I need to make a better attempt at the order of my logic...maybe have the other programs that are enabled come after the network resources fire? I can only suggest things I've done from past experience having seen the same: - Tight Loop: You may see this phrase bounced around in this forum once in awhile. Generally speaking it means not having programs or network calls whether they be inbound / outbound that happen in rapid succession or in short intervals. You can have a tight loop simply by telling the controller to execute a program 1~5 second. The same can be had where you send in bound REST calls to the controller. - Schedule: Always try to spread out program execution in longer intervals - Wait: Incorporating a wait statement is good practice to allow the controller to catch its breath. - Repeat: Use repeats when and where appropriate but use caution to not abuse this statement as it can lead to *Tight Loops*. - Disable: You can have a program disable another program to insure the system is idle when it should. - Folder Color: Once you activate the folder status indicator if you see what some of use term *Flutter*. Where you see the folder alternate from solid / half solid this is a really good indicator that programs resource is causing unexpected traffic / processing. - Pending Writes: Always insure all hardware is fully operational and no pending writes are in queue. If you're on 5.XX firmware there is a known bug were the Motion Sensor II will constantly try to write to this battery operated device if it has some kind of scene adjust involved. The band aid is to disable the battery write if you have the Pro controller.
gregkinney Posted June 25, 2020 Author Posted June 25, 2020 Wow, what a wealth of information. I'm going to go in and redesign using these specs. Thank you so much for taking the time to write this up!
Teken Posted June 25, 2020 Posted June 25, 2020 13 minutes ago, gregkinney said: Wow, what a wealth of information. I'm going to go in and redesign using these specs. Thank you so much for taking the time to write this up! No worries . . . Also keep in mind you can place a schedule time for an entire folder to become active (true / false). Placing a condition on a parent folder allows you to manage program(s) in a global manner while also offering you an opportunity to kill a *Tight Loop* race condition. You'll really be happy to have conditioned folders when the controller is really locked up!
TrojanHorse Posted June 25, 2020 Posted June 25, 2020 Great suggestions here. Curious, what are the other programs that you enable here? Can you post them?Sent from my iPhone using Tapatalk
gregkinney Posted June 25, 2020 Author Posted June 25, 2020 Sure, here's what it's designed to do: I have a small TV in the bathroom and a speaker the main area, shower, and my closet. The main program is so that if I double tap the light by my sink on, it turns on the tv. The programs called "vol up x4" that become enabled turn the light switches in the main bath, shower, and closet into volume controls. The programs "showeron" and "closeton" tell it to turn the speaker on if the respective light is turned on. bath tv vol up x4 - [ID 006B][Parent 0040][Not Enabled] If Control 'Bath / Bath His Vanity' is switched Fade Up And Control 'Bath / Bath His Vanity' is not switched Fade Down Then Resource 'pioneer.volup' Wait 2 seconds Resource 'pioneer.volup' Wait 2 seconds Resource 'pioneer.volup' Wait 2 seconds Resource 'pioneer.volup' Else Resource 'pioneer.voldown' Wait 2 seconds Resource 'pioneer.voldown' Wait 2 seconds Resource 'pioneer.voldown' Wait 2 seconds Resource 'pioneer.voldown' bath tv vol up x4 closet - [ID 0044][Parent 0040][Not Enabled] If Control 'Bath / Greg Closet' is switched Fade Up And Control 'Bath / Greg Closet' is not switched Fade Down Then Resource 'pioneer.z3volup' Wait 2 seconds Resource 'pioneer.z3volup' Wait 2 seconds Resource 'pioneer.z3volup' Wait 2 seconds Resource 'pioneer.z3volup' Else Resource 'pioneer.z3voldown' Wait 2 seconds Resource 'pioneer.z3voldown' Wait 2 seconds Resource 'pioneer.z3voldown' Wait 2 seconds Resource 'pioneer.z3voldown' bath tv vol up x4 shower - [ID 0043][Parent 0040][Not Enabled] If Control 'Bath / Shower' is switched Fade Up And Control 'Bath / Shower' is not switched Fade Down Then Resource 'pioneer.z2volup' Wait 2 seconds Resource 'pioneer.z2volup' Wait 2 seconds Resource 'pioneer.z2volup' Wait 2 seconds Resource 'pioneer.z2volup' Else Resource 'pioneer.z2voldown' Wait 2 seconds Resource 'pioneer.z2voldown' Wait 2 seconds Resource 'pioneer.z2voldown' Wait 2 seconds Resource 'pioneer.z2voldown' closeton - [ID 0041][Parent 0040] If $BathTV is 1 And Control 'Bath / Greg Closet' is switched On Then Resource 'pioneer.z3vol30' Else - No Actions - (To add one, press 'Action') showeron - [ID 003E][Parent 0040] If $BathTV is 1 And Control 'Bath / Shower' is switched On Then Resource 'pioneer.z2vol30' Else - No Actions - (To add one, press 'Action')
Teken Posted June 25, 2020 Posted June 25, 2020 Any specific reason not to mount and install one of these eight button dedicated remotes?!? https://www.smarthome.com/collections/insteon-keypads/products/insteon-2342-222-mini-remote-8-scene If you wanted a hard line than a 8 button KPL with custom keys would be ideal held in one of the stands.
TrojanHorse Posted June 25, 2020 Posted June 25, 2020 I forget - anyone know? When a program is enabled will it automatically run If? If so, you will be running Else most likely and firing in network resource commands. Edit: Regardless, maybe try putting the enable program commands at the end if that works for your goals and as you mentioned you considered. Sent from my iPhone using Tapatalk
gregkinney Posted June 25, 2020 Author Posted June 25, 2020 I find myself hunting and pecking with the KPL that I do have. Since it's usually 5am when I use this program, I wanted it to be as mindless as possible. Walk in the closet, turn light on, sound comes on.
gregkinney Posted June 25, 2020 Author Posted June 25, 2020 @TrojanHorse interesting...I can test it to see if these network commands do fire simply by being enabled. That would be a clean resolution. I'll report back.
TrojanHorse Posted June 25, 2020 Posted June 25, 2020 Also notice that “His Bath” is a trigger in your original program and in one that you enable, correct?Please report back as you said on the enable and also try putting these enable statements at the end and report back. Sent from my iPhone using Tapatalk
larryllix Posted June 25, 2020 Posted June 25, 2020 30 minutes ago, TrojanHorse said: I forget - anyone know? When a program is enabled will it automatically run If? If so, you will be running Else most likely and firing in network resource commands. Edit: Regardless, maybe try putting the enable program commands at the end if that works for your goals and as you mentioned you considered. No. When you disable a program it will stop it (IIRC only at Wait or repeats) but enabling a program doesn't cause any running. I use many second programs that disable and enable the first (one and only one logic) and it would cause problems refiring them if they ran again upon enable. I think most would oscillate then. 1
gregkinney Posted June 25, 2020 Author Posted June 25, 2020 Thank you @larryllix, I confirmed this behavior. Also @TrojanHorse His Vanity Fast On is a trigger for a program, then His Vanity Fade Up is the trigger for another program. Also, I thought the Pioneer receiver network resources were global cache but it's actually eISCP (Integra Serial Communication Protocol) which is very slow. After realizing that, I think there's a good chance it is the cause of the issue. I'm going to convert these to global cache commands and I will report back after trying it for a couple weeks. But I am going to go through and use @Teken's list of best practices on my probably 100+ programs. Man, I wish I could put ISY as software on a beef-eating PC. @Teken the one that interests me most is the tight loop and I have a couple questions. Can you explain these two statements a little further? 17 hours ago, Teken said: You can have a tight loop simply by telling the controller to execute a program 1~5 second. 17 hours ago, Teken said: The same can be had where you send in bound REST calls to the controller. I use The Home Remote software for a whole home controller on tablets and phones. I likely have hundreds of REST calls for status and control to the ISY from Home Remote, and it's also set up for polling, so unbeknownst to me, it could be making dozens of calls every second. 1
Teken Posted June 25, 2020 Posted June 25, 2020 @gregkinney Tight Loop: Generally speaking anything that makes the controller receive or do something in a short period of time will cause a tight loop. Say create a program to count something every second that would be a tight loop. Now, if all you had is a single program doing that the system would be OK. When you have more than one you run into serious issues. What most people see are programs, scenes, network resources, are slow to react or at all. Another is when you log into the AC (Admin Console) and you will notice the system is slow to load or even at all. You can create another situation which is similar to a tight loop but not and this is by sending / receiving REST. If you ever review the error logs you may see lots of Queue Full messages. Remember the ISY Series Controller is essentially a small clock which has to share time (resources) to accomplish all the different things we ask of it. It also operates on the FIFO (First In First Out) principle. So what ever tasks it has been assigned to do is performed in order . . . Anything it can't do it places it in a virtual queue (back of the bus) until it can complete the same later. As noted early on the controller (generally speaking) doesn't really have a problem sending / doing outbound tasks. What really impacts the controller are / is anything that comes inbound to the controller which ties up lots of I/O and resources of the system. One key thing about any inbound REST call is you must insure you stagger the requests by several seconds otherwise you will have conditions where the controller appears bricked and sometimes self reboots. Short Version: Allow enough time between program activation, REST calls, and schedule folders to be disabled so there are more quiet times in the 24 hour period than active. Also, if you have any programs that make the Insteon network beep, blink, flash, use them sparingly. ie. You're asleep so anything that has to do with Home Remote should be disabled. Schedule the same folder to activate during your waking hours.
gregkinney Posted June 25, 2020 Author Posted June 25, 2020 @Teken Again, a million thanks. I have a lot of work ahead of me (albeit fun work, IMO). I'm going to start from the ground up and rework the entire design using your suggestions as a foundation. I'm going to offload as much as I can to my RPi and leave the rest to let the ISY do what it does best, cleanly and efficiently.
Recommended Posts