Skip to content

Commit

Permalink
0.2.6
Browse files Browse the repository at this point in the history
Changes to Logging
Add PluginStore Download from Menu
A bit more information if any issues.
  • Loading branch information
ghawken committed Feb 3, 2018
1 parent b7d5920 commit 87c4602
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 143 deletions.
2 changes: 1 addition & 1 deletion iRobot-Roomba.indigoPlugin/Contents/Info.plist
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>0.2.4</string>
<string>0.2.6</string>
<key>ServerApiVersion</key>
<string>2.0</string>
<key>IwsApiVersion</key>
Expand Down
Expand Up @@ -13,11 +13,16 @@
<MenuItem id="updatePlugin">
<Name>Update Plugin</Name>
<CallbackMethod>updatePlugin</CallbackMethod>
</MenuItem>
<MenuItem id="pluginStore">
<Name>Go to Plugin Store</Name>
<CallbackMethod>pluginStore</CallbackMethod>
</MenuItem>
<MenuItem id="forceUpdate">
<Name>Force Update</Name>
<CallbackMethod>forceUpdate</CallbackMethod>
</MenuItem>
<MenuItem id="titleSeparator2" type="separator" />
<MenuItem id="restartPlugin">
<Name>Restart Plugin</Name>
<CallbackMethod>restartPlugin</CallbackMethod>
Expand Down
25 changes: 21 additions & 4 deletions iRobot-Roomba.indigoPlugin/Contents/Server Plugin/plugin.py
Expand Up @@ -40,17 +40,33 @@ def __init__(self, pluginId, pluginDisplayName, pluginVersion, pluginPrefs):
pfmt = logging.Formatter('%(asctime)s.%(msecs)03d\t[%(levelname)8s] %(name)20s.%(funcName)-25s%(msg)s', datefmt='%Y-%m-%d %H:%M:%S')
self.plugin_file_handler.setFormatter(pfmt)

self.logger.info(u"")
self.logger.info(u"{0:=^130}".format(" Initializing New Plugin Session "))
self.logger.info(u"{0:<30} {1}".format("Plugin name:", pluginDisplayName))
self.logger.info(u"{0:<30} {1}".format("Plugin version:", pluginVersion))
self.logger.info(u"{0:<30} {1}".format("Plugin ID:", pluginId))
self.logger.info(u"{0:<30} {1}".format("Indigo version:", indigo.server.version))
self.logger.info(u"{0:<30} {1}".format("Python version:", sys.version.replace('\n', '')))
self.logger.info(u"{0:<30} {1}".format("Python Directory:", sys.prefix.replace('\n', '')))
#self.logger.info(u"{0:<30} {1}".format("Major Problem equals: ", MajorProblem))
self.logger.info(u"{0:=^130}".format(""))

try:
self.logLevel = int(self.pluginPrefs[u"logLevel"])
except:
self.logLevel = logging.INFO
self.indigo_log_handler.setLevel(self.logLevel)
self.logger.debug(u"logLevel = " + str(self.logLevel))

self.debugTrue = self.pluginPrefs.get('debugTrue', '')

def pluginStore(self):
self.logger.info(u'Opening Plugin Store.')
iurl = 'http://www.indigodomo.com/pluginstore/132/'
self.browserOpen(iurl)


def startup(self):
indigo.server.log(u"Starting Roomba")
self.logger.info(u"Starting Roomba")

self.triggers = { }
self.masterState = None
Expand Down Expand Up @@ -105,7 +121,7 @@ def shutdown(self):
def restartPlugin(self):
indigo.server.log(u"restart Plugin Called.")
plugin = indigo.server.getPlugin('com.GlennNZ.indigoplugin.irobot')
plugin.restart();
plugin.restart()

def runConcurrentThread(self):

Expand All @@ -117,7 +133,7 @@ def runConcurrentThread(self):
self.sleep(60)

if self.KILL == True:
self.logger.debug('Self.Kill is true -- restarting plugin')
self.logger.debug('Self.Kill is true, restarting plugin')
self.KILL = False
self.restartPlugin()

Expand All @@ -129,6 +145,7 @@ def runConcurrentThread(self):
except:
self.logger.debug(u'Error checking for update - ? No Internet. Checking again in 24 hours')
self.next_update_check = self.next_update_check + 86400;

if self.statusFrequency > 0:
if time.time() > self.next_status_check:
if self.debugTrue:
Expand Down

0 comments on commit 87c4602

Please sign in to comment.