diff --git a/db/migration/V085__pool_shelly.sql b/db/migration/V087__pool_shelly.sql similarity index 100% rename from db/migration/V085__pool_shelly.sql rename to db/migration/V087__pool_shelly.sql diff --git a/db/migration/V088__seed_pool_home01.sql b/db/migration/V088__seed_pool_home01.sql new file mode 100644 index 0000000..4c6f9f5 --- /dev/null +++ b/db/migration/V088__seed_pool_home01.sql @@ -0,0 +1,35 @@ +-- Seed bazénového čerpadla home-01: Shelly Plug S Gen3 na 172.16.1.15 (VPN). +-- Telemetry-only start (schedulable=false): nejdřív měříme, ovládání signálem +-- POOL_PUMP_ON zapneme po ověření telemetrie. rated_power_w je odhad — skutečný +-- příkon ukáže telemetrie (apower), pak upřesnit. + +insert into ems.site_endpoint ( + site_id, endpoint_type, host, port, protocol, unit_id, enabled, notes +) +select s.id, 'shelly_http', '172.16.1.15', 80, 'http', null, true, + 'Shelly Plug S Gen3 – bazénové čerpadlo (Gen2+ RPC).' +from ems.site s +where s.code = 'home-01' + and not exists ( + select 1 from ems.site_endpoint se + where se.site_id = s.id and se.host = '172.16.1.15' + ); + +insert into ems.asset_pool_pump ( + site_id, code, manufacturer, model, endpoint_id, shelly_switch_id, + rated_power_w, min_run_min, daily_runtime_min, schedulable, notes +) +select + s.id, 'pool-pump-1', 'Shelly', 'Plug S Gen3', se.id, 0, + 600, -- odhad; upřesnit dle telemetrie (Shelly apower) + 15, + 480, -- 8 h/den (letní filtrace); zimní profil = follow-up + false, -- telemetry-only; ovládání po ověření + 'Bazénové čerpadlo přes Shelly Plug S Gen3. Ovládání: signal POOL_PUMP_ON (fn_signal_enqueue_bool), zatím vypnuto.' +from ems.site s +join ems.site_endpoint se on se.site_id = s.id and se.host = '172.16.1.15' +where s.code = 'home-01' + and not exists ( + select 1 from ems.asset_pool_pump p + where p.site_id = s.id and p.code = 'pool-pump-1' + );