* 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:
parent
497bc6ac0d
commit
16feb1c55e
2 changed files with 11 additions and 63 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue