Don’t bother on diff between Tasmota and custom gateway - they do the same job.
Full cycle (simplified) is following:
gateway scans the lock advertisements, and sends current state payload to integration via MQTT every second or so;
integration does use current lock state, current time and token for account (retrieved on integration setup time) to generate correct open/close payload;
integration sends payload to gateway through MQTT, and gateway connects to the lock and writes that payload;