From 361ee6f6eee080d51a9ccf1ce519cf0a699c677f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Airy=20Andre=CC=81?= Date: Thu, 15 Feb 2024 14:03:24 +0100 Subject: [PATCH 1/2] Add unique id for the switch entities --- .../custom_components/dohome/switch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DoHome_HassAssistant_Component/custom_components/dohome/switch.py b/DoHome_HassAssistant_Component/custom_components/dohome/switch.py index c12fca8..783b800 100644 --- a/DoHome_HassAssistant_Component/custom_components/dohome/switch.py +++ b/DoHome_HassAssistant_Component/custom_components/dohome/switch.py @@ -56,6 +56,10 @@ def is_on(self): """Return true if plug is on.""" return self._state + @property + def unique_id(self): + return self._device["name"] + def turn_on(self, **kwargs): """Turn the switch on.""" self._state = True @@ -116,4 +120,4 @@ def _send_cmd(self, device, cmd, rtn_cmd): return resp else: _LOGGER.debug("Non matching response. device %s, but got %s", device["sid"], dic["dev"][8:12]) - return None \ No newline at end of file + return None From c6901fabfce25a5eedb8debfb0db6bf93cbb7fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Airy=20Andre=CC=81?= Date: Mon, 23 Dec 2024 23:30:29 +0100 Subject: [PATCH 2/2] Unit fix for HA 2025.1 --- .../custom_components/dohome/sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DoHome_HassAssistant_Component/custom_components/dohome/sensor.py b/DoHome_HassAssistant_Component/custom_components/dohome/sensor.py index 52f6ae3..d4e6f8a 100644 --- a/DoHome_HassAssistant_Component/custom_components/dohome/sensor.py +++ b/DoHome_HassAssistant_Component/custom_components/dohome/sensor.py @@ -9,7 +9,7 @@ from datetime import timedelta from homeassistant.helpers.event import track_time_interval -from homeassistant.const import TEMP_CELSIUS +from homeassistant.const import UnitOfTemperature from . import (DOHOME_GATEWAY, DoHomeDevice) @@ -84,7 +84,7 @@ def state(self): def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" if self._is_temperature and self.current_value != 100: - return TEMP_CELSIUS + return UnitOfTemperature.CELSIUS elif self._is_humidity and self.current_value != 0: return '%' elif self._is_illumination and self.current_value != -1: