Automation: trigger between 2 counters depending on sensor value

Hello Community,

I am using a Sungrow Wallbox AC011E-01, which supports different charging modes: Fastcharging and Surplus Charging. For me, it would be very interesting to have 2 different energy counters, which counts depending on the charging mode (sensor.charger_wb_charging_mode_raw - 160 for fast charging and 161 for surplus charging). For me, it would be great to see on a daily/monthly/yearly basis, how many energy was used for charging by surplus (8,2 Cent / KWh) or by fast charging (30.58 Cent / KWh).

Can anyone help me with such an automation, to get the cost for surplus charged energy and fastcharged energy.

Thanks and regards
HoBo