Complex automation for car charging

As we have only 1 phase and 32A, I would like to create a complex automation for a plug-in vehicle charging.
Any help would be welcomed:)

Could be timed running between 10 p.m. and 6 a.m.,
or it can be started manually at any time (rarely it may be needed).
Turns off after a maximum of 4 hours total daily active charging time (2:50).
It activates when the mains consumption of the house is below 16A,
switches off the hot water storage electric heating (10A),
turn on the charging socket (14A),
when the mains consumption of the house approaches 25A,
then turn off the charging socket, turn on the hot water storage (if it was turned on before),
then try this again every hour.

Components:

Mains electricity consumption of the house (Fronius Smart Meter 1 phase):
sensor.fronius_smartmeter_current_ac_phase_1

Hot water storage on/off (Drayton Wiser Smart Thermostat HubR):
button.wiser_toggle_hot_water

Status of hot water storage tank (Drayton Wiser Smart Thermostat HubR)::
sensor.wiser_hot_water_2

Charging circuit switch (Sonoff BASICZBR3):
switch.car_charger