Skip to content

Commit

Permalink
Allow setting empty sensor name
Browse files Browse the repository at this point in the history
This closes #239
  • Loading branch information
AdamaTheHutt committed Mar 23, 2020
1 parent e64cfb2 commit 4cd084d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions telldus/src/telldus/Device.py
Expand Up @@ -469,6 +469,9 @@ def setMetadata(self, name, value):
self._manager.deviceMetadataUpdated(self, name)

def setName(self, name):
if name == '' and not self.isSensor():
# empty names only allowed for sensors
return
self._name = name
self.paramUpdated('name')

Expand Down
2 changes: 1 addition & 1 deletion telldus/src/telldus/DeviceManager.py
Expand Up @@ -397,7 +397,7 @@ def __handleDeviceCommand(self, msg):
if 'action' not in args:
return
if args['action'] == 'setName':
if 'name' not in args or args['name'] == '':
if 'name' not in args:
return
for dev in self.devices:
if dev.id() != args['device']:
Expand Down

0 comments on commit 4cd084d

Please sign in to comment.