diff --git a/config/configuration.yaml.example b/config/configuration.yaml.example index 899134b71a7..0f6318a0638 100644 --- a/config/configuration.yaml.example +++ b/config/configuration.yaml.example @@ -7,7 +7,7 @@ homeassistant: latitude: 32.87336 longitude: 117.22743 - # C for Celcius, F for Fahrenheit + # C for Celsius, F for Fahrenheit temperature_unit: C # Pick yours from here: diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 7be0c9dd371..a4b6550ee84 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -21,7 +21,7 @@ import homeassistant.util.package as pkg_util from homeassistant.const import ( CONF_CUSTOMIZE, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, CONF_TEMPERATURE_UNIT, CONF_TIME_ZONE, EVENT_COMPONENT_LOADED, - TEMP_CELCIUS, TEMP_FAHRENHEIT, PLATFORM_FORMAT, __version__) + TEMP_CELSIUS, TEMP_FAHRENHEIT, PLATFORM_FORMAT, __version__) from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import ( event_decorators, service, config_per_platform, extract_domain_configs) @@ -440,7 +440,7 @@ def process_ha_core_config(hass, config): if info.use_fahrenheit: hac.temperature_unit = TEMP_FAHRENHEIT else: - hac.temperature_unit = TEMP_CELCIUS + hac.temperature_unit = TEMP_CELSIUS if hac.location_name is None: hac.location_name = info.city diff --git a/homeassistant/components/mysensors.py b/homeassistant/components/mysensors.py index ec8976c8373..d620c2acb6a 100644 --- a/homeassistant/components/mysensors.py +++ b/homeassistant/components/mysensors.py @@ -9,7 +9,7 @@ import logging import homeassistant.bootstrap as bootstrap from homeassistant.const import ( ATTR_DISCOVERED, ATTR_SERVICE, EVENT_HOMEASSISTANT_START, - EVENT_HOMEASSISTANT_STOP, EVENT_PLATFORM_DISCOVERED, TEMP_CELCIUS, + EVENT_HOMEASSISTANT_STOP, EVENT_PLATFORM_DISCOVERED, TEMP_CELSIUS, CONF_OPTIMISTIC) from homeassistant.helpers import validate_config @@ -64,7 +64,7 @@ def setup(hass, config): import mysensors.mysensors as mysensors version = str(config[DOMAIN].get(CONF_VERSION, DEFAULT_VERSION)) - is_metric = (hass.config.temperature_unit == TEMP_CELCIUS) + is_metric = (hass.config.temperature_unit == TEMP_CELSIUS) def setup_gateway(port, persistence, persistence_file, version, baud_rate): """Return gateway after setup of the gateway.""" diff --git a/homeassistant/components/sensor/apcupsd.py b/homeassistant/components/sensor/apcupsd.py index 7a1f0641879..b625e22691c 100644 --- a/homeassistant/components/sensor/apcupsd.py +++ b/homeassistant/components/sensor/apcupsd.py @@ -7,13 +7,13 @@ https://home-assistant.io/components/sensor.apcupsd/ import logging from homeassistant.components import apcupsd -from homeassistant.const import TEMP_CELCIUS +from homeassistant.const import TEMP_CELSIUS from homeassistant.helpers.entity import Entity DEPENDENCIES = [apcupsd.DOMAIN] DEFAULT_NAME = "UPS Status" SPECIFIC_UNITS = { - "ITEMP": TEMP_CELCIUS + "ITEMP": TEMP_CELSIUS } _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/demo.py b/homeassistant/components/sensor/demo.py index fac6f2accf1..a290a0edd53 100644 --- a/homeassistant/components/sensor/demo.py +++ b/homeassistant/components/sensor/demo.py @@ -4,7 +4,7 @@ Demo platform that has a couple of fake sensors. For more details about this platform, please refer to the documentation https://home-assistant.io/components/demo/ """ -from homeassistant.const import ATTR_BATTERY_LEVEL, TEMP_CELCIUS +from homeassistant.const import ATTR_BATTERY_LEVEL, TEMP_CELSIUS from homeassistant.helpers.entity import Entity @@ -12,7 +12,7 @@ from homeassistant.helpers.entity import Entity def setup_platform(hass, config, add_devices, discovery_info=None): """Setup the Demo sensors.""" add_devices([ - DemoSensor('Outside Temperature', 15.6, TEMP_CELCIUS, 12), + DemoSensor('Outside Temperature', 15.6, TEMP_CELSIUS, 12), DemoSensor('Outside Humidity', 54, '%', None), ]) diff --git a/homeassistant/components/sensor/forecast.py b/homeassistant/components/sensor/forecast.py index dbb4962450a..f33c6ca719c 100644 --- a/homeassistant/components/sensor/forecast.py +++ b/homeassistant/components/sensor/forecast.py @@ -7,7 +7,7 @@ https://home-assistant.io/components/sensor.forecast/ import logging from datetime import timedelta -from homeassistant.const import CONF_API_KEY, TEMP_CELCIUS +from homeassistant.const import CONF_API_KEY, TEMP_CELSIUS from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle @@ -64,7 +64,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): if 'units' in config: units = config['units'] - elif hass.config.temperature_unit == TEMP_CELCIUS: + elif hass.config.temperature_unit == TEMP_CELSIUS: units = 'si' else: units = 'us' diff --git a/homeassistant/components/sensor/mfi.py b/homeassistant/components/sensor/mfi.py index a53f7f4df32..0af020de5f2 100644 --- a/homeassistant/components/sensor/mfi.py +++ b/homeassistant/components/sensor/mfi.py @@ -9,7 +9,7 @@ import logging import requests from homeassistant.components.sensor import DOMAIN -from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, TEMP_CELCIUS +from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, TEMP_CELSIUS from homeassistant.helpers import validate_config from homeassistant.helpers.entity import Entity @@ -96,7 +96,7 @@ class MfiSensor(Entity): def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" if self._port.tag == 'temperature': - return TEMP_CELCIUS + return TEMP_CELSIUS elif self._port.tag == 'active_pwr': return 'Watts' elif self._port.model == 'Input Digital': diff --git a/homeassistant/components/sensor/modbus.py b/homeassistant/components/sensor/modbus.py index 7c3f2890d21..db024651b86 100644 --- a/homeassistant/components/sensor/modbus.py +++ b/homeassistant/components/sensor/modbus.py @@ -8,7 +8,7 @@ import logging import homeassistant.components.modbus as modbus from homeassistant.const import ( - STATE_OFF, STATE_ON, TEMP_CELCIUS, TEMP_FAHRENHEIT) + STATE_OFF, STATE_ON, TEMP_CELSIUS, TEMP_FAHRENHEIT) from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) @@ -97,7 +97,7 @@ class ModbusSensor(Entity): def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" if self._unit == "C": - return TEMP_CELCIUS + return TEMP_CELSIUS elif self._unit == "F": return TEMP_FAHRENHEIT else: diff --git a/homeassistant/components/sensor/mysensors.py b/homeassistant/components/sensor/mysensors.py index 68d2827b758..ee1fcdcba95 100644 --- a/homeassistant/components/sensor/mysensors.py +++ b/homeassistant/components/sensor/mysensors.py @@ -7,7 +7,7 @@ https://home-assistant.io/components/sensor.mysensors/ import logging from homeassistant.const import ( - ATTR_BATTERY_LEVEL, STATE_OFF, STATE_ON, TEMP_CELCIUS, TEMP_FAHRENHEIT) + ATTR_BATTERY_LEVEL, STATE_OFF, STATE_ON, TEMP_CELSIUS, TEMP_FAHRENHEIT) from homeassistant.helpers.entity import Entity from homeassistant.loader import get_component @@ -132,7 +132,7 @@ class MySensorsSensor(Entity): """Return the unit of measurement of this entity.""" set_req = self.gateway.const.SetReq unit_map = { - set_req.V_TEMP: (TEMP_CELCIUS + set_req.V_TEMP: (TEMP_CELSIUS if self.gateway.metric else TEMP_FAHRENHEIT), set_req.V_HUM: '%', set_req.V_DIMMER: '%', diff --git a/homeassistant/components/sensor/nest.py b/homeassistant/components/sensor/nest.py index a59d72c1fb4..c3b68430b99 100644 --- a/homeassistant/components/sensor/nest.py +++ b/homeassistant/components/sensor/nest.py @@ -9,7 +9,7 @@ import voluptuous as vol import homeassistant.components.nest as nest from homeassistant.helpers.entity import Entity from homeassistant.const import ( - TEMP_CELCIUS, CONF_PLATFORM, CONF_SCAN_INTERVAL, CONF_MONITORED_CONDITIONS + TEMP_CELSIUS, CONF_PLATFORM, CONF_SCAN_INTERVAL, CONF_MONITORED_CONDITIONS ) DEPENDENCIES = ['nest'] @@ -103,7 +103,7 @@ class NestTempSensor(NestSensor): @property def unit_of_measurement(self): """Return the unit the value is expressed in.""" - return TEMP_CELCIUS + return TEMP_CELSIUS @property def state(self): diff --git a/homeassistant/components/sensor/netatmo.py b/homeassistant/components/sensor/netatmo.py index 4d6b89622e8..b8a42f3cdbf 100644 --- a/homeassistant/components/sensor/netatmo.py +++ b/homeassistant/components/sensor/netatmo.py @@ -9,7 +9,7 @@ from datetime import timedelta from homeassistant.components.sensor import DOMAIN from homeassistant.const import ( - CONF_API_KEY, CONF_PASSWORD, CONF_USERNAME, TEMP_CELCIUS) + CONF_API_KEY, CONF_PASSWORD, CONF_USERNAME, TEMP_CELSIUS) from homeassistant.helpers import validate_config from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle @@ -22,7 +22,7 @@ REQUIREMENTS = [ _LOGGER = logging.getLogger(__name__) SENSOR_TYPES = { - 'temperature': ['Temperature', TEMP_CELCIUS, 'mdi:thermometer'], + 'temperature': ['Temperature', TEMP_CELSIUS, 'mdi:thermometer'], 'co2': ['CO2', 'ppm', 'mdi:cloud'], 'pressure': ['Pressure', 'mbar', 'mdi:gauge'], 'noise': ['Noise', 'dB', 'mdi:volume-high'], diff --git a/homeassistant/components/sensor/onewire.py b/homeassistant/components/sensor/onewire.py index 1bf164d6c7a..6941fc952a6 100644 --- a/homeassistant/components/sensor/onewire.py +++ b/homeassistant/components/sensor/onewire.py @@ -9,7 +9,7 @@ import os import time from glob import glob -from homeassistant.const import STATE_UNKNOWN, TEMP_CELCIUS +from homeassistant.const import STATE_UNKNOWN, TEMP_CELSIUS from homeassistant.helpers.entity import Entity BASE_DIR = '/sys/bus/w1/devices/' @@ -84,7 +84,7 @@ class OneWire(Entity): @property def unit_of_measurement(self): """Return the unit the value is expressed in.""" - return TEMP_CELCIUS + return TEMP_CELSIUS def update(self): """Get the latest data from the device.""" diff --git a/homeassistant/components/sensor/openweathermap.py b/homeassistant/components/sensor/openweathermap.py index 8204307759d..4a764efe62e 100644 --- a/homeassistant/components/sensor/openweathermap.py +++ b/homeassistant/components/sensor/openweathermap.py @@ -7,7 +7,7 @@ https://home-assistant.io/components/sensor.openweathermap/ import logging from datetime import timedelta -from homeassistant.const import CONF_API_KEY, TEMP_CELCIUS, TEMP_FAHRENHEIT +from homeassistant.const import CONF_API_KEY, TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle @@ -106,7 +106,7 @@ class OpenWeatherMapSensor(Entity): if self.type == 'weather': self._state = data.get_detailed_status() elif self.type == 'temperature': - if self.temp_unit == TEMP_CELCIUS: + if self.temp_unit == TEMP_CELSIUS: self._state = round(data.get_temperature('celsius')['temp'], 1) elif self.temp_unit == TEMP_FAHRENHEIT: diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py index b0afe4af526..ddd68009c48 100644 --- a/homeassistant/components/sensor/rfxtrx.py +++ b/homeassistant/components/sensor/rfxtrx.py @@ -9,7 +9,7 @@ from collections import OrderedDict import voluptuous as vol import homeassistant.components.rfxtrx as rfxtrx -from homeassistant.const import TEMP_CELCIUS +from homeassistant.const import TEMP_CELSIUS import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity from homeassistant.util import slugify @@ -20,7 +20,7 @@ from homeassistant.components.rfxtrx import ( DEPENDENCIES = ['rfxtrx'] DATA_TYPES = OrderedDict([ - ('Temperature', TEMP_CELCIUS), + ('Temperature', TEMP_CELSIUS), ('Humidity', '%'), ('Barometer', ''), ('Wind direction', ''), diff --git a/homeassistant/components/sensor/tellduslive.py b/homeassistant/components/sensor/tellduslive.py index 70b7781ded3..3ea651c92da 100644 --- a/homeassistant/components/sensor/tellduslive.py +++ b/homeassistant/components/sensor/tellduslive.py @@ -10,7 +10,7 @@ from datetime import datetime from homeassistant.components import tellduslive from homeassistant.const import ( - ATTR_BATTERY_LEVEL, DEVICE_DEFAULT_NAME, TEMP_CELCIUS) + ATTR_BATTERY_LEVEL, DEVICE_DEFAULT_NAME, TEMP_CELSIUS) from homeassistant.helpers.entity import Entity ATTR_LAST_UPDATED = "time_last_updated" @@ -27,7 +27,7 @@ SENSOR_TYPE_WINDGUST = "wgust" SENSOR_TYPE_WATT = "watt" SENSOR_TYPES = { - SENSOR_TYPE_TEMP: ['Temperature', TEMP_CELCIUS, "mdi:thermometer"], + SENSOR_TYPE_TEMP: ['Temperature', TEMP_CELSIUS, "mdi:thermometer"], SENSOR_TYPE_HUMIDITY: ['Humidity', '%', "mdi:water"], SENSOR_TYPE_RAINRATE: ['Rain rate', 'mm', "mdi:water"], SENSOR_TYPE_RAINTOTAL: ['Rain total', 'mm', "mdi:water"], diff --git a/homeassistant/components/sensor/tellstick.py b/homeassistant/components/sensor/tellstick.py index 853c97b7fb9..1439dd00ee1 100644 --- a/homeassistant/components/sensor/tellstick.py +++ b/homeassistant/components/sensor/tellstick.py @@ -8,7 +8,7 @@ import logging from collections import namedtuple import homeassistant.util as util -from homeassistant.const import TEMP_CELCIUS +from homeassistant.const import TEMP_CELSIUS from homeassistant.helpers.entity import Entity DatatypeDescription = namedtuple("DatatypeDescription", ['name', 'unit']) @@ -25,7 +25,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): sensor_value_descriptions = { tellcore_constants.TELLSTICK_TEMPERATURE: DatatypeDescription( - 'temperature', config.get('temperature_scale', TEMP_CELCIUS)), + 'temperature', config.get('temperature_scale', TEMP_CELSIUS)), tellcore_constants.TELLSTICK_HUMIDITY: DatatypeDescription('humidity', '%'), diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index 4f95ab5af32..6334a229747 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -9,7 +9,7 @@ import logging import homeassistant.util.dt as dt_util from homeassistant.const import ( ATTR_ARMED, ATTR_BATTERY_LEVEL, ATTR_LAST_TRIP_TIME, ATTR_TRIPPED, - TEMP_CELCIUS, TEMP_FAHRENHEIT) + TEMP_CELSIUS, TEMP_FAHRENHEIT) from homeassistant.helpers.entity import Entity from homeassistant.components.vera import ( VeraDevice, VERA_DEVICES, VERA_CONTROLLER) @@ -84,7 +84,7 @@ class VeraSensor(VeraDevice, Entity): if vera_temp_units == 'F': self._temperature_units = TEMP_FAHRENHEIT else: - self._temperature_units = TEMP_CELCIUS + self._temperature_units = TEMP_CELSIUS if self.hass: temp = self.hass.config.temperature( diff --git a/homeassistant/components/sensor/verisure.py b/homeassistant/components/sensor/verisure.py index d9176bd212d..bd6f53c3e1c 100644 --- a/homeassistant/components/sensor/verisure.py +++ b/homeassistant/components/sensor/verisure.py @@ -7,7 +7,7 @@ documentation at https://home-assistant.io/components/verisure/ import logging from homeassistant.components.verisure import HUB as hub -from homeassistant.const import TEMP_CELCIUS +from homeassistant.const import TEMP_CELSIUS from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) @@ -68,7 +68,7 @@ class VerisureThermometer(Entity): @property def unit_of_measurement(self): """Return the unit of measurement of this entity.""" - return TEMP_CELCIUS + return TEMP_CELSIUS def update(self): """Update the sensor.""" diff --git a/homeassistant/components/sensor/wink.py b/homeassistant/components/sensor/wink.py index 109381d49fc..fbd0579a75f 100644 --- a/homeassistant/components/sensor/wink.py +++ b/homeassistant/components/sensor/wink.py @@ -7,7 +7,7 @@ at https://home-assistant.io/components/sensor.wink/ import logging from homeassistant.const import (CONF_ACCESS_TOKEN, STATE_CLOSED, - STATE_OPEN, TEMP_CELCIUS) + STATE_OPEN, TEMP_CELSIUS) from homeassistant.helpers.entity import Entity REQUIREMENTS = ['python-wink==0.7.4'] @@ -45,7 +45,7 @@ class WinkSensorDevice(Entity): self.wink = wink self.capability = self.wink.capability() if self.wink.UNIT == "°": - self._unit_of_measurement = TEMP_CELCIUS + self._unit_of_measurement = TEMP_CELSIUS else: self._unit_of_measurement = self.wink.UNIT diff --git a/homeassistant/components/sensor/zigbee.py b/homeassistant/components/sensor/zigbee.py index c744f7df4bd..2692bcf9715 100644 --- a/homeassistant/components/sensor/zigbee.py +++ b/homeassistant/components/sensor/zigbee.py @@ -8,7 +8,7 @@ import logging from binascii import hexlify from homeassistant.components import zigbee -from homeassistant.const import TEMP_CELCIUS +from homeassistant.const import TEMP_CELSIUS from homeassistant.core import JobPriority from homeassistant.helpers.entity import Entity @@ -59,7 +59,7 @@ class ZigBeeTemperatureSensor(Entity): @property def unit_of_measurement(self): """Unit the value is expressed in.""" - return TEMP_CELCIUS + return TEMP_CELSIUS def update(self, *args): """Get the latest data.""" diff --git a/homeassistant/components/sensor/zwave.py b/homeassistant/components/sensor/zwave.py index a044e38c27d..849e68d0a7f 100644 --- a/homeassistant/components/sensor/zwave.py +++ b/homeassistant/components/sensor/zwave.py @@ -8,7 +8,7 @@ at https://home-assistant.io/components/sensor.zwave/ # pylint: disable=import-error from homeassistant.components.sensor import DOMAIN from homeassistant.components import zwave -from homeassistant.const import (TEMP_CELCIUS, TEMP_FAHRENHEIT) +from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.helpers.entity import Entity @@ -120,7 +120,7 @@ class ZWaveMultilevelSensor(ZWaveSensor): unit = self._value.units if unit == 'C': - return TEMP_CELCIUS + return TEMP_CELSIUS elif unit == 'F': return TEMP_FAHRENHEIT else: diff --git a/homeassistant/components/thermostat/__init__.py b/homeassistant/components/thermostat/__init__.py index 7e2ff9f2234..0004156aecf 100644 --- a/homeassistant/components/thermostat/__init__.py +++ b/homeassistant/components/thermostat/__init__.py @@ -19,7 +19,7 @@ from homeassistant.components import (ecobee, zwave) import homeassistant.helpers.config_validation as cv from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_TEMPERATURE, STATE_ON, STATE_OFF, STATE_UNKNOWN, - TEMP_CELCIUS) + TEMP_CELSIUS) DOMAIN = "thermostat" @@ -269,12 +269,12 @@ class ThermostatDevice(Entity): @property def min_temp(self): """Return the minimum temperature.""" - return convert(7, TEMP_CELCIUS, self.unit_of_measurement) + return convert(7, TEMP_CELSIUS, self.unit_of_measurement) @property def max_temp(self): """Return the maximum temperature.""" - return convert(35, TEMP_CELCIUS, self.unit_of_measurement) + return convert(35, TEMP_CELSIUS, self.unit_of_measurement) def _convert_for_display(self, temp): """Convert temperature into preferred units for display purposes.""" @@ -284,7 +284,7 @@ class ThermostatDevice(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. diff --git a/homeassistant/components/thermostat/demo.py b/homeassistant/components/thermostat/demo.py index ce5a3130d94..5d47276c7bc 100644 --- a/homeassistant/components/thermostat/demo.py +++ b/homeassistant/components/thermostat/demo.py @@ -5,13 +5,13 @@ For more details about this platform, please refer to the documentation https://home-assistant.io/components/demo/ """ from homeassistant.components.thermostat import ThermostatDevice -from homeassistant.const import TEMP_CELCIUS, TEMP_FAHRENHEIT +from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT def setup_platform(hass, config, add_devices, discovery_info=None): """Setup the Demo thermostats.""" add_devices([ - DemoThermostat("Nest", 21, TEMP_CELCIUS, False, 19, False), + DemoThermostat("Nest", 21, TEMP_CELSIUS, False, 19, False), DemoThermostat("Thermostat", 68, TEMP_FAHRENHEIT, True, 77, True), ]) diff --git a/homeassistant/components/thermostat/heat_control.py b/homeassistant/components/thermostat/heat_control.py index 22542c034ba..12472b61d02 100644 --- a/homeassistant/components/thermostat/heat_control.py +++ b/homeassistant/components/thermostat/heat_control.py @@ -11,7 +11,7 @@ from homeassistant.components import switch from homeassistant.components.thermostat import ( STATE_HEAT, STATE_IDLE, ThermostatDevice) from homeassistant.const import ( - ATTR_UNIT_OF_MEASUREMENT, TEMP_CELCIUS, TEMP_FAHRENHEIT) + ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS, TEMP_FAHRENHEIT) from homeassistant.helpers.event import track_state_change DEPENDENCIES = ['switch', 'sensor'] @@ -142,11 +142,11 @@ class HeatControl(ThermostatDevice): """Update thermostat with latest state from sensor.""" unit = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) - if unit not in (TEMP_CELCIUS, TEMP_FAHRENHEIT): + if unit not in (TEMP_CELSIUS, TEMP_FAHRENHEIT): self._cur_temp = None self._unit = None _LOGGER.error('Sensor has unsupported unit: %s (allowed: %s, %s)', - unit, TEMP_CELCIUS, TEMP_FAHRENHEIT) + unit, TEMP_CELSIUS, TEMP_FAHRENHEIT) return temp = util.convert(state.state, float) diff --git a/homeassistant/components/thermostat/heatmiser.py b/homeassistant/components/thermostat/heatmiser.py index dfd9938c6e7..ec8bbeb1981 100644 --- a/homeassistant/components/thermostat/heatmiser.py +++ b/homeassistant/components/thermostat/heatmiser.py @@ -10,7 +10,7 @@ https://home-assistant.io/components/thermostat.heatmiser/ import logging from homeassistant.components.thermostat import ThermostatDevice -from homeassistant.const import TEMP_CELCIUS +from homeassistant.const import TEMP_CELSIUS CONF_IPADDRESS = 'ipaddress' CONF_PORT = 'port' @@ -79,7 +79,7 @@ class HeatmiserV3Thermostat(ThermostatDevice): @property def unit_of_measurement(self): """Return the unit of measurement which this thermostat uses.""" - return TEMP_CELCIUS + return TEMP_CELSIUS @property def current_temperature(self): diff --git a/homeassistant/components/thermostat/homematic.py b/homeassistant/components/thermostat/homematic.py index 9f8ffe9f2df..b4ecc6c166b 100644 --- a/homeassistant/components/thermostat/homematic.py +++ b/homeassistant/components/thermostat/homematic.py @@ -11,7 +11,7 @@ from xmlrpc.client import Error from collections import namedtuple 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 = [] @@ -120,7 +120,7 @@ class HomematicThermostat(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): @@ -149,12 +149,12 @@ class HomematicThermostat(ThermostatDevice): @property def min_temp(self): """Return the minimum temperature - 4.5 means off.""" - return convert(4.5, TEMP_CELCIUS, self.unit_of_measurement) + return convert(4.5, TEMP_CELSIUS, self.unit_of_measurement) @property def max_temp(self): """Return the maximum temperature - 30.5 means on.""" - return convert(30.5, TEMP_CELCIUS, self.unit_of_measurement) + return convert(30.5, TEMP_CELSIUS, self.unit_of_measurement) def update(self): """Update the data from the thermostat.""" diff --git a/homeassistant/components/thermostat/honeywell.py b/homeassistant/components/thermostat/honeywell.py index 1a04c307c1f..7a5662b335f 100644 --- a/homeassistant/components/thermostat/honeywell.py +++ b/homeassistant/components/thermostat/honeywell.py @@ -9,7 +9,7 @@ import socket from homeassistant.components.thermostat import ThermostatDevice from homeassistant.const import ( - CONF_PASSWORD, CONF_USERNAME, TEMP_CELCIUS, TEMP_FAHRENHEIT) + CONF_PASSWORD, CONF_USERNAME, TEMP_CELSIUS, TEMP_FAHRENHEIT) REQUIREMENTS = ['evohomeclient==0.2.4', 'somecomfort==0.2.1'] @@ -120,7 +120,7 @@ class RoundThermostat(ThermostatDevice): @property def unit_of_measurement(self): """Return the unit of measurement.""" - return TEMP_CELCIUS + return TEMP_CELSIUS @property def current_temperature(self): @@ -203,7 +203,7 @@ class HoneywellUSThermostat(ThermostatDevice): @property def unit_of_measurement(self): """Return the unit of measurement.""" - return (TEMP_CELCIUS if self._device.temperature_unit == 'C' + return (TEMP_CELSIUS if self._device.temperature_unit == 'C' else TEMP_FAHRENHEIT) @property diff --git a/homeassistant/components/thermostat/nest.py b/homeassistant/components/thermostat/nest.py index 63892238f58..881eb821865 100644 --- a/homeassistant/components/thermostat/nest.py +++ b/homeassistant/components/thermostat/nest.py @@ -9,7 +9,7 @@ import voluptuous as vol import homeassistant.components.nest as nest from homeassistant.components.thermostat import ( STATE_COOL, STATE_HEAT, STATE_IDLE, ThermostatDevice) -from homeassistant.const import TEMP_CELCIUS, CONF_PLATFORM, CONF_SCAN_INTERVAL +from homeassistant.const import TEMP_CELSIUS, CONF_PLATFORM, CONF_SCAN_INTERVAL DEPENDENCIES = ['nest'] @@ -50,7 +50,7 @@ class NestThermostat(ThermostatDevice): @property def unit_of_measurement(self): """Return the unit of measurement.""" - return TEMP_CELCIUS + return TEMP_CELSIUS @property def device_state_attributes(self): diff --git a/homeassistant/components/thermostat/zwave.py b/homeassistant/components/thermostat/zwave.py index bd17ae208f1..c5f00fbd457 100644 --- a/homeassistant/components/thermostat/zwave.py +++ b/homeassistant/components/thermostat/zwave.py @@ -7,7 +7,7 @@ from homeassistant.components.thermostat import ( ThermostatDevice, STATE_IDLE) from homeassistant.components import zwave -from homeassistant.const import (TEMP_FAHRENHEIT, TEMP_CELCIUS) +from homeassistant.const import TEMP_FAHRENHEIT, TEMP_CELSIUS CONF_NAME = 'name' DEFAULT_NAME = 'ZWave Thermostat' @@ -82,7 +82,7 @@ class ZWaveThermostat(zwave.ZWaveDeviceEntity, ThermostatDevice): """Return the unit of measurement.""" unit = self._unit if unit == 'C': - return TEMP_CELCIUS + return TEMP_CELSIUS elif unit == 'F': return TEMP_FAHRENHEIT else: diff --git a/homeassistant/config.py b/homeassistant/config.py index 25c7cf65136..b89d358045d 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -26,7 +26,7 @@ DEFAULT_CONFIG = ( (CONF_LATITUDE, None, 'latitude', 'Location required to calculate the time' ' the sun rises and sets'), (CONF_LONGITUDE, None, 'longitude', None), - (CONF_TEMPERATURE_UNIT, 'C', None, 'C for Celcius, F for Fahrenheit'), + (CONF_TEMPERATURE_UNIT, 'C', None, 'C for Celsius, F for Fahrenheit'), (CONF_TIME_ZONE, 'UTC', 'time_zone', 'Pick yours from here: http://en.wiki' 'pedia.org/wiki/List_of_tz_database_time_zones'), ) diff --git a/homeassistant/const.py b/homeassistant/const.py index 68a61c18cb8..b225458fb83 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -98,6 +98,7 @@ ATTR_UNIT_OF_MEASUREMENT = "unit_of_measurement" # Temperature attribute ATTR_TEMPERATURE = "temperature" TEMP_CELCIUS = "°C" +TEMP_CELSIUS = "°C" TEMP_FAHRENHEIT = "°F" # Contains the information that is discovered diff --git a/homeassistant/core.py b/homeassistant/core.py index 88a06ac6156..9a237cb58bd 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -27,7 +27,7 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, EVENT_SERVICE_EXECUTED, EVENT_SERVICE_REGISTERED, EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL, RESTART_EXIT_CODE, - SERVICE_HOMEASSISTANT_RESTART, SERVICE_HOMEASSISTANT_STOP, TEMP_CELCIUS, + SERVICE_HOMEASSISTANT_RESTART, SERVICE_HOMEASSISTANT_STOP, TEMP_CELSIUS, TEMP_FAHRENHEIT, __version__) from homeassistant.exceptions import ( HomeAssistantError, InvalidEntityFormatError) @@ -698,7 +698,7 @@ class Config(object): def temperature(self, value, unit): """Convert temperature to user preferred unit if set.""" - if not (unit in (TEMP_CELCIUS, TEMP_FAHRENHEIT) and + if not (unit in (TEMP_CELSIUS, TEMP_FAHRENHEIT) and self.temperature_unit and unit != self.temperature_unit): return value, unit diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py index ebfccd22ea8..923d071231a 100644 --- a/homeassistant/helpers/config_validation.py +++ b/homeassistant/helpers/config_validation.py @@ -6,7 +6,7 @@ import voluptuous as vol from homeassistant.loader import get_platform from homeassistant.const import ( - CONF_PLATFORM, CONF_SCAN_INTERVAL, TEMP_CELCIUS, TEMP_FAHRENHEIT) + CONF_PLATFORM, CONF_SCAN_INTERVAL, TEMP_CELSIUS, TEMP_FAHRENHEIT) from homeassistant.helpers.entity import valid_entity_id import homeassistant.util.dt as dt_util from homeassistant.util import slugify @@ -156,7 +156,7 @@ def temperature_unit(value): """Validate and transform temperature unit.""" value = str(value).upper() if value == 'C': - return TEMP_CELCIUS + return TEMP_CELSIUS elif value == 'F': return TEMP_FAHRENHEIT raise vol.Invalid('invalid temperature unit (expected C or F)') diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index fb320c89c64..6434c23f807 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -5,7 +5,7 @@ from collections import defaultdict from homeassistant.const import ( ATTR_ASSUMED_STATE, ATTR_FRIENDLY_NAME, ATTR_HIDDEN, ATTR_ICON, ATTR_UNIT_OF_MEASUREMENT, DEVICE_DEFAULT_NAME, STATE_OFF, STATE_ON, - STATE_UNAVAILABLE, STATE_UNKNOWN, TEMP_CELCIUS, TEMP_FAHRENHEIT, + STATE_UNAVAILABLE, STATE_UNKNOWN, TEMP_CELSIUS, TEMP_FAHRENHEIT, ATTR_ENTITY_PICTURE) from homeassistant.exceptions import NoEntitySpecifiedError from homeassistant.util import ensure_unique_string, slugify @@ -173,7 +173,7 @@ class Entity(object): attr.pop(ATTR_HIDDEN) # Convert temperature if we detect one - if attr.get(ATTR_UNIT_OF_MEASUREMENT) in (TEMP_CELCIUS, + if attr.get(ATTR_UNIT_OF_MEASUREMENT) in (TEMP_CELSIUS, TEMP_FAHRENHEIT): state, attr[ATTR_UNIT_OF_MEASUREMENT] = \ diff --git a/homeassistant/helpers/temperature.py b/homeassistant/helpers/temperature.py index 3fd0ef76a89..6155c08d8f0 100644 --- a/homeassistant/helpers/temperature.py +++ b/homeassistant/helpers/temperature.py @@ -1,13 +1,13 @@ """Methods to help handle temperature in Home Assistant.""" import homeassistant.util.temperature as temp_util -from homeassistant.const import TEMP_CELCIUS +from homeassistant.const import TEMP_CELSIUS def convert(temperature, unit, to_unit): """Convert temperature to correct unit.""" if unit == to_unit or unit is None or to_unit is None: return temperature - elif unit == TEMP_CELCIUS: - return temp_util.celcius_to_fahrenheit(temperature) + elif unit == TEMP_CELSIUS: + return temp_util.celsius_to_fahrenheit(temperature) - return temp_util.fahrenheit_to_celcius(temperature) + return temp_util.fahrenheit_to_celsius(temperature) diff --git a/homeassistant/util/temperature.py b/homeassistant/util/temperature.py index 99a524c5212..293ddcf44cf 100644 --- a/homeassistant/util/temperature.py +++ b/homeassistant/util/temperature.py @@ -1,11 +1,29 @@ """Temperature util functions.""" +import logging + def fahrenheit_to_celcius(fahrenheit): + """**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): """Convert a Fahrenheit temperature to Celsius.""" return (fahrenheit - 32.0) / 1.8 def celcius_to_fahrenheit(celcius): + """**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): """Convert a Celsius temperature to Fahrenheit.""" - return celcius * 1.8 + 32.0 + return celsius * 1.8 + 32.0 diff --git a/tests/common.py b/tests/common.py index beed90bae35..169b099a12b 100644 --- a/tests/common.py +++ b/tests/common.py @@ -10,7 +10,7 @@ import homeassistant.util.dt as date_util from homeassistant.const import ( STATE_ON, STATE_OFF, DEVICE_DEFAULT_NAME, EVENT_TIME_CHANGED, EVENT_STATE_CHANGED, EVENT_PLATFORM_DISCOVERED, ATTR_SERVICE, - ATTR_DISCOVERED, SERVER_PORT, TEMP_CELCIUS) + ATTR_DISCOVERED, SERVER_PORT, TEMP_CELSIUS) from homeassistant.components import sun, mqtt _TEST_INSTANCE_PORT = SERVER_PORT @@ -36,7 +36,7 @@ def get_test_home_assistant(num_threads=None): hass.config.latitude = 32.87336 hass.config.longitude = -117.22743 hass.config.time_zone = date_util.get_time_zone('US/Pacific') - hass.config.temperature_unit = TEMP_CELCIUS + hass.config.temperature_unit = TEMP_CELSIUS if 'custom_components.test' not in loader.AVAILABLE_COMPONENTS: loader.prepare(hass) diff --git a/tests/components/sensor/test_mfi.py b/tests/components/sensor/test_mfi.py index 033ee30cc09..8180ca152f3 100644 --- a/tests/components/sensor/test_mfi.py +++ b/tests/components/sensor/test_mfi.py @@ -6,7 +6,7 @@ import requests import homeassistant.components.sensor as sensor import homeassistant.components.sensor.mfi as mfi -from homeassistant.const import TEMP_CELCIUS +from homeassistant.const import TEMP_CELSIUS from tests.common import get_test_home_assistant @@ -139,7 +139,7 @@ class TestMfiSensor(unittest.TestCase): def test_uom_temp(self): """Test the UOM temperature.""" self.port.tag = 'temperature' - self.assertEqual(TEMP_CELCIUS, self.sensor.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, self.sensor.unit_of_measurement) def test_uom_power(self): """Test the UOEM power.""" diff --git a/tests/components/sensor/test_rfxtrx.py b/tests/components/sensor/test_rfxtrx.py index 7efe6583028..f0e07326f46 100644 --- a/tests/components/sensor/test_rfxtrx.py +++ b/tests/components/sensor/test_rfxtrx.py @@ -3,7 +3,7 @@ import unittest from homeassistant.bootstrap import _setup_component from homeassistant.components import rfxtrx as rfxtrx_core -from homeassistant.const import TEMP_CELCIUS +from homeassistant.const import TEMP_CELSIUS from tests.common import get_test_home_assistant @@ -44,7 +44,7 @@ class TestSensorRfxtrx(unittest.TestCase): print(rfxtrx_core.RFX_DEVICES) entity = rfxtrx_core.RFX_DEVICES['sensor_0502'] self.assertEqual('Test', entity.name) - self.assertEqual(TEMP_CELCIUS, entity.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, entity.unit_of_measurement) self.assertEqual(14.9, entity.state) self.assertEqual({'Humidity status': 'normal', 'Temperature': 14.9, 'Rssi numeric': 6, 'Humidity': 34, @@ -85,7 +85,7 @@ class TestSensorRfxtrx(unittest.TestCase): self.assertEqual('Bath_Humidity', entity.__str__()) elif entity.name == 'Bath': device_num = device_num + 1 - self.assertEqual(TEMP_CELCIUS, entity.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, entity.unit_of_measurement) self.assertEqual(25.5, entity.state) self.assertEqual({'Battery numeric': 9, 'Temperature': 25.5, 'Humidity': 14, 'Humidity status': 'normal', @@ -95,7 +95,7 @@ class TestSensorRfxtrx(unittest.TestCase): self.assertEqual('Bath', entity.__str__()) elif entity.name == 'Test': device_num = device_num + 1 - self.assertEqual(TEMP_CELCIUS, entity.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, entity.unit_of_measurement) self.assertEqual(14.9, entity.state) self.assertEqual({'Humidity status': 'normal', 'Temperature': 14.9, @@ -226,7 +226,7 @@ class TestSensorRfxtrx(unittest.TestCase): self.assertEqual('Bath_Humidity', entity.__str__()) elif entity.name == 'Bath': device_num = device_num + 1 - self.assertEqual(TEMP_CELCIUS, entity.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, entity.unit_of_measurement) self.assertEqual(25.5, entity.state) self.assertEqual({'Battery numeric': 9, 'Temperature': 25.5, 'Humidity': 14, 'Humidity status': 'normal', @@ -236,7 +236,7 @@ class TestSensorRfxtrx(unittest.TestCase): self.assertEqual('Bath', entity.__str__()) elif entity.name == 'Test': device_num = device_num + 1 - self.assertEqual(TEMP_CELCIUS, entity.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, entity.unit_of_measurement) self.assertEqual(14.9, entity.state) self.assertEqual({'Humidity status': 'normal', 'Temperature': 14.9, @@ -274,7 +274,7 @@ class TestSensorRfxtrx(unittest.TestCase): self.assertEqual('Bath_Humidity', entity.__str__()) elif entity.name == 'Bath': device_num = device_num + 1 - self.assertEqual(TEMP_CELCIUS, entity.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, entity.unit_of_measurement) self.assertEqual(51.1, entity.state) self.assertEqual({'Battery numeric': 9, 'Temperature': 51.1, 'Humidity': 15, 'Humidity status': 'normal', @@ -284,7 +284,7 @@ class TestSensorRfxtrx(unittest.TestCase): self.assertEqual('Bath', entity.__str__()) elif entity.name == 'Test': device_num = device_num + 1 - self.assertEqual(TEMP_CELCIUS, entity.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, entity.unit_of_measurement) self.assertEqual(13.3, entity.state) self.assertEqual({'Humidity status': 'normal', 'Temperature': 13.3, diff --git a/tests/components/thermostat/test_demo.py b/tests/components/thermostat/test_demo.py index 2d202e8a4e1..c4c6a52a20f 100644 --- a/tests/components/thermostat/test_demo.py +++ b/tests/components/thermostat/test_demo.py @@ -2,7 +2,7 @@ import unittest from homeassistant.const import ( - TEMP_CELCIUS, + TEMP_CELSIUS, ) from homeassistant.components import thermostat @@ -18,7 +18,7 @@ class TestDemoThermostat(unittest.TestCase): def setUp(self): # pylint: disable=invalid-name """Setup things to be run when tests are started.""" self.hass = get_test_home_assistant() - self.hass.config.temperature_unit = TEMP_CELCIUS + self.hass.config.temperature_unit = TEMP_CELSIUS self.assertTrue(thermostat.setup(self.hass, {'thermostat': { 'platform': 'demo', }})) diff --git a/tests/components/thermostat/test_heat_control.py b/tests/components/thermostat/test_heat_control.py index cb75c72f8ca..7ef23be85bb 100644 --- a/tests/components/thermostat/test_heat_control.py +++ b/tests/components/thermostat/test_heat_control.py @@ -8,7 +8,7 @@ from homeassistant.const import ( SERVICE_TURN_ON, STATE_ON, STATE_OFF, - TEMP_CELCIUS, + TEMP_CELSIUS, ) from homeassistant.components import thermostat import homeassistant.components.thermostat.heat_control as heat_control @@ -48,7 +48,7 @@ class TestSetupThermostatHeatControl(unittest.TestCase): def test_setup_with_sensor(self): """Test set up heat_control with sensor to trigger update at init.""" self.hass.states.set(ENT_SENSOR, 22.0, { - ATTR_UNIT_OF_MEASUREMENT: TEMP_CELCIUS + ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS }) thermostat.setup(self.hass, {'thermostat': { 'platform': 'heat_control', @@ -58,7 +58,7 @@ class TestSetupThermostatHeatControl(unittest.TestCase): }}) state = self.hass.states.get(ENTITY) self.assertEqual( - TEMP_CELCIUS, state.attributes.get('unit_of_measurement')) + TEMP_CELSIUS, state.attributes.get('unit_of_measurement')) self.assertEqual(22.0, state.attributes.get('current_temperature')) @@ -68,7 +68,7 @@ class TestThermostatHeatControl(unittest.TestCase): def setUp(self): # pylint: disable=invalid-name """Setup things to be run when tests are started.""" self.hass = get_test_home_assistant() - self.hass.config.temperature_unit = TEMP_CELCIUS + self.hass.config.temperature_unit = TEMP_CELSIUS thermostat.setup(self.hass, {'thermostat': { 'platform': 'heat_control', 'name': 'test', @@ -182,7 +182,7 @@ class TestThermostatHeatControl(unittest.TestCase): self.assertEqual(SERVICE_TURN_OFF, call.service) self.assertEqual(ENT_SWITCH, call.data['entity_id']) - def _setup_sensor(self, temp, unit=TEMP_CELCIUS): + def _setup_sensor(self, temp, unit=TEMP_CELSIUS): """Setup the test sensor.""" self.hass.states.set(ENT_SENSOR, temp, { ATTR_UNIT_OF_MEASUREMENT: unit diff --git a/tests/components/thermostat/test_honeywell.py b/tests/components/thermostat/test_honeywell.py index 159507948b8..7a5b4c93a98 100644 --- a/tests/components/thermostat/test_honeywell.py +++ b/tests/components/thermostat/test_honeywell.py @@ -6,7 +6,7 @@ from unittest import mock import somecomfort from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, - TEMP_CELCIUS, TEMP_FAHRENHEIT) + TEMP_CELSIUS, TEMP_FAHRENHEIT) import homeassistant.components.thermostat.honeywell as honeywell @@ -249,13 +249,13 @@ class TestHoneywellRound(unittest.TestCase): def test_attributes(self): """Test the attributes.""" self.assertEqual('House', self.round1.name) - self.assertEqual(TEMP_CELCIUS, self.round1.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, self.round1.unit_of_measurement) 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_CELCIUS, self.round2.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, self.round2.unit_of_measurement) self.assertEqual(21, self.round2.current_temperature) self.assertEqual(None, self.round2.target_temperature) self.assertFalse(self.round2.is_away_mode_on) @@ -307,7 +307,7 @@ class TestHoneywellUS(unittest.TestCase): """Test the unit of measurement.""" self.assertEqual(TEMP_FAHRENHEIT, self.honeywell.unit_of_measurement) self.device.temperature_unit = 'C' - self.assertEqual(TEMP_CELCIUS, self.honeywell.unit_of_measurement) + self.assertEqual(TEMP_CELSIUS, self.honeywell.unit_of_measurement) def test_target_temp(self): """Test the target temperature.""" diff --git a/tests/test_core.py b/tests/test_core.py index b1f8c5ee86f..4930bcef6ed 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -17,7 +17,7 @@ from homeassistant.exceptions import ( import homeassistant.util.dt as dt_util from homeassistant.const import ( __version__, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, - EVENT_STATE_CHANGED, ATTR_FRIENDLY_NAME, TEMP_CELCIUS, + EVENT_STATE_CHANGED, ATTR_FRIENDLY_NAME, TEMP_CELSIUS, TEMP_FAHRENHEIT) from tests.common import get_test_home_assistant @@ -448,8 +448,8 @@ class TestConfig(unittest.TestCase): def test_temperature_not_convert_if_no_preference(self): """No unit conversion to happen if no preference.""" self.assertEqual( - (25, TEMP_CELCIUS), - self.config.temperature(25, TEMP_CELCIUS)) + (25, TEMP_CELSIUS), + self.config.temperature(25, TEMP_CELSIUS)) self.assertEqual( (80, TEMP_FAHRENHEIT), self.config.temperature(80, TEMP_FAHRENHEIT)) @@ -458,8 +458,8 @@ class TestConfig(unittest.TestCase): """No unit conversion to happen if no preference.""" self.config.temperature_unit = TEMP_FAHRENHEIT self.assertEqual( - ('25a', TEMP_CELCIUS), - self.config.temperature('25a', TEMP_CELCIUS)) + ('25a', TEMP_CELSIUS), + self.config.temperature('25a', TEMP_CELSIUS)) def test_temperature_not_convert_if_invalid_unit(self): """No unit conversion to happen if no preference.""" @@ -467,15 +467,15 @@ class TestConfig(unittest.TestCase): (25, 'Invalid unit'), self.config.temperature(25, 'Invalid unit')) - def test_temperature_to_convert_to_celcius(self): + def test_temperature_to_convert_to_celsius(self): """Test temperature conversion to celsius.""" - self.config.temperature_unit = TEMP_CELCIUS + self.config.temperature_unit = TEMP_CELSIUS self.assertEqual( - (25, TEMP_CELCIUS), - self.config.temperature(25, TEMP_CELCIUS)) + (25, TEMP_CELSIUS), + self.config.temperature(25, TEMP_CELSIUS)) self.assertEqual( - (26.7, TEMP_CELCIUS), + (26.7, TEMP_CELSIUS), self.config.temperature(80, TEMP_FAHRENHEIT)) def test_temperature_to_convert_to_fahrenheit(self): @@ -484,7 +484,7 @@ class TestConfig(unittest.TestCase): self.assertEqual( (77, TEMP_FAHRENHEIT), - self.config.temperature(25, TEMP_CELCIUS)) + self.config.temperature(25, TEMP_CELSIUS)) self.assertEqual( (80, TEMP_FAHRENHEIT), self.config.temperature(80, TEMP_FAHRENHEIT))