mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 04:58:19 -04:00
created python heater to contron the hln heater
This commit is contained in:
31
python/heater/models.py
Normal file
31
python/heater/models.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Pydantic models for heater API."""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class DeviceConfig(BaseModel):
|
||||
"""Tuya device configuration."""
|
||||
|
||||
device_id: str
|
||||
ip: str
|
||||
local_key: str
|
||||
version: float = 3.5
|
||||
|
||||
|
||||
class HeaterStatus(BaseModel):
|
||||
"""Current heater status."""
|
||||
|
||||
power: bool
|
||||
setpoint: int | None = None
|
||||
state: str | None = None # "Stop", "Heat", etc.
|
||||
error_code: int | None = None
|
||||
raw_dps: dict[str, object] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class ActionResult(BaseModel):
|
||||
"""Result of a heater action."""
|
||||
|
||||
success: bool
|
||||
action: str
|
||||
power: bool | None = None
|
||||
error: str | None = None
|
||||
Reference in New Issue
Block a user