1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Add and use more unit constants (#32122)

* Add and use speed constants

* Add and use meter based volume and area constants

* Add and use more mass unit constants

* Add and use concentration unit constants

* Add and use watts per square meter constant

* Use more time constants

* Use more data constants
This commit is contained in:
Ville Skyttä
2020-02-25 03:52:14 +02:00
committed by GitHub
parent c98f50115d
commit 496bd3dddf
44 changed files with 422 additions and 177 deletions

View File

@@ -8,7 +8,12 @@ import pytest
from homeassistant.components.foobot import sensor as foobot
import homeassistant.components.sensor as sensor
from homeassistant.const import TEMP_CELSIUS
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
CONCENTRATION_PARTS_PER_BILLION,
CONCENTRATION_PARTS_PER_MILLION,
TEMP_CELSIUS,
)
from homeassistant.exceptions import PlatformNotReady
from homeassistant.setup import async_setup_component
@@ -33,11 +38,11 @@ async def test_default_setup(hass, aioclient_mock):
assert await async_setup_component(hass, sensor.DOMAIN, {"sensor": VALID_CONFIG})
metrics = {
"co2": ["1232.0", "ppm"],
"co2": ["1232.0", CONCENTRATION_PARTS_PER_MILLION],
"temperature": ["21.1", TEMP_CELSIUS],
"humidity": ["49.5", "%"],
"pm2_5": ["144.8", "µg/m3"],
"voc": ["340.7", "ppb"],
"pm2_5": ["144.8", CONCENTRATION_MICROGRAMS_PER_CUBIC_METER],
"voc": ["340.7", CONCENTRATION_PARTS_PER_BILLION],
"index": ["138.9", "%"],
}