feat(activate): home-01 — notify (V111) + pool control (V112) + EV start penalty (V113)
Operační aktivace nasazených featur přes Flyway: - V111: asset_vehicle.presence_nudge_enabled=true (tesla-my) → proaktivní nudge - V112: signal_route POOL_PUMP_ON → Shelly + asset_pool_pump.schedulable=true - V113: asset_ev_charger.planner_ev_start_penalty_czk=0.5 (anti-fragmentace, laditelné) Geofence (env EV_GEOFENCE_ARRIVAL_OBS_ENABLED) si nastaví uživatel na serveru. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
38
db/migration/V112__activate_pool_control_home01.sql
Normal file
38
db/migration/V112__activate_pool_control_home01.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
-- Aktivace řízení bazénového čerpadla na home-01 (Phase 1).
|
||||
-- Kód: R__101 (fn_pool_schedule_slot / fn_pool_control_tick) + V087 (asset/telemetrie)
|
||||
-- + R__094 (fn_signal_enqueue_bool) + signal_service. Tato migrace ho operačně zapíná:
|
||||
-- 1) signal_route POOL_PUMP_ON → Shelly Gen2 RPC Switch.Set (http_rest), map_bool
|
||||
-- true/false; switch id z asset_pool_pump.shelly_switch_id. verify_readback=false
|
||||
-- (ověřuje se přes telemetry_pool_pump.is_on; readback verify lze doplnit později).
|
||||
-- 2) schedulable = true → control tick (á 15 min) řídí relé dle nejlevnějšího okna
|
||||
-- denního runtime budgetu (fn_pool_daily_runtime_min) + dump-load při sell<=0.
|
||||
-- Tím se i opraví bazálový odečet (R__003): bazén je nyní řízený + plánovaný.
|
||||
-- Idempotentní: route se vloží jen pokud ještě neexistuje.
|
||||
|
||||
insert into ems.signal_route
|
||||
(site_id, signal_code, destination_type, endpoint_id, destination_key,
|
||||
route_config_json, transform_json, verify_readback, enabled)
|
||||
select
|
||||
pp.site_id,
|
||||
'POOL_PUMP_ON',
|
||||
'http_rest',
|
||||
pp.endpoint_id,
|
||||
'pool-pump',
|
||||
jsonb_build_object(
|
||||
'method', 'GET',
|
||||
'path_template', '/rpc/Switch.Set?id=' || pp.shelly_switch_id || '&on={value}'
|
||||
),
|
||||
'{"map_bool": {"true": "true", "false": "false"}}'::jsonb,
|
||||
false,
|
||||
true
|
||||
from ems.asset_pool_pump pp
|
||||
where pp.site_id = (select id from ems.site where code = 'home-01')
|
||||
and pp.endpoint_id is not null
|
||||
and not exists (
|
||||
select 1 from ems.signal_route sr
|
||||
where sr.site_id = pp.site_id and sr.signal_code = 'POOL_PUMP_ON'
|
||||
);
|
||||
|
||||
update ems.asset_pool_pump
|
||||
set schedulable = true
|
||||
where site_id = (select id from ems.site where code = 'home-01');
|
||||
Reference in New Issue
Block a user