From 2fc15e5f97e536d89321fe0be4a4bd0f4a8edb69 Mon Sep 17 00:00:00 2001 From: slajob Date: Sun, 3 Mar 2024 22:55:56 +0100 Subject: [PATCH] probably copy-paste error in get_blinds_by_id. The blinds tried to be an environmental sensor, but to no avail :P Also environment sensor wrong mapping as OpenCloseSensor --- custom_components/dirigera_platform/dirigera_lib_patch.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/dirigera_platform/dirigera_lib_patch.py b/custom_components/dirigera_platform/dirigera_lib_patch.py index c2b1957..78c9979 100644 --- a/custom_components/dirigera_platform/dirigera_lib_patch.py +++ b/custom_components/dirigera_platform/dirigera_lib_patch.py @@ -4,6 +4,7 @@ from dirigera.devices.open_close_sensor import OpenCloseSensor, dict_to_open_close_sensor from dirigera.devices.environment_sensor import EnvironmentSensor, dict_to_environment_sensor from dirigera.devices.air_purifier import AirPurifier, dict_to_air_purifier +from dirigera.devices.blinds import Blind, dict_to_blind from dirigera.hub.abstract_smart_home_hub import AbstractSmartHomeHub from typing import Any, Dict, List @@ -41,17 +42,17 @@ def get_open_close_by_id(self, id_: str) -> OpenCloseSensor: raise ValueError("Device is not an OpenCloseSensor") return dict_to_open_close_sensor(open_close_sensor, self) - def get_environment_sensor_by_id(self, id_: str) -> OpenCloseSensor: + def get_environment_sensor_by_id(self, id_: str) -> EnvironmentSensor: environment_sensor = self._get_device_data_by_id(id_) if environment_sensor["deviceType"] != "environmentSensor": raise ValueError("Device is not an EnvironmentSensor") return dict_to_environment_sensor(environment_sensor, self) - def get_blinds_by_id(self, id_: str) -> OpenCloseSensor: + def get_blinds_by_id(self, id_: str) -> Blind: blind_sensor = self._get_device_data_by_id(id_) if blind_sensor["deviceType"] != "blinds": raise ValueError("Device is not a Blind") - return dict_to_environment_sensor(blind_sensor, self) + return dict_to_blind(blind_sensor, self) def get_air_purifier_by_id(self, id_: str) -> AirPurifier: air_purifier_device = self._get_device_data_by_id(id_)