add type relay

This commit is contained in:
2025-11-11 10:10:22 +01:00
parent 86d1933c1f
commit 97ea853483
8 changed files with 120 additions and 5 deletions

View File

@@ -0,0 +1,21 @@
"""
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")