From 430e85bd05d1e04e15773da17e37a55be03ec8c9 Mon Sep 17 00:00:00 2001 From: Necroneco Date: Sun, 14 Jul 2024 21:50:07 +0800 Subject: [PATCH] use UnitOfConductivity.MICROSIEMENS --- .../xiaomi_gateway3/hass/entity_description.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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