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

@@ -5,7 +5,11 @@ from homeassistant import setup
from homeassistant.components import climate, sensor
from homeassistant.components.demo.sensor import DemoSensor
import homeassistant.components.prometheus as prometheus
from homeassistant.const import DEVICE_CLASS_POWER, ENERGY_KILO_WATT_HOUR
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
DEVICE_CLASS_POWER,
ENERGY_KILO_WATT_HOUR,
)
from homeassistant.setup import async_setup_component
@@ -47,7 +51,12 @@ async def prometheus_client(loop, hass, hass_client):
await sensor4.async_update_ha_state()
sensor5 = DemoSensor(
None, "SPS30 PM <1µm Weight concentration", 3.7069, None, "µg/m³", None
None,
"SPS30 PM <1µm Weight concentration",
3.7069,
None,
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
None,
)
sensor5.hass = hass
sensor5.entity_id = "sensor.sps30_pm_1um_weight_concentration"