Skip to content

Commit

Permalink
python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
kmarkley committed Sep 17, 2022
1 parent 6fbd978 commit 0c1fa1a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Fan Group.indigoPlugin/Contents/Info.plist
Expand Up @@ -3,9 +3,9 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>0.0.9</string>
<string>0.1.0</string>
<key>ServerApiVersion</key>
<string>2.0</string>
<string>3.0</string>
<key>IwsApiVersion</key>
<string>1.0.0</string>
<key>CFBundleDisplayName</key>
Expand Down
30 changes: 15 additions & 15 deletions Fan Group.indigoPlugin/Contents/Server Plugin/plugin.py
Expand Up @@ -180,11 +180,11 @@ def actionControlSpeedControl(self, action, device):
devGroup.decreaseSpeedIndex(action.actionValue)
# STATUS REQUEST
elif action.speedControlAction == indigo.kUniversalAction.RequestStatus:
self.logger.info('"{}" status update'.format(device.name))
self.logger.info(f'"{device.name}" status update')
devGroup.updateGroup()
# UNKNOWN
else:
self.logger.error('"{}" {} request ignored'.format(dev.name, unicode(action.speedControlAction)))
self.logger.error(f'"{device.name}" {str(action.speedControlAction)} request ignored')

#-------------------------------------------------------------------------------
def actionControlDimmerRelay(self, action, device):
Expand All @@ -201,23 +201,23 @@ def actionControlDimmerRelay(self, action, device):
devGroup.toggle()
# STATUS REQUEST
elif action.deviceAction == indigo.kUniversalAction.RequestStatus:
self.logger.info('"{}" status update'.format(device.name))
self.logger.info(f'"{device.name}" status update')
devGroup.updateGroup()
# UNKNOWN
else:
self.logger.debug('"{}" {} request ignored'.format(dev.name, unicode(action.speedControlAction)))
self.logger.debug(f'"{device.name}" {str(action.speedControlAction)} request ignored')

#-------------------------------------------------------------------------------
def actionControlSensor(self, action, device):
self.logger.debug("actionControlSensor: "+device.name)
devGroup = self.deviceDict[device.id]
# STATUS REQUEST
if action.sensorAction == indigo.kUniversalAction.RequestStatus:
self.logger.info('"{}" status update'.format(device.name))
self.logger.info(f'"{device.name}" status update')
devGroup.updateGroup()
# UNKNOWN
else:
self.logger.debug('"{}" {} request ignored'.format(dev.name, unicode(action.speedControlAction)))
self.logger.debug(f'"{device.name}" {str(action.speedControlAction)} request ignored')

#-------------------------------------------------------------------------------
# Menu Methods
Expand Down Expand Up @@ -251,7 +251,7 @@ class FanGroup(object):
def __init__(self, device, plugin):
self.plugin = plugin
self.logger = plugin.logger
self.logger.debug("FanGroup.__init__: {}".format(device.id))
self.logger.debug(f'FanGroup.__init__: {device.id}')

self.id = device.id
self.onLevel = 0
Expand All @@ -265,12 +265,12 @@ def __init__(self, device, plugin):
# action methods
#-------------------------------------------------------------------------------
def turnOn(self):
self.logger.info('"{}" on'.format(self.name))
self.logger.info(f'"{self.name}" on')
self.setSpeedIndex(self.onLevel)

#-------------------------------------------------------------------------------
def turnOff(self):
self.logger.info('"{}" off'.format(self.name))
self.logger.info(f'"{self.name}" off')
self.setSpeedIndex(0)

#-------------------------------------------------------------------------------
Expand All @@ -282,7 +282,7 @@ def toggle(self):

#-------------------------------------------------------------------------------
def setSpeedIndex(self, speedIndex):
self.logger.info('"{}" set motor speed to {}'.format(self.name, kSpeedIndex[speedIndex]))
self.logger.info(f'"{self.name}" set motor speed to {kSpeedIndex[speedIndex]}')
for fanId, fan in self.fanDict.items():
fan.setSpeedIndex(speedIndex)

Expand All @@ -296,7 +296,7 @@ def decreaseSpeedIndex(self, value):

#-------------------------------------------------------------------------------
def setSpeedLevel(self, speedLevel):
self.logger.info('"{}" set motor speed to {}'.format(self.name, speedLevel))
self.logger.info(f'"{self.name}" set motor speed to {speedLevel}')
for fanId, fan in self.fanDict.items():
fan.setSpeedLevel(speedLevel)

Expand All @@ -306,7 +306,7 @@ def setSpeedLevel(self, speedLevel):
def refresh(self, device=None):
if not device:
device = indigo.devices[self.id]
self.logger.debug("FanGroup.refresh: {}".format(device.name))
self.logger.debug("FanGroup.refresh: {device.name}")
self.device = device
self.name = device.name
self.props = device.pluginProps
Expand All @@ -315,7 +315,7 @@ def refresh(self, device=None):
#-------------------------------------------------------------------------------
def fanUpdated(self, oldDev, newDev):
if newDev.id in self.fanDict:
self.logger.debug("FanGroup.fanUpdated: {} ({})".format(self.name, newDev.name))
self.logger.debug(f'FanGroup.fanUpdated: {self.name} ({newDev.name})')
self.fanDict[newDev.id].refresh(newDev)
self.updateGroup()

Expand Down Expand Up @@ -443,7 +443,7 @@ def updateState(self):
#-------------------------------------------------------------------------------
def thermUpdated(self, oldDev, newDev):
if newDev.id == self.thermId:
self.logger.debug("GroupThermAssist.thermUpdated: {} ({})".format(self.name, newDev.name))
self.logger.debug(f'GroupThermAssist.thermUpdated: {self.name} ({newDev.name})')
self.therm.refresh(newDev)
self.updateState()

Expand All @@ -456,7 +456,7 @@ def loopAction(self):

#-------------------------------------------------------------------------------
def setSpeedIndex(self, speedIndex):
self.logger.info('"{}" set motor speed to {}'.format(self.name, kSpeedIndex[speedIndex]))
self.logger.info(f'"{self.name}" set motor speed to {kSpeedIndex[speedIndex]}')
for fanId, fan in self.fanDict.items():
if ( speedIndex and (self.onOverride or not fan.speedIndex)) or \
(not speedIndex and (self.offOverride or fan.speedIndex == self.onLevel)):
Expand Down

0 comments on commit 0c1fa1a

Please sign in to comment.