Page 2 of 2

Re: New(?) error on startup...

PostPosted: Wed Apr 28, 2021 10:49 am
by jay (support)
kw123 wrote:
Code: Select all
    def startup(self):
        self.sleep(60.)


Gut reaction: this probably isn't a good idea. The Indigo Server expects responses from plugins quickly and has a variety of things that it calls back in to a plugin for. If a plugin is sleeping in the middle of its startup sequence, then anything the server may try to contact the plugin about would likely timeout (deviceUpdated calls when a plugin subscribes comes to mind though that might be solved by clever ordering).

I haven't actually tested, so I can't be sure, but on the surface it seems like a bad idea.

Re: New(?) error on startup...

PostPosted: Wed Apr 28, 2021 10:50 am
by kw123
I tried 200000 secs and no complains for > 5 minutes


Sent from my iPhone using Tapatalk

Re: New(?) error on startup...

PostPosted: Wed Apr 28, 2021 10:56 am
by dclonts
So that worked for me using a delayed startup action.

But still problem with KPL Lets. I have a plugin for my pool, and it manifests as a bunch of switches. When indigo starts up, I do a KPL Update LEDS in Cynical Behaviors plugin. Have a bunch of Keypad Button Device controls linked to the actual Hayward Pool switch/dimmer devices.

I would think that the Update LEDS would look at the device state of the Hayward Pool switch devices and update the KPL leds, but does not seem to happen. Need to do at startup because the device states may not match the led states.

Re: New(?) error on startup...

PostPosted: Wed Apr 28, 2021 10:56 am
by norcoscia
Thanks so much Karl - really nice of you to help me out and spend so much time creating and sharing all of your plug-ins!!!!!!!

Jay -- thanks for the warning - I know this is not a problem that will cause anything to not work but I like to watch the log when I reboot Indigo - super hard for my old eyes to follow with a ton of red warning interspersed with startup messages.

This (and only this) plugin has been doing this to me since back to version 6 days - just wanted the pain in my neck to end so going to try it unless you have a recommendation for something less risky

PS. later today I will run with scissors :-)

New(?) error on startup...

PostPosted: Wed Apr 28, 2021 11:05 am
by kw123
here the code in can behavior plugin:

change from:
Code: Select all
.....
#
# The plugin.
#
from cyin.plug import entry, CONCURRENT

class Plugin(cyin.asynplugin.Plugin):

   loosedevices = cyin.PluginPreference(type=bool, default=False)


   #
   # Listen for incoming INSTEON commands and send them to our devices.
   #
   def startup(self):
      indigo.insteon.subscribeToIncoming()
   
   @entry(CONCURRENT)
   def insteonCommandReceived(self, cmd):
      if cmd.cmdSuccess:
         for watcher in LeakWatch.all():
            watcher._event(cmd)
         for kpl in ButtonBehavior.all():
            kpl._kpl_event(cmd)
....

to
Code: Select all
.....
#
# The plugin.
#
from cyin.plug import entry, CONCURRENT

class Plugin(cyin.asynplugin.Plugin):

   loosedevices = cyin.PluginPreference(type=bool, default=False)


   #
   # Listen for incoming INSTEON commands and send them to our devices.
   #
   def startup(self):
      self.sleep(30)
      indigo.insteon.subscribeToIncoming()
   
   @entry(CONCURRENT)
   def insteonCommandReceived(self, cmd):
      if cmd.cmdSuccess:
         for watcher in LeakWatch.all():
            watcher._event(cmd)
         for kpl in ButtonBehavior.all():
            kpl._kpl_event(cmd)
....

I put 30 secs there, that should be plenty for the rest to startup

Karl

Re: New(?) error on startup...

PostPosted: Wed Apr 28, 2021 11:17 am
by norcoscia
Tried the new one (with 30 seconds) - seem to work great - thanks again Karl!!!!!!!!!!

Re: New(?) error on startup...

PostPosted: Wed Apr 28, 2021 11:20 am
by jay (support)
kw123 wrote:
I tried 200000 secs and no complains for > 5 minutes


Doesn't mean that every case is covered... :wink:

Re: New(?) error on startup...

PostPosted: Wed Apr 28, 2021 7:37 pm
by kw123
Yes.
But it is a simple test that takes 2 minutes to see if it works.


Sent from my iPhone using Tapatalk

Re: New(?) error on startup...

PostPosted: Thu Apr 29, 2021 9:55 am
by jay (support)
A 2 minute test is NOT A THOROUGH TEST for a commercial product.