Foxess_modbusfoxess_modbus automation with smart meter

Good morning
looking (since i do not have CT clamp)
to use this to automate force discharge
ie every 6 secs (from my meter which is set up in HA)
where it reads the value if it is positive(importing) then set the force discharge to that exact amount (plus current out put calc)
Any thoughts on how to do it