From 24ce03f8b510302650b8090453d85e2e381de6c9 Mon Sep 17 00:00:00 2001 From: David Rapan Date: Thu, 19 Dec 2024 00:13:22 +0100 Subject: [PATCH] fix: Enum and select bit lookup w/ single mode --- custom_components/solarman/common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom_components/solarman/common.py b/custom_components/solarman/common.py index 2f4fba8..6825674 100644 --- a/custom_components/solarman/common.py +++ b/custom_components/solarman/common.py @@ -214,6 +214,9 @@ def lookup_value(value, dictionary): for o in dictionary: key = from_bit_index(o["bit"]) if "bit" in o else o["key"] + if o.get("mode") == "single" and value & key == key: + key = value + if "default" in o or key == "default": default = o["value"]