Correct celcius to celsius (#1860)
This commit is contained in:
1 parent
9090672146
commit
2e79e9d5bb
43 files changed
+128
-109
No files matched your search
@@ -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__)
|
||||
|
||||
@@ -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),
|
||||
])
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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':
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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: '%',
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -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."""
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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', ''),
|
||||
|
||||
@@ -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"],
|
||||
|
||||
@@ -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', '%'),
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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."""
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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."""
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user