Fix issue #2290 for rfxtrx (#2498)

* Fix issue #2290 for rfxtrx

* update tests for rfxtrx sensor

* Replace state_unkown with None in rfxtrx sensor

* Update test_rfxtrx.py
This commit is contained in:
Daniel Høyer Iversen authored and Paulus Schoutsen committed 2016-07-13 07:46:11 -07:00
1 parent 497bc6ac0d
commit 16feb1c55e
2 files changed
+11 -63

No files matched your search

+4 -3
View File
@@ -47,7 +47,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
data_types = [data_type]
break
for _data_type in data_types:
new_sensor = RfxtrxSensor(event, entity_info[ATTR_NAME],
new_sensor = RfxtrxSensor(None, entity_info[ATTR_NAME],
_data_type)
sensors.append(new_sensor)
sub_sensors[_data_type] = new_sensor
@@ -110,7 +110,7 @@ class RfxtrxSensor(Entity):
@property
def state(self):
"""Return the state of the sensor."""
if self.data_type:
if self.event:
return self.event.values[self.data_type]
return None
@@ -122,7 +122,8 @@ class RfxtrxSensor(Entity):
@property
def device_state_attributes(self):
"""Return the state attributes."""
return self.event.values
if self.event:
return self.event.values
@property
def unit_of_measurement(self):