mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Rfxtrx bug fix (#1992)
* Rfxtrx bug fix * Added Sensor Status to data_types Missing dataype for security1 sensors * Misspelling
This commit is contained in:
parent
1cd59cf2a9
commit
ca0ea6c2f3
@ -39,7 +39,9 @@ DATA_TYPES = OrderedDict([
|
|||||||
('Wind direction', ''),
|
('Wind direction', ''),
|
||||||
('Rain rate', ''),
|
('Rain rate', ''),
|
||||||
('Energy usage', 'W'),
|
('Energy usage', 'W'),
|
||||||
('Total usage', 'W')])
|
('Total usage', 'W'),
|
||||||
|
('Sensor Status', ''),
|
||||||
|
('Unknown', '')])
|
||||||
|
|
||||||
RECEIVED_EVT_SUBSCRIBERS = []
|
RECEIVED_EVT_SUBSCRIBERS = []
|
||||||
RFX_DEVICES = {}
|
RFX_DEVICES = {}
|
||||||
|
@ -75,10 +75,12 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
_LOGGER.info("Automatic add rfxtrx.sensor: %s",
|
_LOGGER.info("Automatic add rfxtrx.sensor: %s",
|
||||||
device_id)
|
device_id)
|
||||||
|
|
||||||
for data_type in DATA_TYPES:
|
data_type = "Unknown"
|
||||||
if data_type in event.values:
|
for _data_type in DATA_TYPES:
|
||||||
new_sensor = RfxtrxSensor(event, pkt_id, data_type)
|
if _data_type in event.values:
|
||||||
|
data_type = _data_type
|
||||||
break
|
break
|
||||||
|
new_sensor = RfxtrxSensor(event, pkt_id, data_type)
|
||||||
sub_sensors = {}
|
sub_sensors = {}
|
||||||
sub_sensors[new_sensor.data_type] = new_sensor
|
sub_sensors[new_sensor.data_type] = new_sensor
|
||||||
rfxtrx.RFX_DEVICES[device_id] = sub_sensors
|
rfxtrx.RFX_DEVICES[device_id] = sub_sensors
|
||||||
@ -94,12 +96,11 @@ class RfxtrxSensor(Entity):
|
|||||||
def __init__(self, event, name, data_type):
|
def __init__(self, event, name, data_type):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
self.event = event
|
self.event = event
|
||||||
self._unit_of_measurement = None
|
|
||||||
self.data_type = None
|
|
||||||
self._name = name
|
self._name = name
|
||||||
if data_type:
|
if data_type not in DATA_TYPES:
|
||||||
self.data_type = data_type
|
data_type = "Unknown"
|
||||||
self._unit_of_measurement = DATA_TYPES[data_type]
|
self.data_type = data_type
|
||||||
|
self._unit_of_measurement = DATA_TYPES[data_type]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Return the name of the sensor."""
|
"""Return the name of the sensor."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user