From 293dd470793b078621373d8777a92b163997f6d6 Mon Sep 17 00:00:00 2001 From: Vadym Melnychuk Date: Mon, 24 Jul 2023 16:28:32 +0300 Subject: [PATCH] cleanup --- pyhon/appliance.py | 1 - pyhon/appliances/wh.py | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyhon/appliance.py b/pyhon/appliance.py index f401f1f..ca0cef6 100644 --- a/pyhon/appliance.py +++ b/pyhon/appliance.py @@ -13,7 +13,6 @@ from pyhon.commands import HonCommand from pyhon.parameter.base import HonParameter from pyhon.parameter.enum import HonParameterEnum from pyhon.parameter.range import HonParameterRange -from pyhon.parameter.fixed import HonParameterFixed from pyhon.typedefs import Parameter if TYPE_CHECKING: diff --git a/pyhon/appliances/wh.py b/pyhon/appliances/wh.py index a3cee95..7e92ca8 100644 --- a/pyhon/appliances/wh.py +++ b/pyhon/appliances/wh.py @@ -3,13 +3,14 @@ from typing import Any, Dict from pyhon.appliances.base import ApplianceBase from pyhon.parameter.base import HonParameter + class Appliance(ApplianceBase): def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]: data = super().attributes(data) parameter = data["parameters"]["onOffStatus"] - data["active"] = parameter.value == 1 if isinstance(parameter, HonParameter) else parameter == 1 - + is_class = isinstance(parameter, HonParameter) + data["active"] = parameter.value == 1 if is_class else parameter == 1 return data - + def settings(self, settings: Dict[str, Any]) -> Dict[str, Any]: - return settings \ No newline at end of file + return settings