Merge pull request #1010 from MartinHjelmare/fix-device-attr

Fix device_state_attributes
This commit is contained in:
Martin Hjelmare 2016-01-27 02:43:34 +01:00
commit 6796219f37
2 changed files with 8 additions and 4 deletions

View File

@ -153,8 +153,10 @@ class MySensorsSensor(Entity):
@property
def device_state_attributes(self):
"""Return device specific state attributes."""
device_attr = dict(self._values)
device_attr.pop(self.value_type, None)
device_attr = {}
for value_type, value in self._values.items():
if value_type != self.value_type:
device_attr[self.gateway.const.SetReq(value_type).name] = value
return device_attr
@property

View File

@ -103,8 +103,10 @@ class MySensorsSwitch(SwitchDevice):
@property
def device_state_attributes(self):
"""Return device specific state attributes."""
device_attr = dict(self._values)
device_attr.pop(self.value_type, None)
device_attr = {}
for value_type, value in self._values.items():
if value_type != self.value_type:
device_attr[self.gateway.const.SetReq(value_type).name] = value
return device_attr
@property