From 354f4b474003ecc297c0ebdba07db43fa7845f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=B8yer=20Iversen?= Date: Thu, 25 Aug 2016 19:52:48 +0200 Subject: [PATCH] Upgrade rfxtrx lib (#2974) --- homeassistant/components/rfxtrx.py | 4 ++-- homeassistant/components/sensor/rfxtrx.py | 6 ++---- requirements_all.txt | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/rfxtrx.py b/homeassistant/components/rfxtrx.py index f15bd703ca1..3871058a27e 100644 --- a/homeassistant/components/rfxtrx.py +++ b/homeassistant/components/rfxtrx.py @@ -14,7 +14,7 @@ from homeassistant.const import EVENT_HOMEASSISTANT_STOP from homeassistant.helpers.entity import Entity from homeassistant.const import (ATTR_ENTITY_ID, TEMP_CELSIUS) -REQUIREMENTS = ['pyRFXtrx==0.10.1'] +REQUIREMENTS = ['pyRFXtrx==0.11.0'] DOMAIN = "rfxtrx" @@ -42,7 +42,7 @@ DATA_TYPES = OrderedDict([ ('Total usage', 'W'), ('Sound', ''), ('Sensor Status', ''), - ('Unknown', '')]) + ('Counter value', '')]) RECEIVED_EVT_SUBSCRIBERS = [] RFX_DEVICES = {} diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py index 67aff8956d3..f9f7270c8e3 100644 --- a/homeassistant/components/sensor/rfxtrx.py +++ b/homeassistant/components/sensor/rfxtrx.py @@ -84,7 +84,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): pkt_id = "".join("{0:02x}".format(x) for x in event.data) _LOGGER.info("Automatic add rfxtrx.sensor: %s", - device_id) + pkt_id) data_type = "Unknown" for _data_type in DATA_TYPES: @@ -109,10 +109,8 @@ class RfxtrxSensor(Entity): self.event = event self._name = name self.should_fire_event = should_fire_event - if data_type not in DATA_TYPES: - data_type = "Unknown" self.data_type = data_type - self._unit_of_measurement = DATA_TYPES[data_type] + self._unit_of_measurement = DATA_TYPES.get(data_type, '') def __str__(self): """Return the name of the sensor.""" diff --git a/requirements_all.txt b/requirements_all.txt index 2bb39e5e69a..38466718e8d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -293,7 +293,7 @@ pushetta==1.0.15 py-cpuinfo==0.2.3 # homeassistant.components.rfxtrx -pyRFXtrx==0.10.1 +pyRFXtrx==0.11.0 # homeassistant.components.notify.xmpp pyasn1-modules==0.0.8