Fix device_state_attributes
* Return a dict with keys as the names of the enum members instead of the member values. * This fixes a TypeError: unorderable types: int() < str()pull/1010/head
parent
b13e48bd71
commit
1dae22a465
|
@ -153,8 +153,10 @@ class MySensorsSensor(Entity):
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Return device specific state attributes."""
|
"""Return device specific state attributes."""
|
||||||
device_attr = dict(self._values)
|
device_attr = {}
|
||||||
device_attr.pop(self.value_type, None)
|
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
|
return device_attr
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -103,8 +103,10 @@ class MySensorsSwitch(SwitchDevice):
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Return device specific state attributes."""
|
"""Return device specific state attributes."""
|
||||||
device_attr = dict(self._values)
|
device_attr = {}
|
||||||
device_attr.pop(self.value_type, None)
|
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
|
return device_attr
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in New Issue