mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 12:30:31 +00:00
* 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:
committed by
Paulus Schoutsen
parent
497bc6ac0d
commit
16feb1c55e
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user