Example #1
0
	def startup(self):
		if "debuggingEnabled" not in self.pluginPrefs:
			# added in 0.0.3
			self.pluginPrefs["debuggingEnabled"] = "n"

		self.update_logging(DEBUGGING_ENABLED_MAP[self.pluginPrefs["debuggingEnabled"]])

		self.log.debug(u"startup called")

		if 'region' not in self.pluginPrefs:
			# added in 0.0.2
			self.pluginPrefs['region'] = 'NNA'

		if 'distanceUnit' not in self.pluginPrefs:
			# added in ... 0.0.2?
			self.pluginPrefs['distanceUnit'] = 'k'

		if 'updateDelayMinutesWhenCharging' not in self.pluginPrefs:
			self.pluginPrefs['updateDelayMinutesWhenCharging'] = 15

		if 'updateDelayMinutesWhenNotCharging' not in self.pluginPrefs:
			self.pluginPrefs['updateDelayMinutesWhenNotCharging'] = 15

		if 'updateDelayMinutesOnError' not in self.pluginPrefs:
			self.pluginPrefs['updateDelayMinutesOnError'] = 60

		IndigoLeaf.use_distance_scale(self.pluginPrefs['distanceUnit'])
		IndigoLeaf.setup(self.pluginPrefs['username'], self.pluginPrefs['password'], self.pluginPrefs['region'])
Example #2
0
	def validatePrefsConfigUi(self, valuesDict):
		self.log.debug("validatePrefsConfigUi: %s" % valuesDict)
		self.update_logging(bool(valuesDict['debuggingEnabled'] and "y" == valuesDict['debuggingEnabled']))

		errorDict = indigo.Dict()

		if not valuesDict["updateDelayMinutesWhenCharging"] > 0:
			errorDict["updateDelayMinutesWhenCharging"] = "This value must be a whole number >= 1"
		if not valuesDict["updateDelayMinutesWhenNotCharging"] > 0:
			errorDict["updateDelayMinutesWhenNotCharging"] = "This value must be a whole number >= 1"
		if not valuesDict["updateDelayMinutesOnError"] > 0:
			errorDict["updateDelayMinutesOnError"] = "This value must be a whole number >= 1"

		if len(errorDict) > 0:
			return (False, valuesDict, errorDict)


		IndigoLeaf.use_distance_scale(valuesDict["distanceUnit"])

		if self.leaves:
			for l in self.leaves:
				l.set_update_frequencies(charging_freq_min=self.pluginPrefs['updateDelayMinutesWhenCharging'],
										 not_charging_freq_min=self.pluginPrefs['updateDelayMinutesWhenNotCharging'],
										 error_freq_min=self.pluginPrefs['updateDelayMinutesOnError'])


		if (self.pluginPrefs['region'] != valuesDict['region']) or (self.pluginPrefs['username'] != valuesDict['username']) or (self.pluginPrefs['password'] != valuesDict['password']):
			IndigoLeaf.setup(valuesDict['username'], valuesDict['password'], valuesDict['region'])
			# no need to log in here; that will happen automatically next time we use the service



		return True
Example #3
0
	def validatePrefsConfigUi(self, valuesDict):
		self.log.debug("validatePrefsConfigUi: %s" % valuesDict)
		self.update_logging(bool(valuesDict['debuggingEnabled'] and "y" == valuesDict['debuggingEnabled']))

		IndigoLeaf.use_distance_scale(valuesDict["distanceUnit"])

		if (self.pluginPrefs['region'] != valuesDict['region']) or (self.pluginPrefs['username'] != valuesDict['username']) or (self.pluginPrefs['password'] != valuesDict['password']):
			IndigoLeaf.setup(valuesDict['username'], valuesDict['password'], valuesDict['region'])
			# no need to log in here; that will happen automatically next time we use the service

		return True
Example #4
0
	def startup(self):
		if "debuggingEnabled" not in self.pluginPrefs:
			# added in 0.0.3
			self.pluginPrefs["debuggingEnabled"] = "n"

		self.update_logging(DEBUGGING_ENABLED_MAP[self.pluginPrefs["debuggingEnabled"]])

		self.log.debug(u"startup called")

		if 'region' not in self.pluginPrefs:
			# added in 0.0.2
			self.pluginPrefs['region'] = 'NNA'

		if 'distanceUnit' not in self.pluginPrefs:
			# added in ... 0.0.2?
			self.pluginPrefs['distanceUnit'] = 'k'

		IndigoLeaf.use_distance_scale(self.pluginPrefs['distanceUnit'])
		IndigoLeaf.setup(self.pluginPrefs['username'], self.pluginPrefs['password'], self.pluginPrefs['region'])
Example #5
0
	def deviceStartComm(self, dev):
		dev.stateListOrDisplayStateIdChanged() # in case any states added/removed after plugin upgrade

		newProps = dev.pluginProps
		newProps["SupportsBatteryLevel"] = True
		dev.replacePluginPropsOnServer(newProps)

		leaf = IndigoLeaf(dev, self,
						  charging_freq_min=self.pluginPrefs['updateDelayMinutesWhenCharging'],
						  not_charging_freq_min=self.pluginPrefs['updateDelayMinutesWhenNotCharging'],
						  error_freq_min=self.pluginPrefs['updateDelayMinutesOnError'])

		# assume device will be updated on the next loop

		self.leaves.append(leaf)
Example #6
0
	def get_vins(self, filter="", valuesDict=None, typeId="", targetId=0):
		return IndigoLeaf.get_vins()
Example #7
0
	def get_vins(self, filter="", valuesDict=None, typeId="", targetId=0):
		return IndigoLeaf.get_vins()