mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-12-18 09:15:56 +01:00
17 lines
576 B
Python
17 lines
576 B
Python
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.get("parameters", {}).get("onOffStatus")
|
|
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
|