From afcb0b876713a382feb930288e0280a17151e94f Mon Sep 17 00:00:00 2001 From: Derek Brooks Date: Mon, 13 Nov 2017 23:13:04 -0600 Subject: [PATCH] fix up some docstrings --- homeassistant/components/climate/nuheat.py | 11 ++++++++++- tests/components/climate/test_nuheat.py | 7 ++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/climate/nuheat.py b/homeassistant/components/climate/nuheat.py index deaf9b071b9..b1779ba5e5f 100644 --- a/homeassistant/components/climate/nuheat.py +++ b/homeassistant/components/climate/nuheat.py @@ -23,6 +23,8 @@ DEPENDENCIES = ["nuheat"] _LOGGER = logging.getLogger(__name__) +ICON = "mdi:thermometer" + MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=5) # Hold modes @@ -55,7 +57,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None): class NuHeatThermostat(ClimateDevice): """Representation of a NuHeat Thermostat.""" + def __init__(self, api, serial_number, min_away_temp, temperature_unit): + """Initialize the thermostat.""" self._thermostat = api.get_thermostat(serial_number) self._temperature_unit = temperature_unit self._min_away_temp = min_away_temp @@ -66,6 +70,11 @@ class NuHeatThermostat(ClimateDevice): """Return the name of the thermostat.""" return self._thermostat.room + @property + def icon(self): + """Return the icon to use in the frontend.""" + return ICON + @property def temperature_unit(self): """Return the unit of measurement.""" @@ -216,5 +225,5 @@ class NuHeatThermostat(ClimateDevice): @Throttle(MIN_TIME_BETWEEN_UPDATES) def _throttled_update(self, **kwargs): - """Get the latest state from the thermostat... but throttled!""" + """Get the latest state from the thermostat with a throttle.""" self._thermostat.get_data() diff --git a/tests/components/climate/test_nuheat.py b/tests/components/climate/test_nuheat.py index ab5624e82f3..1d178e255fa 100644 --- a/tests/components/climate/test_nuheat.py +++ b/tests/components/climate/test_nuheat.py @@ -13,10 +13,11 @@ SCHEDULE_TEMPORARY_HOLD = 2 class TestNuHeat(unittest.TestCase): """Tests for NuHeat climate.""" + # pylint: disable=protected-access, no-self-use def setUp(self): - + """Set up test variables.""" serial_number = "12345" min_away_temp = None temperature_unit = "F" @@ -68,6 +69,10 @@ class TestNuHeat(unittest.TestCase): """Test name property.""" self.assertEqual(self.thermostat.name, "Master bathroom") + def test_icon(self): + """Test name property.""" + self.assertEqual(self.thermostat.icon, "mdi:thermometer") + def test_temperature_unit(self): """Test temperature unit.""" self.assertEqual(self.thermostat.temperature_unit, TEMP_FAHRENHEIT)