drop view if exists ems.vw_asset_ev_charger_modbus_poll;

create view ems.vw_asset_ev_charger_modbus_poll as
select
  ec.site_id,
  ec.id as charger_id,
  ec.code,
  se.host,
  se.port,
  se.unit_id
from ems.asset_ev_charger ec
join ems.site_endpoint se on se.id = ec.endpoint_id
where se.enabled = true
  and se.endpoint_type = 'modbus_tcp';

comment on view ems.vw_asset_ev_charger_modbus_poll is
  'Nabíječky EV s Modbus TCP pro telemetry_collector.';
