2023-07-11 16:13:22 +02:00
|
|
|
from typing import Any, Dict
|
|
|
|
|
|
|
|
from pyhon.appliances.base import ApplianceBase
|
2023-07-24 15:16:07 +02:00
|
|
|
from pyhon.parameter.base import HonParameter
|
2023-07-11 17:38:49 +02:00
|
|
|
|
2023-07-24 15:28:32 +02:00
|
|
|
|
2023-07-11 16:13:22 +02:00
|
|
|
class Appliance(ApplianceBase):
|
|
|
|
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
|
data = super().attributes(data)
|
2023-07-24 15:16:07 +02:00
|
|
|
parameter = data["parameters"]["onOffStatus"]
|
2023-07-24 15:28:32 +02:00
|
|
|
is_class = isinstance(parameter, HonParameter)
|
|
|
|
data["active"] = parameter.value == 1 if is_class else parameter == 1
|
2023-07-11 16:49:49 +02:00
|
|
|
return data
|
2023-07-24 15:28:32 +02:00
|
|
|
|
2023-07-24 15:16:07 +02:00
|
|
|
def settings(self, settings: Dict[str, Any]) -> Dict[str, Any]:
|
2023-07-24 15:28:32 +02:00
|
|
|
return settings
|