2 light barriers with Shelly

I need a control unit that reliably detects when a door is crossed in one direction and then emits a sound on a HomeMatic HmIP-MP3P.

I would build the whole thing with 2 light barriers and one or 2 Shellys, but the part of how I build this in Homeassistant is still a mystery to me.

Has anyone already implemented something like this?