diff --git a/haco/sb3.py b/haco/sb3.py index df5bf8c..aa8c81e 100644 --- a/haco/sb3.py +++ b/haco/sb3.py @@ -5,6 +5,7 @@ from haco.client import ClientHaco from haco.climate import Climate from haco.constants import MQTT_HOST from haco.device import Device +from haco.switch import Switch async def main(): @@ -12,7 +13,9 @@ async def main(): climate_b = Climate(name="Dev Climate B", fan_modes=['a', 'b', 'c']) b1 = Button(name="Dev Button 1") - device = Device(name="Dev Device", controls=[climate_a, climate_b, b1]) + + s1 = Switch(name="Dev Switch 1") + device = Device(name="Dev Device", controls=[climate_a, climate_b, b1, s1]) client = ClientHaco(hostname=MQTT_HOST, device=device) diff --git a/haco/switch.py b/haco/switch.py index d77d875..d35d474 100644 --- a/haco/switch.py +++ b/haco/switch.py @@ -1,14 +1,15 @@ -from haco.tools import invert_bool +from dataclasses import dataclass +from typing import Literal -from haco.control import Control +from control import Control +@dataclass(kw_only=True) class Switch(Control): - NAME = 'switch' + platform: Literal["climate"] = "switch" - def __init__(self, name, icon=None): - super().__init__(name, icon=icon) + def command(self, value): + raise NotImplementedError() - @property - def control_type(self): - return invert_bool + def state(self, value): + raise NotImplementedError()