Help needed for Automation with Solar

I would like to automate my PWM controlled charger as follows
(Setup is ready, everything is running so far)

I have created two sensors from my Shelly 3EM to separate the following:

Power_Import =Import from Grid
Power_Export = Exporting Power to the Grid
Dimmer = Dimmer for Charger (600W)

I would like to have the following:

“If Power_Export >50Watt increase the dimmer by 5%, then if Power_Export still above 50Watt increase further by 5% to maximum power”

“If Power Export <50 go back 5%”.

“If Power_Import >10Watt turn off dimmer”.

Entities:

  • sensor.power_import
  • sensor.power_export
  • light-esp8266_dimmer

Can someone help me with this, as I am not so fit in the automations.