From f8d05070016f35c0d82fb585c8cea4b579b6f80f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Seux?= Date: Sat, 9 Sep 2023 13:12:05 +0200 Subject: [PATCH] =?UTF-8?q?=E2=AC=87=20Restore=20backward=20compatibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partial revert of 3ed7acadfe1f7b076fe938c76b0b7b182c72046b Fixes #105 --- custom_components/aquarea/sensor.py | 10 ++++++++-- hacs.json | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/custom_components/aquarea/sensor.py b/custom_components/aquarea/sensor.py index bb8ef80..4901ec3 100644 --- a/custom_components/aquarea/sensor.py +++ b/custom_components/aquarea/sensor.py @@ -20,7 +20,14 @@ CONF_DEVICE_CLASS, CONF_UNIT_OF_MEASUREMENT, ) -from homeassistant.helpers.trigger_template_entity import CONF_AVAILABILITY +_LOGGER = logging.getLogger(__name__) +try: + from homeassistant.helpers.trigger_template_entity import CONF_AVAILABILITY +except: + # TODO(kamaradclimber): remove this once we stop support 2023.8 and below + _LOGGER.warn("backward compatibility mode: please update to HA 2023.9 eventually") + from homeassistant.helpers.template_entity import CONF_AVAILABILITY + from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -30,7 +37,6 @@ from .definitions import build_sensors, HeishaMonSensorEntityDescription from . import build_device_info -_LOGGER = logging.getLogger(__name__) # async_setup_platform should be defined if one wants to support config via configuration.yaml diff --git a/hacs.json b/hacs.json index 7fa7a9a..e3159c0 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { "name": "HeishaMon", "render_readme": true, - "homeassistant": "2023.9.0" + "homeassistant": "2023.2" }