mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Use TEMP_CELSIUS constant (#33963)
This commit is contained in:
parent
ca0648afe8
commit
78d87dc40f
@ -18,6 +18,7 @@ from homeassistant.const import (
|
|||||||
SPEED_KILOMETERS_PER_HOUR,
|
SPEED_KILOMETERS_PER_HOUR,
|
||||||
SPEED_METERS_PER_SECOND,
|
SPEED_METERS_PER_SECOND,
|
||||||
SPEED_MILES_PER_HOUR,
|
SPEED_MILES_PER_HOUR,
|
||||||
|
TEMP_CELSIUS,
|
||||||
TIME_HOURS,
|
TIME_HOURS,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
UNIT_UV_INDEX,
|
UNIT_UV_INDEX,
|
||||||
@ -134,31 +135,31 @@ SENSOR_TYPES = {
|
|||||||
],
|
],
|
||||||
"temperature": [
|
"temperature": [
|
||||||
"Temperature",
|
"Temperature",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["currently", "hourly"],
|
["currently", "hourly"],
|
||||||
],
|
],
|
||||||
"apparent_temperature": [
|
"apparent_temperature": [
|
||||||
"Apparent Temperature",
|
"Apparent Temperature",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["currently", "hourly"],
|
["currently", "hourly"],
|
||||||
],
|
],
|
||||||
"dew_point": [
|
"dew_point": [
|
||||||
"Dew Point",
|
"Dew Point",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["currently", "hourly", "daily"],
|
["currently", "hourly", "daily"],
|
||||||
],
|
],
|
||||||
@ -244,81 +245,81 @@ SENSOR_TYPES = {
|
|||||||
],
|
],
|
||||||
"apparent_temperature_max": [
|
"apparent_temperature_max": [
|
||||||
"Daily High Apparent Temperature",
|
"Daily High Apparent Temperature",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["daily"],
|
["daily"],
|
||||||
],
|
],
|
||||||
"apparent_temperature_high": [
|
"apparent_temperature_high": [
|
||||||
"Daytime High Apparent Temperature",
|
"Daytime High Apparent Temperature",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["daily"],
|
["daily"],
|
||||||
],
|
],
|
||||||
"apparent_temperature_min": [
|
"apparent_temperature_min": [
|
||||||
"Daily Low Apparent Temperature",
|
"Daily Low Apparent Temperature",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["daily"],
|
["daily"],
|
||||||
],
|
],
|
||||||
"apparent_temperature_low": [
|
"apparent_temperature_low": [
|
||||||
"Overnight Low Apparent Temperature",
|
"Overnight Low Apparent Temperature",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["daily"],
|
["daily"],
|
||||||
],
|
],
|
||||||
"temperature_max": [
|
"temperature_max": [
|
||||||
"Daily High Temperature",
|
"Daily High Temperature",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["daily"],
|
["daily"],
|
||||||
],
|
],
|
||||||
"temperature_high": [
|
"temperature_high": [
|
||||||
"Daytime High Temperature",
|
"Daytime High Temperature",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["daily"],
|
["daily"],
|
||||||
],
|
],
|
||||||
"temperature_min": [
|
"temperature_min": [
|
||||||
"Daily Low Temperature",
|
"Daily Low Temperature",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["daily"],
|
["daily"],
|
||||||
],
|
],
|
||||||
"temperature_low": [
|
"temperature_low": [
|
||||||
"Overnight Low Temperature",
|
"Overnight Low Temperature",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°F",
|
"°F",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
["daily"],
|
["daily"],
|
||||||
],
|
],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Support for Eight Sleep sensors."""
|
"""Support for Eight Sleep sensors."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.const import UNIT_PERCENTAGE
|
from homeassistant.const import TEMP_CELSIUS, UNIT_PERCENTAGE
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
CONF_SENSORS,
|
CONF_SENSORS,
|
||||||
@ -166,7 +166,7 @@ class EightUserSensor(EightSleepUserEntity):
|
|||||||
return "Score"
|
return "Score"
|
||||||
if "bed_temp" in self._sensor:
|
if "bed_temp" in self._sensor:
|
||||||
if self._units == "si":
|
if self._units == "si":
|
||||||
return "°C"
|
return TEMP_CELSIUS
|
||||||
return "°F"
|
return "°F"
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ class EightRoomSensor(EightSleepUserEntity):
|
|||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
"""Return the unit the value is expressed in."""
|
"""Return the unit the value is expressed in."""
|
||||||
if self._units == "si":
|
if self._units == "si":
|
||||||
return "°C"
|
return TEMP_CELSIUS
|
||||||
return "°F"
|
return "°F"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -9,6 +9,7 @@ from homeassistant.const import (
|
|||||||
ENERGY_WATT_HOUR,
|
ENERGY_WATT_HOUR,
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
SPEED_KILOMETERS_PER_HOUR,
|
SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
TEMP_CELSIUS,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
VOLUME_CUBIC_METERS,
|
VOLUME_CUBIC_METERS,
|
||||||
)
|
)
|
||||||
@ -34,8 +35,8 @@ HM_STATE_HA_CAST = {
|
|||||||
|
|
||||||
HM_UNIT_HA_CAST = {
|
HM_UNIT_HA_CAST = {
|
||||||
"HUMIDITY": UNIT_PERCENTAGE,
|
"HUMIDITY": UNIT_PERCENTAGE,
|
||||||
"TEMPERATURE": "°C",
|
"TEMPERATURE": TEMP_CELSIUS,
|
||||||
"ACTUAL_TEMPERATURE": "°C",
|
"ACTUAL_TEMPERATURE": TEMP_CELSIUS,
|
||||||
"BRIGHTNESS": "#",
|
"BRIGHTNESS": "#",
|
||||||
"POWER": POWER_WATT,
|
"POWER": POWER_WATT,
|
||||||
"CURRENT": "mA",
|
"CURRENT": "mA",
|
||||||
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
|||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_SCAN_INTERVAL,
|
CONF_SCAN_INTERVAL,
|
||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
)
|
)
|
||||||
@ -50,7 +51,7 @@ ATTR_LAST_SUCCESSFUL_UPDATE = "last_successful_update"
|
|||||||
|
|
||||||
# Sensor types are defined like: Name, units, icon
|
# Sensor types are defined like: Name, units, icon
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
"temperature": ["Temperature", "°C", "mdi:thermometer"],
|
"temperature": ["Temperature", TEMP_CELSIUS, "mdi:thermometer"],
|
||||||
"light": ["Light intensity", "lx", "mdi:white-balance-sunny"],
|
"light": ["Light intensity", "lx", "mdi:white-balance-sunny"],
|
||||||
"moisture": ["Moisture", UNIT_PERCENTAGE, "mdi:water-percent"],
|
"moisture": ["Moisture", UNIT_PERCENTAGE, "mdi:water-percent"],
|
||||||
"conductivity": ["Conductivity", "µS/cm", "mdi:flash-circle"],
|
"conductivity": ["Conductivity", "µS/cm", "mdi:flash-circle"],
|
||||||
|
@ -15,6 +15,7 @@ from homeassistant.const import (
|
|||||||
DEVICE_CLASS_BATTERY,
|
DEVICE_CLASS_BATTERY,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
DEVICE_CLASS_HUMIDITY,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
|
TEMP_CELSIUS,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -46,7 +47,7 @@ DEFAULT_TIMEOUT = 10
|
|||||||
|
|
||||||
# Sensor types are defined like: Name, units
|
# Sensor types are defined like: Name, units
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
"temperature": [DEVICE_CLASS_TEMPERATURE, "Temperature", "°C"],
|
"temperature": [DEVICE_CLASS_TEMPERATURE, "Temperature", TEMP_CELSIUS],
|
||||||
"humidity": [DEVICE_CLASS_HUMIDITY, "Humidity", UNIT_PERCENTAGE],
|
"humidity": [DEVICE_CLASS_HUMIDITY, "Humidity", UNIT_PERCENTAGE],
|
||||||
"battery": [DEVICE_CLASS_BATTERY, "Battery", UNIT_PERCENTAGE],
|
"battery": [DEVICE_CLASS_BATTERY, "Battery", UNIT_PERCENTAGE],
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,12 @@ from aionotion.errors import InvalidCredentialsError, NotionError
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT
|
from homeassistant.config_entries import SOURCE_IMPORT
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import (
|
||||||
|
ATTR_ATTRIBUTION,
|
||||||
|
CONF_PASSWORD,
|
||||||
|
CONF_USERNAME,
|
||||||
|
TEMP_CELSIUS,
|
||||||
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers import (
|
from homeassistant.helpers import (
|
||||||
@ -57,7 +62,7 @@ BINARY_SENSOR_TYPES = {
|
|||||||
SENSOR_WINDOW_HINGED_HORIZONTAL: ("Hinged Window", "window"),
|
SENSOR_WINDOW_HINGED_HORIZONTAL: ("Hinged Window", "window"),
|
||||||
SENSOR_WINDOW_HINGED_VERTICAL: ("Hinged Window", "window"),
|
SENSOR_WINDOW_HINGED_VERTICAL: ("Hinged Window", "window"),
|
||||||
}
|
}
|
||||||
SENSOR_TYPES = {SENSOR_TEMPERATURE: ("Temperature", "temperature", "°C")}
|
SENSOR_TYPES = {SENSOR_TEMPERATURE: ("Temperature", "temperature", TEMP_CELSIUS)}
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema(
|
CONFIG_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""This platform provides support for sensor data from RainMachine."""
|
"""This platform provides support for sensor data from RainMachine."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from homeassistant.const import TEMP_CELSIUS
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ SENSORS = {
|
|||||||
TYPE_FREEZE_TEMP: (
|
TYPE_FREEZE_TEMP: (
|
||||||
"Freeze Protect Temperature",
|
"Freeze Protect Temperature",
|
||||||
"mdi:thermometer",
|
"mdi:thermometer",
|
||||||
"°C",
|
TEMP_CELSIUS,
|
||||||
"temperature",
|
"temperature",
|
||||||
True,
|
True,
|
||||||
DATA_RESTRICTIONS_UNIVERSAL,
|
DATA_RESTRICTIONS_UNIVERSAL,
|
||||||
@ -84,7 +85,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||||||
sensor_type,
|
sensor_type,
|
||||||
(name, icon, unit, device_class, enabled_by_default, api_category),
|
(name, icon, unit, device_class, enabled_by_default, api_category),
|
||||||
) in SENSORS.items()
|
) in SENSORS.items()
|
||||||
],
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class VelbusClimate(VelbusEntity, ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def temperature_unit(self):
|
def temperature_unit(self):
|
||||||
"""Return the unit this state is expressed in."""
|
"""Return the unit this state is expressed in."""
|
||||||
if self._module.get_unit(self._channel) == "°C":
|
if self._module.get_unit(self._channel) == TEMP_CELSIUS:
|
||||||
return TEMP_CELSIUS
|
return TEMP_CELSIUS
|
||||||
return TEMP_FAHRENHEIT
|
return TEMP_FAHRENHEIT
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ from homeassistant.const import (
|
|||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
SPEED_KILOMETERS_PER_HOUR,
|
SPEED_KILOMETERS_PER_HOUR,
|
||||||
|
TEMP_CELSIUS,
|
||||||
UNIT_PERCENTAGE,
|
UNIT_PERCENTAGE,
|
||||||
__version__,
|
__version__,
|
||||||
)
|
)
|
||||||
@ -56,9 +57,9 @@ SENSOR_TYPES = {
|
|||||||
),
|
),
|
||||||
"wind_max_bearing": ("Top Wind Bearing", "°", "WSR °", int),
|
"wind_max_bearing": ("Top Wind Bearing", "°", "WSR °", int),
|
||||||
"sun_last_hour": ("Sun Last Hour", UNIT_PERCENTAGE, f"SO {UNIT_PERCENTAGE}", int),
|
"sun_last_hour": ("Sun Last Hour", UNIT_PERCENTAGE, f"SO {UNIT_PERCENTAGE}", int),
|
||||||
"temperature": ("Temperature", "°C", "T °C", float),
|
"temperature": ("Temperature", TEMP_CELSIUS, f"T {TEMP_CELSIUS}", float),
|
||||||
"precipitation": ("Precipitation", "l/m²", "N l/m²", float),
|
"precipitation": ("Precipitation", "l/m²", "N l/m²", float),
|
||||||
"dewpoint": ("Dew Point", "°C", "TP °C", float),
|
"dewpoint": ("Dew Point", TEMP_CELSIUS, f"TP {TEMP_CELSIUS}", float),
|
||||||
# The following probably not useful for general consumption,
|
# The following probably not useful for general consumption,
|
||||||
# but we need them to fill in internal attributes
|
# but we need them to fill in internal attributes
|
||||||
"station_name": ("Station Name", None, "Name", str),
|
"station_name": ("Station Name", None, "Name", str),
|
||||||
|
@ -6,6 +6,7 @@ from homeassistant.const import (
|
|||||||
ATTR_FRIENDLY_NAME,
|
ATTR_FRIENDLY_NAME,
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
DEVICE_CLASS_HUMIDITY,
|
||||||
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .common import setup_platform
|
from .common import setup_platform
|
||||||
@ -41,4 +42,4 @@ async def test_attributes(hass):
|
|||||||
state = hass.states.get("sensor.environment_sensor_temperature")
|
state = hass.states.get("sensor.environment_sensor_temperature")
|
||||||
# Abodepy device JSON reports 19.5, but Home Assistant shows 19.4
|
# Abodepy device JSON reports 19.5, but Home Assistant shows 19.4
|
||||||
assert state.state == "19.4"
|
assert state.state == "19.4"
|
||||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "°C"
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_CELSIUS
|
||||||
|
@ -12,7 +12,7 @@ from homeassistant.components.canary.sensor import (
|
|||||||
STATE_AIR_QUALITY_VERY_ABNORMAL,
|
STATE_AIR_QUALITY_VERY_ABNORMAL,
|
||||||
CanarySensor,
|
CanarySensor,
|
||||||
)
|
)
|
||||||
from homeassistant.const import UNIT_PERCENTAGE
|
from homeassistant.const import TEMP_CELSIUS, UNIT_PERCENTAGE
|
||||||
|
|
||||||
from tests.common import get_test_home_assistant
|
from tests.common import get_test_home_assistant
|
||||||
from tests.components.canary.test_init import mock_device, mock_location
|
from tests.components.canary.test_init import mock_device, mock_location
|
||||||
@ -69,7 +69,7 @@ class TestCanarySensorSetup(unittest.TestCase):
|
|||||||
sensor.update()
|
sensor.update()
|
||||||
|
|
||||||
assert sensor.name == "Home Family Room Temperature"
|
assert sensor.name == "Home Family Room Temperature"
|
||||||
assert sensor.unit_of_measurement == "°C"
|
assert sensor.unit_of_measurement == TEMP_CELSIUS
|
||||||
assert sensor.state == 21.12
|
assert sensor.state == 21.12
|
||||||
assert sensor.icon == "mdi:thermometer"
|
assert sensor.icon == "mdi:thermometer"
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import voluptuous_serialize
|
|||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.climate import DOMAIN, const, device_trigger
|
from homeassistant.components.climate import DOMAIN, const, device_trigger
|
||||||
|
from homeassistant.const import TEMP_CELSIUS
|
||||||
from homeassistant.helpers import config_validation as cv, device_registry
|
from homeassistant.helpers import config_validation as cv, device_registry
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
@ -228,13 +229,13 @@ async def test_get_trigger_capabilities_temp_humid(hass, type):
|
|||||||
capabilities["extra_fields"], custom_serializer=cv.custom_serializer
|
capabilities["extra_fields"], custom_serializer=cv.custom_serializer
|
||||||
) == [
|
) == [
|
||||||
{
|
{
|
||||||
"description": {"suffix": "°C"},
|
"description": {"suffix": TEMP_CELSIUS},
|
||||||
"name": "above",
|
"name": "above",
|
||||||
"optional": True,
|
"optional": True,
|
||||||
"type": "float",
|
"type": "float",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": {"suffix": "°C"},
|
"description": {"suffix": TEMP_CELSIUS},
|
||||||
"name": "below",
|
"name": "below",
|
||||||
"optional": True,
|
"optional": True,
|
||||||
"type": "float",
|
"type": "float",
|
||||||
|
@ -208,7 +208,7 @@ class DysonTest(unittest.TestCase):
|
|||||||
sensor.entity_id = "sensor.dyson_1"
|
sensor.entity_id = "sensor.dyson_1"
|
||||||
assert not sensor.should_poll
|
assert not sensor.should_poll
|
||||||
assert sensor.state is None
|
assert sensor.state is None
|
||||||
assert sensor.unit_of_measurement == "°C"
|
assert sensor.unit_of_measurement == TEMP_CELSIUS
|
||||||
assert sensor.name == "Device_name Temperature"
|
assert sensor.name == "Device_name Temperature"
|
||||||
assert sensor.entity_id == "sensor.dyson_1"
|
assert sensor.entity_id == "sensor.dyson_1"
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ class DysonTest(unittest.TestCase):
|
|||||||
sensor.entity_id = "sensor.dyson_1"
|
sensor.entity_id = "sensor.dyson_1"
|
||||||
assert not sensor.should_poll
|
assert not sensor.should_poll
|
||||||
assert sensor.state == 21.9
|
assert sensor.state == 21.9
|
||||||
assert sensor.unit_of_measurement == "°C"
|
assert sensor.unit_of_measurement == TEMP_CELSIUS
|
||||||
assert sensor.name == "Device_name Temperature"
|
assert sensor.name == "Device_name Temperature"
|
||||||
assert sensor.entity_id == "sensor.dyson_1"
|
assert sensor.entity_id == "sensor.dyson_1"
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ class DysonTest(unittest.TestCase):
|
|||||||
sensor.entity_id = "sensor.dyson_1"
|
sensor.entity_id = "sensor.dyson_1"
|
||||||
assert not sensor.should_poll
|
assert not sensor.should_poll
|
||||||
assert sensor.state == STATE_OFF
|
assert sensor.state == STATE_OFF
|
||||||
assert sensor.unit_of_measurement == "°C"
|
assert sensor.unit_of_measurement == TEMP_CELSIUS
|
||||||
assert sensor.name == "Device_name Temperature"
|
assert sensor.name == "Device_name Temperature"
|
||||||
assert sensor.entity_id == "sensor.dyson_1"
|
assert sensor.entity_id == "sensor.dyson_1"
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ from unittest.mock import Mock, patch
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from homeassistant.components.fritzbox.climate import FritzboxThermostat
|
from homeassistant.components.fritzbox.climate import FritzboxThermostat
|
||||||
|
from homeassistant.const import TEMP_CELSIUS
|
||||||
|
|
||||||
|
|
||||||
class TestFritzboxClimate(unittest.TestCase):
|
class TestFritzboxClimate(unittest.TestCase):
|
||||||
@ -51,7 +52,7 @@ class TestFritzboxClimate(unittest.TestCase):
|
|||||||
|
|
||||||
def test_temperature_unit(self):
|
def test_temperature_unit(self):
|
||||||
"""Test temperature_unit property."""
|
"""Test temperature_unit property."""
|
||||||
assert "°C" == self.thermostat.temperature_unit
|
assert TEMP_CELSIUS == self.thermostat.temperature_unit
|
||||||
|
|
||||||
def test_precision(self):
|
def test_precision(self):
|
||||||
"""Test precision property."""
|
"""Test precision property."""
|
||||||
|
@ -3,6 +3,7 @@ import socket
|
|||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from homeassistant.const import TEMP_CELSIUS
|
||||||
from homeassistant.setup import setup_component
|
from homeassistant.setup import setup_component
|
||||||
|
|
||||||
from tests.common import get_test_home_assistant
|
from tests.common import get_test_home_assistant
|
||||||
@ -64,25 +65,25 @@ class TestHDDTempSensor(unittest.TestCase):
|
|||||||
"/dev/sda1": {
|
"/dev/sda1": {
|
||||||
"device": "/dev/sda1",
|
"device": "/dev/sda1",
|
||||||
"temperature": "29",
|
"temperature": "29",
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": TEMP_CELSIUS,
|
||||||
"model": "WDC WD30EZRX-12DC0B0",
|
"model": "WDC WD30EZRX-12DC0B0",
|
||||||
},
|
},
|
||||||
"/dev/sdb1": {
|
"/dev/sdb1": {
|
||||||
"device": "/dev/sdb1",
|
"device": "/dev/sdb1",
|
||||||
"temperature": "32",
|
"temperature": "32",
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": TEMP_CELSIUS,
|
||||||
"model": "WDC WD15EADS-11P7B2",
|
"model": "WDC WD15EADS-11P7B2",
|
||||||
},
|
},
|
||||||
"/dev/sdc1": {
|
"/dev/sdc1": {
|
||||||
"device": "/dev/sdc1",
|
"device": "/dev/sdc1",
|
||||||
"temperature": "29",
|
"temperature": "29",
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": TEMP_CELSIUS,
|
||||||
"model": "WDC WD20EARX-22MMMB0",
|
"model": "WDC WD20EARX-22MMMB0",
|
||||||
},
|
},
|
||||||
"/dev/sdd1": {
|
"/dev/sdd1": {
|
||||||
"device": "/dev/sdd1",
|
"device": "/dev/sdd1",
|
||||||
"temperature": "32",
|
"temperature": "32",
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": TEMP_CELSIUS,
|
||||||
"model": "WDC WD15EARS-00Z5B1",
|
"model": "WDC WD15EARS-00Z5B1",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ from homeassistant.const import (
|
|||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
CONF_TEMPERATURE_UNIT,
|
CONF_TEMPERATURE_UNIT,
|
||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CoreState
|
from homeassistant.core import CoreState
|
||||||
@ -86,7 +87,7 @@ async def test_thermostat(hass, hk_driver, cls, events):
|
|||||||
HVAC_MODE_COOL,
|
HVAC_MODE_COOL,
|
||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
HVAC_MODE_AUTO,
|
HVAC_MODE_AUTO,
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@ -418,14 +419,14 @@ async def test_thermostat_humidity(hass, hk_driver, cls, events):
|
|||||||
assert acc.char_target_humidity.properties[PROP_MIN_VALUE] == DEFAULT_MIN_HUMIDITY
|
assert acc.char_target_humidity.properties[PROP_MIN_VALUE] == DEFAULT_MIN_HUMIDITY
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
entity_id, HVAC_MODE_HEAT_COOL, {ATTR_HUMIDITY: 65, ATTR_CURRENT_HUMIDITY: 40},
|
entity_id, HVAC_MODE_HEAT_COOL, {ATTR_HUMIDITY: 65, ATTR_CURRENT_HUMIDITY: 40}
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert acc.char_current_humidity.value == 40
|
assert acc.char_current_humidity.value == 40
|
||||||
assert acc.char_target_humidity.value == 65
|
assert acc.char_target_humidity.value == 65
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
entity_id, HVAC_MODE_COOL, {ATTR_HUMIDITY: 35, ATTR_CURRENT_HUMIDITY: 70},
|
entity_id, HVAC_MODE_COOL, {ATTR_HUMIDITY: 35, ATTR_CURRENT_HUMIDITY: 70}
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert acc.char_current_humidity.value == 70
|
assert acc.char_current_humidity.value == 70
|
||||||
@ -618,7 +619,7 @@ async def test_thermostat_restore(hass, hk_driver, cls, events):
|
|||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = await entity_registry.async_get_registry(hass)
|
||||||
|
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"climate", "generic", "1234", suggested_object_id="simple",
|
"climate", "generic", "1234", suggested_object_id="simple"
|
||||||
)
|
)
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"climate",
|
"climate",
|
||||||
@ -898,7 +899,7 @@ async def test_water_heater(hass, hk_driver, cls, events):
|
|||||||
assert call_set_temperature[0].data[ATTR_TEMPERATURE] == 52.0
|
assert call_set_temperature[0].data[ATTR_TEMPERATURE] == 52.0
|
||||||
assert acc.char_target_temp.value == 52.0
|
assert acc.char_target_temp.value == 52.0
|
||||||
assert len(events) == 1
|
assert len(events) == 1
|
||||||
assert events[-1].data[ATTR_VALUE] == "52.0°C"
|
assert events[-1].data[ATTR_VALUE] == f"52.0{TEMP_CELSIUS}"
|
||||||
|
|
||||||
await hass.async_add_executor_job(acc.char_target_heat_cool.client_update_value, 0)
|
await hass.async_add_executor_job(acc.char_target_heat_cool.client_update_value, 0)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@ -975,7 +976,7 @@ async def test_water_heater_restore(hass, hk_driver, cls, events):
|
|||||||
registry = await entity_registry.async_get_registry(hass)
|
registry = await entity_registry.async_get_registry(hass)
|
||||||
|
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"water_heater", "generic", "1234", suggested_object_id="simple",
|
"water_heater", "generic", "1234", suggested_object_id="simple"
|
||||||
)
|
)
|
||||||
registry.async_get_or_create(
|
registry.async_get_or_create(
|
||||||
"water_heater",
|
"water_heater",
|
||||||
|
@ -4,7 +4,11 @@ from unittest.mock import DEFAULT, Mock, patch
|
|||||||
|
|
||||||
import homeassistant.components.mhz19.sensor as mhz19
|
import homeassistant.components.mhz19.sensor as mhz19
|
||||||
from homeassistant.components.sensor import DOMAIN
|
from homeassistant.components.sensor import DOMAIN
|
||||||
from homeassistant.const import CONCENTRATION_PARTS_PER_MILLION, TEMP_FAHRENHEIT
|
from homeassistant.const import (
|
||||||
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
|
TEMP_CELSIUS,
|
||||||
|
TEMP_FAHRENHEIT,
|
||||||
|
)
|
||||||
from homeassistant.setup import setup_component
|
from homeassistant.setup import setup_component
|
||||||
|
|
||||||
from tests.common import assert_setup_component, get_test_home_assistant
|
from tests.common import assert_setup_component, get_test_home_assistant
|
||||||
@ -115,7 +119,7 @@ class TestMHZ19Sensor(unittest.TestCase):
|
|||||||
|
|
||||||
assert sensor.name == "name: Temperature"
|
assert sensor.name == "name: Temperature"
|
||||||
assert sensor.state == 24
|
assert sensor.state == 24
|
||||||
assert sensor.unit_of_measurement == "°C"
|
assert sensor.unit_of_measurement == TEMP_CELSIUS
|
||||||
assert sensor.should_poll
|
assert sensor.should_poll
|
||||||
assert sensor.device_state_attributes == {"co2_concentration": 1000}
|
assert sensor.device_state_attributes == {"co2_concentration": 1000}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ class TestMinMaxSensor(unittest.TestCase):
|
|||||||
state = self.hass.states.get("sensor.test")
|
state = self.hass.states.get("sensor.test")
|
||||||
|
|
||||||
assert str(float(self.values[0])) == state.state
|
assert str(float(self.values[0])) == state.state
|
||||||
assert state.attributes.get("unit_of_measurement") == "°C"
|
assert state.attributes.get("unit_of_measurement") == TEMP_CELSIUS
|
||||||
|
|
||||||
self.hass.states.set(
|
self.hass.states.set(
|
||||||
entity_ids[1], self.values[1], {ATTR_UNIT_OF_MEASUREMENT: TEMP_FAHRENHEIT}
|
entity_ids[1], self.values[1], {ATTR_UNIT_OF_MEASUREMENT: TEMP_FAHRENHEIT}
|
||||||
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
|||||||
ATTR_SERVICE,
|
ATTR_SERVICE,
|
||||||
EVENT_CALL_SERVICE,
|
EVENT_CALL_SERVICE,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
@ -342,7 +343,7 @@ class TestMQTTCallbacks(unittest.TestCase):
|
|||||||
mqtt.subscribe(self.hass, "test-topic", self.record_calls, encoding="ascii")
|
mqtt.subscribe(self.hass, "test-topic", self.record_calls, encoding="ascii")
|
||||||
mqtt.subscribe(self.hass, "test-topic", self.record_calls)
|
mqtt.subscribe(self.hass, "test-topic", self.record_calls)
|
||||||
|
|
||||||
fire_mqtt_message(self.hass, "test-topic", "°C")
|
fire_mqtt_message(self.hass, "test-topic", TEMP_CELSIUS)
|
||||||
|
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
assert len(self.calls) == 1
|
assert len(self.calls) == 1
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
"""The sensor tests for the nexia platform."""
|
"""The sensor tests for the nexia platform."""
|
||||||
|
|
||||||
|
from homeassistant.const import TEMP_CELSIUS
|
||||||
|
|
||||||
from .util import async_init_integration
|
from .util import async_init_integration
|
||||||
|
|
||||||
|
|
||||||
@ -15,7 +17,7 @@ async def test_create_sensors(hass):
|
|||||||
"attribution": "Data provided by mynexia.com",
|
"attribution": "Data provided by mynexia.com",
|
||||||
"device_class": "temperature",
|
"device_class": "temperature",
|
||||||
"friendly_name": "Nick Office Temperature",
|
"friendly_name": "Nick Office Temperature",
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": TEMP_CELSIUS,
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
# HA changes the implementation and a new one appears
|
# HA changes the implementation and a new one appears
|
||||||
@ -82,7 +84,7 @@ async def test_create_sensors(hass):
|
|||||||
"attribution": "Data provided by mynexia.com",
|
"attribution": "Data provided by mynexia.com",
|
||||||
"device_class": "temperature",
|
"device_class": "temperature",
|
||||||
"friendly_name": "Master Suite Outdoor Temperature",
|
"friendly_name": "Master Suite Outdoor Temperature",
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": TEMP_CELSIUS,
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
# HA changes the implementation and a new one appears
|
# HA changes the implementation and a new one appears
|
||||||
|
@ -12,7 +12,7 @@ from homeassistant.components.rflink import (
|
|||||||
EVENT_KEY_SENSOR,
|
EVENT_KEY_SENSOR,
|
||||||
TMP_ENTITY,
|
TMP_ENTITY,
|
||||||
)
|
)
|
||||||
from homeassistant.const import STATE_UNKNOWN, UNIT_PERCENTAGE
|
from homeassistant.const import STATE_UNKNOWN, TEMP_CELSIUS, UNIT_PERCENTAGE
|
||||||
|
|
||||||
from tests.components.rflink.test_init import mock_rflink
|
from tests.components.rflink.test_init import mock_rflink
|
||||||
|
|
||||||
@ -42,23 +42,27 @@ async def test_default_setup(hass, monkeypatch):
|
|||||||
config_sensor = hass.states.get("sensor.test")
|
config_sensor = hass.states.get("sensor.test")
|
||||||
assert config_sensor
|
assert config_sensor
|
||||||
assert config_sensor.state == "unknown"
|
assert config_sensor.state == "unknown"
|
||||||
assert config_sensor.attributes["unit_of_measurement"] == "°C"
|
assert config_sensor.attributes["unit_of_measurement"] == TEMP_CELSIUS
|
||||||
|
|
||||||
# test event for config sensor
|
# test event for config sensor
|
||||||
event_callback({"id": "test", "sensor": "temperature", "value": 1, "unit": "°C"})
|
event_callback(
|
||||||
|
{"id": "test", "sensor": "temperature", "value": 1, "unit": TEMP_CELSIUS}
|
||||||
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert hass.states.get("sensor.test").state == "1"
|
assert hass.states.get("sensor.test").state == "1"
|
||||||
|
|
||||||
# test event for new unconfigured sensor
|
# test event for new unconfigured sensor
|
||||||
event_callback({"id": "test2", "sensor": "temperature", "value": 0, "unit": "°C"})
|
event_callback(
|
||||||
|
{"id": "test2", "sensor": "temperature", "value": 0, "unit": TEMP_CELSIUS}
|
||||||
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
# test state of new sensor
|
# test state of new sensor
|
||||||
new_sensor = hass.states.get("sensor.test2")
|
new_sensor = hass.states.get("sensor.test2")
|
||||||
assert new_sensor
|
assert new_sensor
|
||||||
assert new_sensor.state == "0"
|
assert new_sensor.state == "0"
|
||||||
assert new_sensor.attributes["unit_of_measurement"] == "°C"
|
assert new_sensor.attributes["unit_of_measurement"] == TEMP_CELSIUS
|
||||||
assert new_sensor.attributes["icon"] == "mdi:thermometer"
|
assert new_sensor.attributes["icon"] == "mdi:thermometer"
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +77,9 @@ async def test_disable_automatic_add(hass, monkeypatch):
|
|||||||
event_callback, _, _, _ = await mock_rflink(hass, config, DOMAIN, monkeypatch)
|
event_callback, _, _, _ = await mock_rflink(hass, config, DOMAIN, monkeypatch)
|
||||||
|
|
||||||
# test event for new unconfigured sensor
|
# test event for new unconfigured sensor
|
||||||
event_callback({"id": "test2", "sensor": "temperature", "value": 0, "unit": "°C"})
|
event_callback(
|
||||||
|
{"id": "test2", "sensor": "temperature", "value": 0, "unit": TEMP_CELSIUS}
|
||||||
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
# make sure new device is not added
|
# make sure new device is not added
|
||||||
|
@ -5,7 +5,7 @@ from unittest.mock import patch
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.components.spaceapi import DOMAIN, SPACEAPI_VERSION, URL_API_SPACEAPI
|
from homeassistant.components.spaceapi import DOMAIN, SPACEAPI_VERSION, URL_API_SPACEAPI
|
||||||
from homeassistant.const import UNIT_PERCENTAGE
|
from homeassistant.const import TEMP_CELSIUS, UNIT_PERCENTAGE
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import mock_coro
|
from tests.common import mock_coro
|
||||||
@ -60,8 +60,8 @@ CONFIG = {
|
|||||||
|
|
||||||
SENSOR_OUTPUT = {
|
SENSOR_OUTPUT = {
|
||||||
"temperature": [
|
"temperature": [
|
||||||
{"location": "Home", "name": "temp1", "unit": "°C", "value": "25"},
|
{"location": "Home", "name": "temp1", "unit": TEMP_CELSIUS, "value": "25"},
|
||||||
{"location": "Home", "name": "temp2", "unit": "°C", "value": "23"},
|
{"location": "Home", "name": "temp2", "unit": TEMP_CELSIUS, "value": "23"},
|
||||||
],
|
],
|
||||||
"humidity": [
|
"humidity": [
|
||||||
{"location": "Home", "name": "hum1", "unit": UNIT_PERCENTAGE, "value": "88"}
|
{"location": "Home", "name": "hum1", "unit": UNIT_PERCENTAGE, "value": "88"}
|
||||||
@ -75,8 +75,12 @@ def mock_client(hass, hass_client):
|
|||||||
with patch("homeassistant.components.spaceapi", return_value=mock_coro(True)):
|
with patch("homeassistant.components.spaceapi", return_value=mock_coro(True)):
|
||||||
hass.loop.run_until_complete(async_setup_component(hass, "spaceapi", CONFIG))
|
hass.loop.run_until_complete(async_setup_component(hass, "spaceapi", CONFIG))
|
||||||
|
|
||||||
hass.states.async_set("test.temp1", 25, attributes={"unit_of_measurement": "°C"})
|
hass.states.async_set(
|
||||||
hass.states.async_set("test.temp2", 23, attributes={"unit_of_measurement": "°C"})
|
"test.temp1", 25, attributes={"unit_of_measurement": TEMP_CELSIUS}
|
||||||
|
)
|
||||||
|
hass.states.async_set(
|
||||||
|
"test.temp2", 23, attributes={"unit_of_measurement": TEMP_CELSIUS}
|
||||||
|
)
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"test.hum1", 88, attributes={"unit_of_measurement": UNIT_PERCENTAGE}
|
"test.hum1", 88, attributes={"unit_of_measurement": UNIT_PERCENTAGE}
|
||||||
)
|
)
|
||||||
|
@ -102,7 +102,7 @@ class TestStatisticsSensor(unittest.TestCase):
|
|||||||
assert self.mean == state.attributes.get("mean")
|
assert self.mean == state.attributes.get("mean")
|
||||||
assert self.count == state.attributes.get("count")
|
assert self.count == state.attributes.get("count")
|
||||||
assert self.total == state.attributes.get("total")
|
assert self.total == state.attributes.get("total")
|
||||||
assert "°C" == state.attributes.get("unit_of_measurement")
|
assert TEMP_CELSIUS == state.attributes.get("unit_of_measurement")
|
||||||
assert self.change == state.attributes.get("change")
|
assert self.change == state.attributes.get("change")
|
||||||
assert self.average_change == state.attributes.get("average_change")
|
assert self.average_change == state.attributes.get("average_change")
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ async def async_test_humidity(hass, cluster, entity_id):
|
|||||||
async def async_test_temperature(hass, cluster, entity_id):
|
async def async_test_temperature(hass, cluster, entity_id):
|
||||||
"""Test temperature sensor."""
|
"""Test temperature sensor."""
|
||||||
await send_attributes_report(hass, cluster, {1: 1, 0: 2900, 2: 100})
|
await send_attributes_report(hass, cluster, {1: 1, 0: 2900, 2: 100})
|
||||||
assert_state(hass, entity_id, "29.0", "°C")
|
assert_state(hass, entity_id, "29.0", TEMP_CELSIUS)
|
||||||
|
|
||||||
|
|
||||||
async def async_test_pressure(hass, cluster, entity_id):
|
async def async_test_pressure(hass, cluster, entity_id):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user