mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-22 03:49:18 +02:00
Add separate power/energy URLs and multipliers for REST smart plugs (#472)
REST/Webhook smart plugs can now fetch power and energy data from individual URLs instead of requiring all values in a single status response. Each value falls back to the shared Status URL when no separate URL is set, preserving backward compatibility. Added power and energy multipliers for unit conversion (e.g. 0.001 for Wh→kWh).
This commit is contained in:
@@ -1610,6 +1610,24 @@ async def run_migrations(conn):
|
||||
except OperationalError:
|
||||
pass # Already applied
|
||||
|
||||
# Migration: Add separate REST power/energy URLs and multipliers
|
||||
try:
|
||||
await conn.execute(text("ALTER TABLE smart_plugs ADD COLUMN rest_power_url VARCHAR(500)"))
|
||||
except OperationalError:
|
||||
pass # Already applied
|
||||
try:
|
||||
await conn.execute(text("ALTER TABLE smart_plugs ADD COLUMN rest_power_multiplier REAL DEFAULT 1.0"))
|
||||
except OperationalError:
|
||||
pass # Already applied
|
||||
try:
|
||||
await conn.execute(text("ALTER TABLE smart_plugs ADD COLUMN rest_energy_url VARCHAR(500)"))
|
||||
except OperationalError:
|
||||
pass # Already applied
|
||||
try:
|
||||
await conn.execute(text("ALTER TABLE smart_plugs ADD COLUMN rest_energy_multiplier REAL DEFAULT 1.0"))
|
||||
except OperationalError:
|
||||
pass # Already applied
|
||||
|
||||
# Migration: Add batch_id column to print_queue for batch grouping
|
||||
try:
|
||||
await conn.execute(
|
||||
|
||||
Reference in New Issue
Block a user