From 3f085918a3b08db9c739171f7ee4418b8b60c34a Mon Sep 17 00:00:00 2001 From: slajob Date: Thu, 29 Feb 2024 23:56:43 +0100 Subject: [PATCH 1/4] fixed position read. Property is not callable. TODO: position = int kwargs['set_target_level']) key error. Check what key is right one. --- custom_components/dirigera_platform/cover.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/custom_components/dirigera_platform/cover.py b/custom_components/dirigera_platform/cover.py index 14859f9..ac88e9c 100644 --- a/custom_components/dirigera_platform/cover.py +++ b/custom_components/dirigera_platform/cover.py @@ -85,26 +85,26 @@ def target_cover_position(self): @property def is_closed(self): - if self.current_cover_position() is None: + if self.current_cover_position is None: return False - return self.current_cover_position() == 100 + return self.current_cover_position == 100 @property def is_closing(self): - if self.current_cover_position() is None or self.target_cover_position() is False: + if self.current_cover_position is None or self.target_cover_position is False: return False - if self.current_cover_position() != 100 and self.target_cover_position() == 100: + if self.current_cover_position != 100 and self.target_cover_position == 100: return True return False @property def is_opening(self): - if self.current_cover_position() is None or self.target_cover_position() is False: + if self.current_cover_position is None or self.target_cover_position is False: return False - if self.current_cover_position() != 0 and self.target_cover_position() == 0: + if self.current_cover_position != 0 and self.target_cover_position == 0: return True return False @@ -116,7 +116,7 @@ def close_cover(self, **kwargs): self._json_data.set_target_position(100) def set_cover_position(self, **kwargs): - position = int(kwargs[0]) + position = int(kwargs['set_target_level']) if position >= 0 and position <= 100: self._json_data.set_target_position(position) From 5126569ae979c93be90dfd69126e5b9bed44ed00 Mon Sep 17 00:00:00 2001 From: slajob Date: Fri, 1 Mar 2024 00:19:00 +0100 Subject: [PATCH 2/4] find right key --- custom_components/dirigera_platform/cover.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/dirigera_platform/cover.py b/custom_components/dirigera_platform/cover.py index ac88e9c..368ea24 100644 --- a/custom_components/dirigera_platform/cover.py +++ b/custom_components/dirigera_platform/cover.py @@ -116,7 +116,7 @@ def close_cover(self, **kwargs): self._json_data.set_target_position(100) def set_cover_position(self, **kwargs): - position = int(kwargs['set_target_level']) + position = int(kwargs['position']) if position >= 0 and position <= 100: self._json_data.set_target_position(position) From b1056491951db004d31cdd96b4c53eb341415d6b Mon Sep 17 00:00:00 2001 From: slajob Date: Fri, 1 Mar 2024 16:35:44 +0100 Subject: [PATCH 3/4] Wrong attribute name: set_target_position -> set_target_level --- custom_components/dirigera_platform/cover.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/dirigera_platform/cover.py b/custom_components/dirigera_platform/cover.py index 368ea24..501ba31 100644 --- a/custom_components/dirigera_platform/cover.py +++ b/custom_components/dirigera_platform/cover.py @@ -118,7 +118,7 @@ def close_cover(self, **kwargs): def set_cover_position(self, **kwargs): position = int(kwargs['position']) if position >= 0 and position <= 100: - self._json_data.set_target_position(position) + self._json_data.set_target_level(position) def update(self): logger.debug("cover update...") From abc2c90580dd848adf05f0dafbd19276bb108399 Mon Sep 17 00:00:00 2001 From: slajob Date: Fri, 1 Mar 2024 16:39:24 +0100 Subject: [PATCH 4/4] open and close cover fix --- custom_components/dirigera_platform/cover.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/dirigera_platform/cover.py b/custom_components/dirigera_platform/cover.py index 501ba31..0b5d58d 100644 --- a/custom_components/dirigera_platform/cover.py +++ b/custom_components/dirigera_platform/cover.py @@ -110,10 +110,10 @@ def is_opening(self): return False def open_cover(self, **kwargs): - self._json_data.set_target_position(0) + self._json_data.set_target_level(0) def close_cover(self, **kwargs): - self._json_data.set_target_position(100) + self._json_data.set_target_level(100) def set_cover_position(self, **kwargs): position = int(kwargs['position'])