fix up some docstrings

This commit is contained in:
Derek Brooks 2017-11-13 23:13:04 -06:00
parent c0c439c549
commit afcb0b8767
2 changed files with 16 additions and 2 deletions

View File

@ -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()

View File

@ -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)