feat: NUT (Network UPS Tools) service provider + provider-agnostic UI
Add full NUT support as a polling-based service provider: - Async TCP client for upsd protocol (port 3493, configurable) - 8 event types: online, on_battery, low_battery, battery_restored, comms_lost, comms_restored, replace_battery, overload - 3 bot commands: /status, /devices, /battery - 38 Jinja2 templates (EN+RU notification + command templates) - Database: tracking config fields, migration, seeds - Frontend: provider form with host/port/credentials, grid items, i18n Provider-agnostic UI improvements: - Remove hardcoded 'immich' defaults from all config forms - Dynamic collection labels per provider type (Albums/Repos/Boards/UPS Devices) - Capability-driven test types instead of provider type checks - Template variable helpers for all providers (was Immich-only) - Guard Immich-only shared link check to Immich providers - Auto-clear stale global provider filter from localStorage - EntitySelect search placeholder shows current selection - Fix noneLabel in linked target config selectors New CLAUDE.md rule #8: no provider-specific hardcoding
This commit is contained in:
@@ -151,6 +151,7 @@ async def _seed_default_templates() -> None:
|
||||
await _seed_provider_template(session, "gitea", "Gitea")
|
||||
await _seed_provider_template(session, "planka", "Planka")
|
||||
await _seed_provider_template(session, "scheduler", "Scheduler")
|
||||
await _seed_provider_template(session, "nut", "NUT")
|
||||
await session.commit()
|
||||
|
||||
|
||||
@@ -171,6 +172,9 @@ async def _seed_default_command_templates() -> None:
|
||||
await _seed_provider_command_template(
|
||||
session, "planka", "Default Planka Commands", "Default Planka command templates",
|
||||
)
|
||||
await _seed_provider_command_template(
|
||||
session, "nut", "Default NUT Commands", "Default NUT command templates",
|
||||
)
|
||||
await session.commit()
|
||||
|
||||
|
||||
@@ -221,6 +225,18 @@ async def _seed_default_tracking_configs() -> None:
|
||||
"name": "Default Scheduler",
|
||||
"track_scheduled_message": True,
|
||||
},
|
||||
{
|
||||
"provider_type": "nut",
|
||||
"name": "Default NUT",
|
||||
"track_ups_online": True,
|
||||
"track_ups_on_battery": True,
|
||||
"track_ups_low_battery": True,
|
||||
"track_ups_battery_restored": True,
|
||||
"track_ups_comms_lost": True,
|
||||
"track_ups_comms_restored": True,
|
||||
"track_ups_replace_battery": True,
|
||||
"track_ups_overload": True,
|
||||
},
|
||||
]
|
||||
|
||||
for cfg in defaults:
|
||||
@@ -279,6 +295,16 @@ async def _seed_default_command_configs() -> None:
|
||||
"default_count": 10,
|
||||
"rate_limits": {"api": 15, "default": 10},
|
||||
},
|
||||
{
|
||||
"provider_type": "nut",
|
||||
"name": "Default NUT",
|
||||
"enabled_commands": [
|
||||
"help", "status", "devices", "battery",
|
||||
],
|
||||
"response_mode": "text",
|
||||
"default_count": 5,
|
||||
"rate_limits": {"api": 15, "default": 10},
|
||||
},
|
||||
]
|
||||
|
||||
for cfg in defaults:
|
||||
|
||||
Reference in New Issue
Block a user