mirror of
https://github.com/home-assistant/core.git
synced 2026-05-03 23:17:22 +01:00
Add and use percentage constant (#32094)
* Add and use percentage constant * Fix pylint error and broken test
This commit is contained in:
@@ -4,6 +4,7 @@ Provide a mock sensor platform.
|
||||
Call init before using it in your tests to ensure clean test data.
|
||||
"""
|
||||
import homeassistant.components.sensor as sensor
|
||||
from homeassistant.const import UNIT_PERCENTAGE
|
||||
|
||||
from tests.common import MockEntity
|
||||
|
||||
@@ -11,8 +12,8 @@ DEVICE_CLASSES = list(sensor.DEVICE_CLASSES)
|
||||
DEVICE_CLASSES.append("none")
|
||||
|
||||
UNITS_OF_MEASUREMENT = {
|
||||
sensor.DEVICE_CLASS_BATTERY: "%", # % of battery that is left
|
||||
sensor.DEVICE_CLASS_HUMIDITY: "%", # % of humidity in the air
|
||||
sensor.DEVICE_CLASS_BATTERY: UNIT_PERCENTAGE, # % of battery that is left
|
||||
sensor.DEVICE_CLASS_HUMIDITY: UNIT_PERCENTAGE, # % of humidity in the air
|
||||
sensor.DEVICE_CLASS_ILLUMINANCE: "lm", # current light level (lx/lm)
|
||||
sensor.DEVICE_CLASS_SIGNAL_STRENGTH: "dB", # signal strength (dB/dBm)
|
||||
sensor.DEVICE_CLASS_TEMPERATURE: "C", # temperature (C/F)
|
||||
|
||||
Reference in New Issue
Block a user