From ed6e3495152ae20a41b967c637f93e23d4b0a34e Mon Sep 17 00:00:00 2001 From: Jonas Pedersen <jonas@jope.eu> Date: Sat, 26 Jan 2019 15:55:25 +0100 Subject: [PATCH] Correct minor comments from PR#20138. (#20454) --- homeassistant/components/danfoss_air/__init__.py | 5 +---- .../components/danfoss_air/binary_sensor.py | 4 ++-- homeassistant/components/danfoss_air/sensor.py | 12 ++++++------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/danfoss_air/__init__.py b/homeassistant/components/danfoss_air/__init__.py index 17a3952adec..80c36b6f0c6 100644 --- a/homeassistant/components/danfoss_air/__init__.py +++ b/homeassistant/components/danfoss_air/__init__.py @@ -55,10 +55,7 @@ class DanfossAir: def get_value(self, item): """Get value for sensor.""" - if item in self._data: - return self._data[item] - - return None + return self._data.get(item) @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): diff --git a/homeassistant/components/danfoss_air/binary_sensor.py b/homeassistant/components/danfoss_air/binary_sensor.py index 905ead24a0f..bf8fe952993 100644 --- a/homeassistant/components/danfoss_air/binary_sensor.py +++ b/homeassistant/components/danfoss_air/binary_sensor.py @@ -9,7 +9,7 @@ from homeassistant.components.danfoss_air import DOMAIN \ as DANFOSS_AIR_DOMAIN -def setup_platform(hass, config, add_devices, discovery_info=None): +def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the available Danfoss Air sensors etc.""" from pydanfossair.commands import ReadCommand data = hass.data[DANFOSS_AIR_DOMAIN] @@ -21,7 +21,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): for sensor in sensors: dev.append(DanfossAirBinarySensor(data, sensor[0], sensor[1])) - add_devices(dev, True) + add_entities(dev, True) class DanfossAirBinarySensor(BinarySensorDevice): diff --git a/homeassistant/components/danfoss_air/sensor.py b/homeassistant/components/danfoss_air/sensor.py index dfb9686edea..2f3807c4999 100644 --- a/homeassistant/components/danfoss_air/sensor.py +++ b/homeassistant/components/danfoss_air/sensor.py @@ -10,7 +10,7 @@ from homeassistant.const import TEMP_CELSIUS from homeassistant.helpers.entity import Entity -def setup_platform(hass, config, add_devices, discovery_info=None): +def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the available Danfoss Air sensors etc.""" from pydanfossair.commands import ReadCommand @@ -36,19 +36,19 @@ def setup_platform(hass, config, add_devices, discovery_info=None): for sensor in sensors: dev.append(DanfossAir(data, sensor[0], sensor[1], sensor[2])) - add_devices(dev, True) + add_entities(dev, True) class DanfossAir(Entity): """Representation of a Sensor.""" - def __init__(self, data, name, sensorUnit, sensorType): + def __init__(self, data, name, sensor_unit, sensor_type): """Initialize the sensor.""" self._data = data self._name = name self._state = None - self._type = sensorType - self._unit = sensorUnit + self._type = sensor_type + self._unit = sensor_unit @property def name(self): @@ -68,7 +68,7 @@ class DanfossAir(Entity): def update(self): """Update the new state of the sensor. - This is done through the DanfossAir object tthat does the actually + This is done through the DanfossAir object that does the actual communication with the Air CCM. """ self._data.update() -- GitLab