ad4fcd1cfd
First-party plugins for Fabled Scryer (https://github.com/bvandeusen/fabledscryer). traefik: Prometheus metrics scraping, stats history, access log parsing (GeoIP optional) unifi: UniFi controller integration — WAN health, devices, clients, DPI, events ups: UPS monitoring via NUT (Network UPS Tools), Ansible shutdown automation Each plugin follows the Fabled Scryer plugin contract: setup(app), get_scheduled_tasks(), get_blueprint() index.yaml lists all three plugins in the catalog format. Populate checksum_sha256 entries once release zips are published via GitHub Releases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
1.5 KiB
Python
31 lines
1.5 KiB
Python
# plugins/ups/models.py
|
|
from __future__ import annotations
|
|
import uuid
|
|
from datetime import datetime, timezone
|
|
from sqlalchemy import Boolean, DateTime, Float, Integer, String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from fabledscryer.models.base import Base
|
|
|
|
|
|
class UpsStatus(Base):
|
|
__tablename__ = "ups_status"
|
|
|
|
id: Mapped[str] = mapped_column(
|
|
String(36), primary_key=True, default=lambda: str(uuid.uuid4())
|
|
)
|
|
scraped_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), nullable=False, default=lambda: datetime.now(timezone.utc)
|
|
)
|
|
raw_status: Mapped[str] = mapped_column(String(64), nullable=False, default="")
|
|
on_battery: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
|
low_battery: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
|
battery_charge_pct: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
battery_runtime_secs: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
|
battery_voltage: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
load_pct: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
input_voltage: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
output_voltage: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
temperature: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
model: Mapped[str | None] = mapped_column(String(128), nullable=True)
|
|
manufacturer: Mapped[str | None] = mapped_column(String(128), nullable=True)
|