mirror of
https://github.com/fmtr/haco.git
synced 2026-10-26 19:01:51 -04:00
31 lines
556 B
Python
31 lines
556 B
Python
from dataclasses import dataclass
|
|
|
|
from haco.control import Control
|
|
|
|
|
|
@dataclass(kw_only=True)
|
|
class Switch(Control):
|
|
"""
|
|
|
|
A switch control that can be toggled on or off.
|
|
|
|
"""
|
|
DATA = dict(
|
|
platform='switch'
|
|
)
|
|
|
|
def command(self, value: bool) -> bool:
|
|
"""
|
|
|
|
Handle toggle commands from Home Assistant.
|
|
|
|
"""
|
|
raise NotImplementedError()
|
|
|
|
def state(self, value: bool | None) -> bool:
|
|
"""
|
|
|
|
Return the current state of the switch.
|
|
|
|
"""
|
|
raise NotImplementedError()
|