Skip to content

Commit 0839dcc

Browse files
committed
Fix incorrect use of getattr call.
1 parent 2cf0f3e commit 0839dcc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

myDevices/cloud/client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,7 @@ def ProcessGpioCommand(self, message):
459459
error = None
460460
try:
461461
channel = int(message['channel'].replace(cayennemqtt.SYS_GPIO + ':', ''))
462-
suffix = getattr(message, 'suffix', 'value')
463-
result = self.sensorsClient.GpioCommand(suffix, channel, message['payload'])
462+
result = self.sensorsClient.GpioCommand(message.get('suffix', 'value'), channel, message['payload'])
464463
debug('ProcessGpioCommand result: {}'.format(result))
465464
if result == 'failure':
466465
error = 'GPIO command failed'
@@ -477,8 +476,7 @@ def ProcessSensorCommand(self, message):
477476
channel = None
478477
if len(sensor_info) > 1:
479478
channel = sensor_info[1]
480-
suffix = getattr(message, 'suffix', 'value')
481-
result = self.sensorsClient.SensorCommand(suffix, sensor, channel, message['payload'])
479+
result = self.sensorsClient.SensorCommand(message.get('suffix', 'value'), sensor, channel, message['payload'])
482480
debug('ProcessSensorCommand result: {}'.format(result))
483481
if result is False:
484482
error = 'Sensor command failed'

0 commit comments

Comments
 (0)