This commit is contained in:
Home Assistant Version Control
2026-08-20 15:12:02 +00:00
parent 520c6f5bb2
commit 33669f8f1e
7 changed files with 41 additions and 31 deletions
+12 -2
View File
@@ -23,11 +23,21 @@ from homeassistant.const import (
Platform,
UnitOfEnergy,
UnitOfPower,
UnitOfRatio,
UnitOfSoundPressure,
UnitOfTemperature,
__short_version__ as current_version,
)
# This is to add backward compatibility
try:
from homeassistant.const import UnitOfRatio
_PARTS_PER_MILLION = UnitOfRatio.PARTS_PER_MILLION
except ImportError:
from homeassistant.const import CONCENTRATION_PARTS_PER_MILLION
_PARTS_PER_MILLION = CONCENTRATION_PARTS_PER_MILLION
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.debounce import Debouncer
@@ -271,7 +281,7 @@ class Co2Sensor(HiloEntity, SensorEntity):
"""Define a Co2 sensor entity."""
_attr_device_class = SensorDeviceClass.CO2
_attr_native_unit_of_measurement = UnitOfRatio.PARTS_PER_MILLION
_attr_native_unit_of_measurement = _PARTS_PER_MILLION
_attr_state_class = SensorStateClass.MEASUREMENT
def __init__(self, hilo, device):