Skip to content

Commit

Permalink
0.9.0
Browse files Browse the repository at this point in the history
Fix for offline devce Label
  • Loading branch information
ghawken committed Oct 2, 2018
1 parent 508f797 commit 8ee375c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion iFindFriendsMini.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>0.8.8</string>
<string>0.9.0</string>
<key>ServerApiVersion</key>
<string>2.0</string>
<key>CFBundleDisplayName</key>
Expand Down
18 changes: 15 additions & 3 deletions iFindFriendsMini.indigoPlugin/Contents/Server Plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def __init__(self, pluginId, pluginDisplayName, pluginVersion, pluginPrefs):
self.configZoomMap = self.pluginPrefs.get('ZoomMap', "15")
self.datetimeFormat = self.pluginPrefs.get('datetimeFormat','%c')
self.googleAPI = self.pluginPrefs.get('googleAPI','')

self.travelTime = self.pluginPrefs.get('travelTime','16.7')
self.deviceNeedsUpdated = ''
self.openStore = self.pluginPrefs.get('openStore',False)
Expand Down Expand Up @@ -589,8 +590,10 @@ def validatePrefsConfigUi(self, valuesDict):

self.logger.debug(u"validatePrefsConfigUi() method called.")


accountOK = False
errorDict = indigo.Dict()

if 'appleId' in valuesDict:
iFail = False
if len(valuesDict['appleId']) == 0:
Expand Down Expand Up @@ -642,12 +645,20 @@ def validatePrefsConfigUi(self, valuesDict):
# dev = indigo.devices[devId]
accountOK = True
valuesDict['appleAPIid'] = valuesDict['appleId']
return True, valuesDict
#return True, valuesDict

if iFail:
self.logger.info("Login to Apple Server Failed")
return (False, valuesDict, errorDict)

self.logger.debug(u'Checking Travel Time...')
if valuesDict.get('travelTime',"") == "" or valuesDict.get('travelTime') == 0 or 'travelTime' not in valuesDict:
errorDict['travelTime']= 'Need to set this to appropriate number'
errorDict['showAlertText'] = 'Travel Time not correctly set'
return (False, valuesDict, errorDict)

self.travelTime = valuesDict.get('travelTime')

return True, valuesDict


Expand Down Expand Up @@ -1051,7 +1062,7 @@ def refreshDataForDev(self, dev, follow):
#Check for no data received and handle avoiding exception
#unless starting up (60 seconds only)
if self.startingUp==False:
if follow is None or follow['location'] is None:
if follow is None or 'location' not in follow:
self.logger.debug(u'No data recevied for device:'+unicode(dev.name)+' . Most likely device is offline/airplane mode or has disabled sharing location')
if dev.states['deviceIsOnline']:
self.logger.info(u'Friend Device:'+unicode(dev.name)+' has become Offline. Most likely offline/airplane mode or disabled sharing')
Expand Down Expand Up @@ -1696,7 +1707,8 @@ def iConvertMetersTime(self, meters):
texttoreturn = '%s minutes' % (minutes)
return texttoreturn, secondsoftime
except:
self.logger.exception('iCovertMetersTime Exception')
self.logger.exception('iCovertMetersTime Exception: Is Plugin Config probably setup? Is Travel Time a number?')

return 'Unknown', 'Unknown'


Expand Down

0 comments on commit 8ee375c

Please sign in to comment.