2023-07-18 19:26:11 +00:00
|
|
|
from typing import Any, Dict
|
|
|
|
|
|
|
|
from pyhon.appliances.base import ApplianceBase
|
2023-10-12 14:43:41 +00:00
|
|
|
from pyhon.parameter.base import HonParameter
|
2023-07-18 19:26:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Appliance(ApplianceBase):
|
|
|
|
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
|
data = super().attributes(data)
|
2023-11-20 16:50:28 +00:00
|
|
|
parameter = data.get("parameters", {}).get("onOffStatus")
|
2023-10-12 14:43:41 +00:00
|
|
|
is_class = isinstance(parameter, HonParameter)
|
|
|
|
data["active"] = parameter.value == 1 if is_class else parameter == 1
|
2023-07-18 19:26:11 +00:00
|
|
|
return data
|
2023-10-12 14:43:41 +00:00
|
|
|
|
|
|
|
def settings(self, settings: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
|
return settings
|