Issue with sync_command #16
@ -13,7 +13,6 @@ from pyhon.commands import HonCommand
|
|||||||
from pyhon.parameter.base import HonParameter
|
from pyhon.parameter.base import HonParameter
|
||||||
from pyhon.parameter.enum import HonParameterEnum
|
from pyhon.parameter.enum import HonParameterEnum
|
||||||
from pyhon.parameter.range import HonParameterRange
|
from pyhon.parameter.range import HonParameterRange
|
||||||
from pyhon.parameter.fixed import HonParameterFixed
|
|
||||||
from pyhon.typedefs import Parameter
|
from pyhon.typedefs import Parameter
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -3,13 +3,14 @@ from typing import Any, Dict
|
|||||||
from pyhon.appliances.base import ApplianceBase
|
from pyhon.appliances.base import ApplianceBase
|
||||||
from pyhon.parameter.base import HonParameter
|
from pyhon.parameter.base import HonParameter
|
||||||
|
|
||||||
|
|
||||||
class Appliance(ApplianceBase):
|
class Appliance(ApplianceBase):
|
||||||
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
data = super().attributes(data)
|
data = super().attributes(data)
|
||||||
parameter = data["parameters"]["onOffStatus"]
|
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
|
return data
|
||||||
|
|
||||||
def settings(self, settings: Dict[str, Any]) -> Dict[str, Any]:
|
def settings(self, settings: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
return settings
|
return settings
|
||||||
|
Loading…
Reference in New Issue
Block a user