diff --git a/custom_components/xiaomi_gateway3/hass/entity_description.py b/custom_components/xiaomi_gateway3/hass/entity_description.py index dcf87ca0..785a73a4 100644 --- a/custom_components/xiaomi_gateway3/hass/entity_description.py +++ b/custom_components/xiaomi_gateway3/hass/entity_description.py @@ -7,8 +7,9 @@ from homeassistant.const import ( CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER, CONCENTRATION_PARTS_PER_BILLION, - CONDUCTIVITY, LIGHT_LUX, + MAJOR_VERSION, + MINOR_VERSION, PERCENTAGE, SIGNAL_STRENGTH_DECIBELS_MILLIWATT, UnitOfElectricPotential, @@ -22,6 +23,12 @@ ) from homeassistant.helpers.entity import Entity, EntityCategory +if (MAJOR_VERSION, MINOR_VERSION) >= (2024, 7): + from homeassistant.const import UnitOfConductivity + CONDUCTIVITY = UnitOfConductivity.MICROSIEMENS +else: + from homeassistant.const import CONDUCTIVITY + from ..core.converters.base import BaseConv # just to reduce the code