Skip to content

Commit

Permalink
Correct celcius to celsius (home-assistant#1860)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Apr 20, 2016
1 parent 9090672 commit 2e79e9d
Show file tree
Hide file tree
Showing 43 changed files with 128 additions and 109 deletions.
2 changes: 1 addition & 1 deletion config/configuration.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
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)
Expand Down Expand Up @@ -440,7 +440,7 @@ def set_time_zone(time_zone_str):
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
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/mysensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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

Expand Down Expand Up @@ -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."""
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/apcupsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
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__)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
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


# pylint: disable=unused-argument
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),
])

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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

Expand Down Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/mfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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

Expand Down Expand Up @@ -96,7 +96,7 @@ def state(self):
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':
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/modbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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__)
Expand Down Expand Up @@ -97,7 +97,7 @@ def name(self):
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:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/mysensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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

Expand Down Expand Up @@ -132,7 +132,7 @@ def unit_of_measurement(self):
"""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: '%',
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/nest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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']
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/netatmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

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
Expand All @@ -22,7 +22,7 @@
_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'],
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/onewire.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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/'
Expand Down Expand Up @@ -84,7 +84,7 @@ def state(self):
@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."""
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/openweathermap.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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

Expand Down Expand Up @@ -106,7 +106,7 @@ def update(self):
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:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/rfxtrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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
Expand All @@ -20,7 +20,7 @@
DEPENDENCIES = ['rfxtrx']

DATA_TYPES = OrderedDict([
('Temperature', TEMP_CELCIUS),
('Temperature', TEMP_CELSIUS),
('Humidity', '%'),
('Barometer', ''),
('Wind direction', ''),
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/tellduslive.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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"
Expand All @@ -27,7 +27,7 @@
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"],
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/tellstick.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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'])
Expand All @@ -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', '%'),
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/vera.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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)
Expand Down Expand Up @@ -84,7 +84,7 @@ def update(self):
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(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/verisure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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__)
Expand Down Expand Up @@ -68,7 +68,7 @@ def state(self):
@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."""
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/wink.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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']
Expand Down Expand Up @@ -45,7 +45,7 @@ def __init__(self, wink):
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

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/zigbee.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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

Expand Down Expand Up @@ -59,7 +59,7 @@ def state(self):
@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."""
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/zwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# 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


Expand Down Expand Up @@ -120,7 +120,7 @@ def unit_of_measurement(self):
unit = self._value.units

if unit == 'C':
return TEMP_CELCIUS
return TEMP_CELSIUS
elif unit == 'F':
return TEMP_FAHRENHEIT
else:
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/thermostat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
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"

Expand Down Expand Up @@ -269,12 +269,12 @@ def turn_fan_off(self):
@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."""
Expand All @@ -284,7 +284,7 @@ def _convert_for_display(self, temp):
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.
Expand Down
Loading

0 comments on commit 2e79e9d

Please sign in to comment.