22 lines
593 B
Python
22 lines
593 B
Python
"""
|
|
Relay capability model.
|
|
A relay is essentially a simple on/off switch, like a light with only power control.
|
|
"""
|
|
|
|
from pydantic import BaseModel, Field
|
|
from typing import Literal
|
|
|
|
# Capability version
|
|
CAP_VERSION = "relay@1.0.0"
|
|
DISPLAY_NAME = "Relay"
|
|
|
|
|
|
class RelayState(BaseModel):
|
|
"""State model for relay devices (on/off only)"""
|
|
power: Literal["on", "off"] = Field(..., description="Power state: on or off")
|
|
|
|
|
|
class RelaySetPayload(BaseModel):
|
|
"""Payload for setting relay state"""
|
|
power: Literal["on", "off"] = Field(..., description="Desired power state: on or off")
|