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:
1 parent
c98f50115d
commit
496bd3dddf
44 files changed
+422
-177
No files matched your search
@@ -20,10 +20,14 @@ from homeassistant.components.homematicip_cloud.sensor import (
|
||||
ATTR_TEMPERATURE_OFFSET,
|
||||
ATTR_WIND_DIRECTION,
|
||||
ATTR_WIND_DIRECTION_VARIATION,
|
||||
TIME_HOURS,
|
||||
)
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, POWER_WATT, TEMP_CELSIUS
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
POWER_WATT,
|
||||
SPEED_KILOMETERS_PER_HOUR,
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .helper import async_manipulate_test_data, get_and_check_entity_basics
|
||||
@@ -285,7 +289,7 @@ async def test_hmip_windspeed_sensor(hass, default_mock_hap_factory):
|
||||
)
|
||||
|
||||
assert ha_state.state == "2.6"
|
||||
assert ha_state.attributes[ATTR_UNIT_OF_MEASUREMENT] == f"km/{TIME_HOURS}"
|
||||
assert ha_state.attributes[ATTR_UNIT_OF_MEASUREMENT] == SPEED_KILOMETERS_PER_HOUR
|
||||
await async_manipulate_test_data(hass, hmip_device, "windSpeed", 9.4)
|
||||
ha_state = hass.states.get(entity_id)
|
||||
assert ha_state.state == "9.4"
|
||||
|
||||
Reference in new issue
Block a user