diff --git a/homeassistant/components/climate/__init__.py b/homeassistant/components/climate/__init__.py index e8047093cc8..6c6d493084c 100644 --- a/homeassistant/components/climate/__init__.py +++ b/homeassistant/components/climate/__init__.py @@ -253,7 +253,7 @@ def setup(hass, config): kwargs[value] = convert_temperature( temp, hass.config.units.temperature_unit, - climate.unit_of_measurement + climate.temperature_unit ) else: kwargs[value] = temp @@ -422,7 +422,12 @@ class ClimateDevice(Entity): @property def unit_of_measurement(self): - """Return the unit of measurement.""" + """The unit of measurement to display.""" + return self.hass.config.units.temperature_unit + + @property + def temperature_unit(self): + """The unit of measurement used by the platform.""" raise NotImplementedError @property @@ -556,10 +561,10 @@ class ClimateDevice(Entity): if temp is None or not isinstance(temp, Number): return temp - value = convert_temperature(temp, self.unit_of_measurement, - self.hass.config.units.temperature_unit) + value = convert_temperature(temp, self.temperature_unit, + self.unit_of_measurement) - if self.hass.config.units.temperature_unit is TEMP_CELSIUS: + if self.unit_of_measurement is TEMP_CELSIUS: decimal_count = 1 else: # Users of fahrenheit generally expect integer units. diff --git a/homeassistant/components/climate/demo.py b/homeassistant/components/climate/demo.py index 51346e62269..0104d9d01af 100644 --- a/homeassistant/components/climate/demo.py +++ b/homeassistant/components/climate/demo.py @@ -59,7 +59,7 @@ class DemoClimate(ClimateDevice): return self._name @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" return self._unit_of_measurement diff --git a/homeassistant/components/climate/ecobee.py b/homeassistant/components/climate/ecobee.py index 10e56490c84..4b414935136 100644 --- a/homeassistant/components/climate/ecobee.py +++ b/homeassistant/components/climate/ecobee.py @@ -105,7 +105,7 @@ class Thermostat(ClimateDevice): return self.thermostat['name'] @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" if self.thermostat['settings']['useCelsius']: return TEMP_CELSIUS diff --git a/homeassistant/components/climate/eq3btsmart.py b/homeassistant/components/climate/eq3btsmart.py index 646bf7f2aa8..5389585d8f1 100644 --- a/homeassistant/components/climate/eq3btsmart.py +++ b/homeassistant/components/climate/eq3btsmart.py @@ -46,7 +46,7 @@ class EQ3BTSmartThermostat(ClimateDevice): return self._name @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement that is used.""" return TEMP_CELSIUS diff --git a/homeassistant/components/climate/generic_thermostat.py b/homeassistant/components/climate/generic_thermostat.py index 97ca7fe012f..c5c38d624f5 100644 --- a/homeassistant/components/climate/generic_thermostat.py +++ b/homeassistant/components/climate/generic_thermostat.py @@ -100,7 +100,7 @@ class GenericThermostat(ClimateDevice): return self._name @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" return self._unit diff --git a/homeassistant/components/climate/heatmiser.py b/homeassistant/components/climate/heatmiser.py index 941f211c411..06fac09013c 100644 --- a/homeassistant/components/climate/heatmiser.py +++ b/homeassistant/components/climate/heatmiser.py @@ -77,7 +77,7 @@ class HeatmiserV3Thermostat(ClimateDevice): return self._name @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement which this thermostat uses.""" return TEMP_CELSIUS diff --git a/homeassistant/components/climate/homematic.py b/homeassistant/components/climate/homematic.py index c9901c40aea..7113779eb57 100644 --- a/homeassistant/components/climate/homematic.py +++ b/homeassistant/components/climate/homematic.py @@ -41,7 +41,7 @@ class HMThermostat(homematic.HMDevice, ClimateDevice): """Representation of a Homematic thermostat.""" @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement that is used.""" return TEMP_CELSIUS diff --git a/homeassistant/components/climate/honeywell.py b/homeassistant/components/climate/honeywell.py index fb7b2887344..3af4f62246d 100644 --- a/homeassistant/components/climate/honeywell.py +++ b/homeassistant/components/climate/honeywell.py @@ -120,7 +120,7 @@ class RoundThermostat(ClimateDevice): return self._name @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" return TEMP_CELSIUS @@ -217,7 +217,7 @@ class HoneywellUSThermostat(ClimateDevice): return self._device.name @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" return (TEMP_CELSIUS if self._device.temperature_unit == 'C' else TEMP_FAHRENHEIT) diff --git a/homeassistant/components/climate/knx.py b/homeassistant/components/climate/knx.py index 5ea932ab8f5..ef7445c35fd 100644 --- a/homeassistant/components/climate/knx.py +++ b/homeassistant/components/climate/knx.py @@ -63,7 +63,7 @@ class KNXThermostat(KNXMultiAddressDevice, ClimateDevice): return True @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" return self._unit_of_measurement diff --git a/homeassistant/components/climate/mysensors.py b/homeassistant/components/climate/mysensors.py index 9b997954889..c93a69ac0b9 100755 --- a/homeassistant/components/climate/mysensors.py +++ b/homeassistant/components/climate/mysensors.py @@ -47,7 +47,7 @@ class MySensorsHVAC(mysensors.MySensorsDeviceEntity, ClimateDevice): return self.gateway.optimistic @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" return (TEMP_CELSIUS if self.gateway.metric else TEMP_FAHRENHEIT) diff --git a/homeassistant/components/climate/nest.py b/homeassistant/components/climate/nest.py index c4582b839f3..fb7e4b7ec11 100644 --- a/homeassistant/components/climate/nest.py +++ b/homeassistant/components/climate/nest.py @@ -68,7 +68,7 @@ class NestThermostat(ClimateDevice): return location.capitalize() + '(' + name + ')' @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" return TEMP_CELSIUS diff --git a/homeassistant/components/climate/proliphix.py b/homeassistant/components/climate/proliphix.py index da5f5918d7c..521ef7d58e6 100644 --- a/homeassistant/components/climate/proliphix.py +++ b/homeassistant/components/climate/proliphix.py @@ -69,7 +69,7 @@ class ProliphixThermostat(ClimateDevice): } @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" return TEMP_FAHRENHEIT diff --git a/homeassistant/components/climate/radiotherm.py b/homeassistant/components/climate/radiotherm.py index 6af0e96045c..74778682540 100644 --- a/homeassistant/components/climate/radiotherm.py +++ b/homeassistant/components/climate/radiotherm.py @@ -81,7 +81,7 @@ class RadioThermostat(ClimateDevice): return self._name @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" return TEMP_FAHRENHEIT diff --git a/homeassistant/components/climate/vera.py b/homeassistant/components/climate/vera.py index 26d81e2b510..447d2e4f720 100644 --- a/homeassistant/components/climate/vera.py +++ b/homeassistant/components/climate/vera.py @@ -93,7 +93,7 @@ class VeraThermostat(VeraDevice, ClimateDevice): self._state = self.vera_device.get_hvac_mode() @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" return TEMP_FAHRENHEIT diff --git a/homeassistant/components/climate/zwave.py b/homeassistant/components/climate/zwave.py index 767bed6ff94..3e12d4c6006 100755 --- a/homeassistant/components/climate/zwave.py +++ b/homeassistant/components/climate/zwave.py @@ -209,7 +209,7 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice): return self._swing_list @property - def unit_of_measurement(self): + def temperature_unit(self): """Return the unit of measurement.""" if self._unit == 'C': return TEMP_CELSIUS diff --git a/tests/components/climate/test_honeywell.py b/tests/components/climate/test_honeywell.py index 470e280faa7..6f4888ef3e5 100644 --- a/tests/components/climate/test_honeywell.py +++ b/tests/components/climate/test_honeywell.py @@ -264,13 +264,13 @@ class TestHoneywellRound(unittest.TestCase): def test_attributes(self): """Test the attributes.""" self.assertEqual('House', self.round1.name) - self.assertEqual(TEMP_CELSIUS, self.round1.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, self.round1.temperature_unit) self.assertEqual(20, self.round1.current_temperature) self.assertEqual(21, self.round1.target_temperature) self.assertFalse(self.round1.is_away_mode_on) self.assertEqual('Hot Water', self.round2.name) - self.assertEqual(TEMP_CELSIUS, self.round2.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, self.round2.temperature_unit) self.assertEqual(21, self.round2.current_temperature) self.assertEqual(None, self.round2.target_temperature) self.assertFalse(self.round2.is_away_mode_on) @@ -330,9 +330,9 @@ class TestHoneywellUS(unittest.TestCase): def test_unit_of_measurement(self): """Test the unit of measurement.""" - self.assertEqual(TEMP_FAHRENHEIT, self.honeywell.unit_of_measurement) + self.assertEqual(TEMP_FAHRENHEIT, self.honeywell.temperature_unit) self.device.temperature_unit = 'C' - self.assertEqual(TEMP_CELSIUS, self.honeywell.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, self.honeywell.temperature_unit) def test_target_temp(self): """Test the target temperature."""