Automation for power limiter


Im new in and i would apreciate a litle help to create a power limiter automation.

I have 6.9KVA max from power company and sometimes with heating the power goes down due to exceding the 6.9KVA.

How can i automate HA in a way that if power suplied is over 6.9KVA , one heater socket turns off, and if still power over 6.9kva, second heater socket goes off. after 10 second if turn on again and compare values.

What did you get so far for automation?