From bb800e310befd1a672ab25abb0a3371490175889 Mon Sep 17 00:00:00 2001 From: Dusan Cervenka Date: Sat, 3 Feb 2024 14:09:00 +0100 Subject: [PATCH 1/3] ERROR: AttributeError: 'TridonicDALIUSBNoResponse' object has no attribute 'value' It looks like the dali device is not able to return physical minimum value some amount of time when it is turned on. It looks like variable is not used anyway so i bypassed it for now Signed-off-by: Dusan Cervenka --- dali2mqtt/lamp.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dali2mqtt/lamp.py b/dali2mqtt/lamp.py index 272948d..08519c3 100644 --- a/dali2mqtt/lamp.py +++ b/dali2mqtt/lamp.py @@ -39,15 +39,19 @@ def __init__( self.device_name = slugify(friendly_name) - self.min_physical_level = driver.send( - gear.QueryPhysicalMinimum(short_address) - ).value + logger.setLevel(ALL_SUPPORTED_LOG_LEVELS[log_level]) + + _min_physical_level = driver.send(gear.QueryPhysicalMinimum(short_address)) + + try: + self.min_physical_level = _min_physical_level.value + except Exception as err: + self.min_physical_level = None + logger.warning(f"Set min_physical_level to None as {_min_physical_level} doesn't have value attribute.") self.min_level = driver.send(gear.QueryMinLevel(short_address)).value self.max_level = driver.send(gear.QueryMaxLevel(short_address)).value self.level = driver.send(gear.QueryActualLevel(short_address)).value - logger.setLevel(ALL_SUPPORTED_LOG_LEVELS[log_level]) - def gen_ha_config(self, mqtt_base_topic): """Generate a automatic configuration for Home Assistant.""" json_config = { From c7d4c7471f01f880b4d7ec7c581f7359f8b8dc06 Mon Sep 17 00:00:00 2001 From: Diogo Gomes Date: Sat, 3 Feb 2024 16:48:28 +0000 Subject: [PATCH 2/3] Update dali2mqtt/lamp.py --- dali2mqtt/lamp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dali2mqtt/lamp.py b/dali2mqtt/lamp.py index 08519c3..e572a98 100644 --- a/dali2mqtt/lamp.py +++ b/dali2mqtt/lamp.py @@ -47,7 +47,7 @@ def __init__( self.min_physical_level = _min_physical_level.value except Exception as err: self.min_physical_level = None - logger.warning(f"Set min_physical_level to None as {_min_physical_level} doesn't have value attribute.") + logger.warning("Set min_physical_level to None as %s doesn't have value attribute.", _min_physical_level) self.min_level = driver.send(gear.QueryMinLevel(short_address)).value self.max_level = driver.send(gear.QueryMaxLevel(short_address)).value self.level = driver.send(gear.QueryActualLevel(short_address)).value From f055938e63c84745a9d74d57df957f7d6567c9e7 Mon Sep 17 00:00:00 2001 From: Diogo Gomes Date: Sat, 3 Feb 2024 16:51:04 +0000 Subject: [PATCH 3/3] Log err --- dali2mqtt/lamp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dali2mqtt/lamp.py b/dali2mqtt/lamp.py index e572a98..c8fd852 100644 --- a/dali2mqtt/lamp.py +++ b/dali2mqtt/lamp.py @@ -47,7 +47,7 @@ def __init__( self.min_physical_level = _min_physical_level.value except Exception as err: self.min_physical_level = None - logger.warning("Set min_physical_level to None as %s doesn't have value attribute.", _min_physical_level) + logger.warning("Set min_physical_level to None as %s failed: %s", _min_physical_level, err) self.min_level = driver.send(gear.QueryMinLevel(short_address)).value self.max_level = driver.send(gear.QueryMaxLevel(short_address)).value self.level = driver.send(gear.QueryActualLevel(short_address)).value