Produce maximum as fed in yesterday

I would like to implement the following. I would like only as much electricity to be produced from solar as was fed into the power grid yesterday. After that, the inverters should be switched off. I have connected my Hoymiles inverter to HA. I measure the electricity fed in with a Shelly EM.

This forum is not ruled by an AI that will give you code based upon (approximate) requests :wink:

What did you try?
Show your existig automations.
What is blocking you?