Files
ems/db/migration/V088__seed_pool_home01.sql
Dusan Vojacek 466c15fa84
All checks were successful
CI and deploy / migration-check (push) Successful in 16s
CI and deploy / deploy (push) Successful in 1m14s
Bazén: V085→V087 (out-of-order po V086) + seed Shelly Plug S Gen3 home-01
V088: endpoint shelly_http 172.16.1.15 + asset pool-pump-1 (rated 600 W odhad
— upřesní telemetrie; 480 min/den letní filtrace; schedulable=false =
telemetry-only start, ovládání signálem POOL_PUMP_ON po ověření).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 00:14:15 +02:00

36 lines
1.5 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 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'
);