How to switch off Shelly smart switches when grid power consumation exceed value? Help needed

i dont use it, but there are things like solar excess optimizer, maybe you can use something like this.

maybe relevant:
load shedding