pi_dashboard.models

Pydantic models for the server.

Functions

current_timestamp_int()

Get the current Unix timestamp as an integer.

Classes

DashboardDatabaseConfig(**data)

Configuration for the database.

DatabaseAction(*values)

Enumeration for note actions.

DockerContainer(**data)

Model representing a Docker container.

DockerContainerActionResponse(**data)

Response model for container actions (start/stop/restart/update).

DockerContainerListResponse(**data)

Response model for listing containers.

DockerContainerLogsResponse(**data)

Response model for container logs.

GetSystemInfoResponse(**data)

Response model for system information.

GetSystemMetricsHistoryRequest(**data)

Request model for system metrics history.

GetSystemMetricsHistoryResponse(**data)

Response model for system metrics history.

GetSystemMetricsResponse(**data)

Response model for system metrics.

MetricsConfig(**data)

Configuration model for system metrics collection.

NoteEntry(**data)

Model representing a single note entry.

NotesActionRequest(**data)

Request model for performing a note action.

NotesActionResponse(**data)

Response model for note actions (create/update/delete).

NotesListResponse(**data)

Response model for listing notes.

PiDashboardConfig(**data)

Configuration model for the Pi Dashboard server.

SystemInfo(**data)

Model representing system information.

SystemMetrics(**data)

Model representing system metrics.

class pi_dashboard.models.DashboardDatabaseConfig(**data)[source]

Configuration for the database.

metrics_db_filename: str
metrics_lifetime_days: int
notes_db_filename: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.MetricsConfig(**data)[source]

Configuration model for system metrics collection.

collection_interval: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.PiDashboardConfig(**data)[source]

Configuration model for the Pi Dashboard server.

db: DashboardDatabaseConfig
metrics: MetricsConfig
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

pi_dashboard.models.current_timestamp_int()[source]

Get the current Unix timestamp as an integer.

Return int:

The current Unix timestamp

Return type:

int

class pi_dashboard.models.DatabaseAction(*values)[source]

Enumeration for note actions.

CREATE = 'create'
UPDATE = 'update'
DELETE = 'delete'
class pi_dashboard.models.SystemInfo(**data)[source]

Model representing system information.

hostname: str
system: str
release: str
version: str
machine: str
memory_total: float
disk_total: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.SystemMetrics(**data)[source]

Model representing system metrics.

id: int | None
cpu_usage: float
memory_usage: float
disk_usage: float
uptime: int
temperature: float
timestamp: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.NoteEntry(**data)[source]

Model representing a single note entry.

id: int | None
title: str
content: str
time_created: int
time_updated: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.DockerContainer(**data)[source]

Model representing a Docker container.

container_id: str
name: str
image: str
status: Literal['running', 'stopped', 'restarting', 'exited', 'paused', 'dead']
port: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.GetSystemInfoResponse(**data)[source]

Response model for system information.

info: SystemInfo
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.GetSystemMetricsResponse(**data)[source]

Response model for system metrics.

metrics: SystemMetrics
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.GetSystemMetricsHistoryResponse(**data)[source]

Response model for system metrics history.

history: list[SystemMetrics]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.NotesListResponse(**data)[source]

Response model for listing notes.

notes: list[NoteEntry]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.NotesActionResponse(**data)[source]

Response model for note actions (create/update/delete).

note_id: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.DockerContainerListResponse(**data)[source]

Response model for listing containers.

containers: list[DockerContainer]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.DockerContainerActionResponse(**data)[source]

Response model for container actions (start/stop/restart/update).

container_id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.DockerContainerLogsResponse(**data)[source]

Response model for container logs.

container_id: str
logs: list[str]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.GetSystemMetricsHistoryRequest(**data)[source]

Request model for system metrics history.

last_n_seconds: int
max_data_points: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class pi_dashboard.models.NotesActionRequest(**data)[source]

Request model for performing a note action.

action: DatabaseAction
note: NoteEntry
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].