mirror of
https://github.com/fmtr/haco.git
synced 2026-10-26 19:01:51 -04:00
30 lines
541 B
Python
30 lines
541 B
Python
from typing import ClassVar
|
|
|
|
from haco.control import Control
|
|
|
|
|
|
class Switch(Control):
|
|
"""
|
|
|
|
A switch control that can be toggled on or off.
|
|
|
|
"""
|
|
DATA: ClassVar[dict] = 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()
|