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

@@ -1,7 +1,11 @@
"""Support for Homekit sensors."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from homeassistant.const import DEVICE_CLASS_BATTERY, TEMP_CELSIUS
from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION,
DEVICE_CLASS_BATTERY,
TEMP_CELSIUS,
)
from homeassistant.core import callback
from . import KNOWN_DEVICES, HomeKitEntity
@@ -13,7 +17,6 @@ CO2_ICON = "mdi:periodic-table-co2"
UNIT_PERCENT = "%"
UNIT_LUX = "lux"
UNIT_CO2 = "ppm"
class HomeKitHumiditySensor(HomeKitEntity):
@@ -149,7 +152,7 @@ class HomeKitCarbonDioxideSensor(HomeKitEntity):
@property
def unit_of_measurement(self):
"""Return units for the sensor."""
return UNIT_CO2
return CONCENTRATION_PARTS_PER_MILLION
def _update_carbon_dioxide_level(self, value):
self._state = value