From e7dfc7e3eb7b2b8aa23c51686a44de624aebb305 Mon Sep 17 00:00:00 2001 From: gvigroux Date: Tue, 18 Jun 2024 10:15:12 +0200 Subject: [PATCH] 0.7.3 --- custom_components/hon/__init__.py | 4 ++-- custom_components/hon/manifest.json | 2 +- custom_components/hon/parameter.py | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/custom_components/hon/__init__.py b/custom_components/hon/__init__.py index 8e0fa12..c99ecda 100644 --- a/custom_components/hon/__init__.py +++ b/custom_components/hon/__init__.py @@ -12,7 +12,7 @@ from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.const import ATTR_DEVICE_ID, CONF_EMAIL, CONF_PASSWORD from homeassistant.helpers import config_validation as cv -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from homeassistant.helpers import device_registry as dr @@ -54,7 +54,7 @@ def update_sensor(hass, device_id, mac, sensor_name, state): hass.states.async_set(entry.entity_id, state, inputStateObject.attributes) -async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): hon = HonConnection(hass, entry) await hon.async_authorize() diff --git a/custom_components/hon/manifest.json b/custom_components/hon/manifest.json index 693a2a3..fe64bcd 100755 --- a/custom_components/hon/manifest.json +++ b/custom_components/hon/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://github.com/gvigroux/hon", "iot_class": "cloud_polling", "issue_tracker": "https://github.com/gvigroux/hon/issues", - "version": "0.7.2" + "version": "0.7.3" } diff --git a/custom_components/hon/parameter.py b/custom_components/hon/parameter.py index da419d8..3fe9ec7 100644 --- a/custom_components/hon/parameter.py +++ b/custom_components/hon/parameter.py @@ -59,7 +59,6 @@ def __init__(self, key, attributes): self._step = int(attributes["incrementValue"]) self._default = int(attributes.get("defaultValue", self._min)) except (TypeError, ValueError): - _LOGGER.error(attributes["minimumValue"]) self._min = float(attributes["minimumValue"].replace(",",".")) self._max = float(attributes["maximumValue"].replace(",",".")) self._step = float(attributes["incrementValue"].replace(",",".")) @@ -71,7 +70,7 @@ def __repr__(self): return f"{self.__class__} (<{self.key}> [{self._min} - {self._max}])" def dump(self): - return f"{self.key}: \t\t[{self._min} - {self._max}] - Default: {self._default}" + return f"{self.key}: \t\t[{self._min} - {self._max}] - Default: {self._default} - Step: {self._step}" @property def min(self): @@ -103,7 +102,7 @@ def value(self, value): if self._min <= value <= self._max and not value % self._step: self._value = value else: - raise ValueError(f"Allowed: min {self._min} max {self._max} step {self._step}") + raise ValueError(f"Value [{value}] - Allowed: min {self._min} max {self._max} step {self._step}") class HonParameterEnum(HonParameter):