From 2ba0c814bc99d4fac61e3a4af5a3c40ee40a7931 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 23 Oct 2024 15:24:01 -0700 Subject: [PATCH] Fix on/off when setting level --- circuitmatter/__init__.py | 2 +- circuitmatter/device_types/lighting/dimmable.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/circuitmatter/__init__.py b/circuitmatter/__init__.py index fce4214..a2f4a44 100644 --- a/circuitmatter/__init__.py +++ b/circuitmatter/__init__.py @@ -15,7 +15,7 @@ from .subscription import Subscription from .device_types.utility.root_node import RootNode -__version__ = "0.3.0" +__version__ = "0.3.1" class CircuitMatter: diff --git a/circuitmatter/device_types/lighting/dimmable.py b/circuitmatter/device_types/lighting/dimmable.py index fbacb37..9ae772e 100644 --- a/circuitmatter/device_types/lighting/dimmable.py +++ b/circuitmatter/device_types/lighting/dimmable.py @@ -24,6 +24,10 @@ def _move_to_level_with_on_off(self, session, value): except Exception as e: print(f"Error setting brightness: {e}") return + if self._level_control.min_level == value.Level: + self._on_off.OnOff = False + else: + self._on_off.OnOff = True self._level_control.CurrentLevel = value.Level @property