Kill celcius with fire, replacing it with celsius, finally finishing what #1860 started (#2679)

This commit is contained in:
Robbie Trencheny 2016-07-31 12:18:40 -07:00 committed by Paulus Schoutsen
parent a93195610a
commit 63ba5044b3
6 changed files with 12 additions and 31 deletions

View File

@ -16,7 +16,7 @@ from homeassistant.helpers.temperature import convert
from homeassistant.helpers.config_validation import PLATFORM_SCHEMA # noqa
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_TEMPERATURE, STATE_ON, STATE_OFF, STATE_UNKNOWN,
TEMP_CELCIUS)
TEMP_CELSIUS)
DOMAIN = "hvac"
@ -462,12 +462,12 @@ class HvacDevice(Entity):
@property
def min_temp(self):
"""Return the minimum temperature."""
return convert(19, TEMP_CELCIUS, self.unit_of_measurement)
return convert(19, TEMP_CELSIUS, self.unit_of_measurement)
@property
def max_temp(self):
"""Return the maximum temperature."""
return convert(30, TEMP_CELCIUS, self.unit_of_measurement)
return convert(30, TEMP_CELSIUS, self.unit_of_measurement)
@property
def min_humidity(self):
@ -487,7 +487,7 @@ class HvacDevice(Entity):
value = convert(temp, self.unit_of_measurement,
self.hass.config.temperature_unit)
if self.hass.config.temperature_unit is TEMP_CELCIUS:
if self.hass.config.temperature_unit is TEMP_CELSIUS:
decimal_count = 1
else:
# Users of fahrenheit generally expect integer units.

View File

@ -109,7 +109,7 @@ class MoldIndicator(Entity):
# convert to celsius if necessary
if unit == TEMP_FAHRENHEIT:
return util.temperature.fahrenheit_to_celcius(temp)
return util.temperature.fahrenheit_to_celsius(temp)
elif unit == TEMP_CELSIUS:
return temp
else:
@ -260,9 +260,9 @@ class MoldIndicator(Entity):
else:
return {
ATTR_DEWPOINT:
util.temperature.celcius_to_fahrenheit(
util.temperature.celsius_to_fahrenheit(
self._dewpoint),
ATTR_CRITICAL_TEMP:
util.temperature.celcius_to_fahrenheit(
util.temperature.celsius_to_fahrenheit(
self._crit_temp),
}

View File

@ -7,7 +7,7 @@ https://home-assistant.io/components/thermostat.eq3btsmart/
import logging
from homeassistant.components.thermostat import ThermostatDevice
from homeassistant.const import TEMP_CELCIUS
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.temperature import convert
REQUIREMENTS = ['bluepy_devices==0.2.0']
@ -51,7 +51,7 @@ class EQ3BTSmartThermostat(ThermostatDevice):
@property
def unit_of_measurement(self):
"""Return the unit of measurement that is used."""
return TEMP_CELCIUS
return TEMP_CELSIUS
@property
def current_temperature(self):
@ -76,13 +76,13 @@ class EQ3BTSmartThermostat(ThermostatDevice):
@property
def min_temp(self):
"""Return the minimum temperature."""
return convert(self._thermostat.min_temp, TEMP_CELCIUS,
return convert(self._thermostat.min_temp, TEMP_CELSIUS,
self.unit_of_measurement)
@property
def max_temp(self):
"""Return the maximum temperature."""
return convert(self._thermostat.max_temp, TEMP_CELCIUS,
return convert(self._thermostat.max_temp, TEMP_CELSIUS,
self.unit_of_measurement)
def update(self):

View File

@ -43,7 +43,7 @@ class KNXThermostat(KNXMultiAddressDevice, ThermostatDevice):
["temperature", "setpoint"],
["mode"])
self._unit_of_measurement = TEMP_CELSIUS # KNX always used celcius
self._unit_of_measurement = TEMP_CELSIUS # KNX always used celsius
self._away = False # not yet supported
self._is_fan_on = False # not yet supported

View File

@ -114,7 +114,6 @@ ATTR_UNIT_OF_MEASUREMENT = "unit_of_measurement"
# Temperature attribute
ATTR_TEMPERATURE = "temperature"
TEMP_CELCIUS = "°C"
TEMP_CELSIUS = "°C"
TEMP_FAHRENHEIT = "°F"

View File

@ -1,29 +1,11 @@
"""Temperature util functions."""
import logging
def fahrenheit_to_celcius(fahrenheit: float) -> float:
"""**DEPRECATED** Convert a Fahrenheit temperature to Celsius."""
logging.getLogger(__name__).warning(
'fahrenheit_to_celcius is now fahrenheit_to_celsius '
'correcting a spelling mistake')
return fahrenheit_to_celsius(fahrenheit)
def fahrenheit_to_celsius(fahrenheit: float) -> float:
"""Convert a Fahrenheit temperature to Celsius."""
return (fahrenheit - 32.0) / 1.8
def celcius_to_fahrenheit(celcius: float) -> float:
"""**DEPRECATED** Convert a Celsius temperature to Fahrenheit."""
logging.getLogger(__name__).warning(
'celcius_to_fahrenheit is now celsius_to_fahrenheit correcting '
'a spelling mistake')
return celsius_to_fahrenheit(celcius)
def celsius_to_fahrenheit(celsius: float) -> float:
"""Convert a Celsius temperature to Fahrenheit."""
return celsius * 1.8 + 32.0