I don't know if you already know this, but you can get wall chargers with this functionality. They turn the charge current up and down so the car absorbs the power, which you would otherwise have sent out on the grid.
This is an example:
Solar Box - Solar Box - E-Mobility - Products
Just to clarify how this works, there is no ability for a charge point (i.e. the AC outlet that supplies the car) to turn the charge current up and down. This is physically impossible, as all charge points only contain a contactor to turn power on and off to the AC charger(s)* that are built in to the car, they do not contain any current modulation capability.
What a charge point can do is signal to the car what the maximum AC current availability is, by varying the duty cycle of the Control Pilot signal. The charger(s) in the car then have to modulate the charge current drawn so that it is always within the maximum current that's been signalled. All charge current modulation is done by the charger(s) in the car, not the charge point.
My old home made charge point used the same principle to modulate charge current, based on measurements of excess solar generation, and it sort of worked, but because of the time lag between the change in the Control Pilot duty cycle and the change in charge current drawn by the charger(s) in the car, it wasn't as effective as I would have hoped. The Tesla charger(s) seem to take several seconds to respond to a change in the maximum available current signal, so for days where excess solar generation fluctuates a bit, from passing clouds or variations in demand in the house, I found that the charger(s) weren't doing a great job of tracking.
I changed to a system where the Control Pilot only changes to a different maximum available current duty cycle when the power drawn by the charger(s) either exceeded the night time off-peak cost for more than five minutes, or when the excess generated power exceeded that being drawn by the charger(s) for five minutes. This works somewhat better, but in practice there is virtually no cost difference between modulating charge power this way and just setting a fixed low charge current. My latest home made charge point just has three low current settings, 8 A, 10 A and 12 A, in addition to both a 32 A and off-peak timed 32 A setting. I find that leaving the car charging at around 10 A when there is some excess solar generation works every bit as well as the old system of changing the max available current according to the level of excess solar generation.
* "charger(s) because the Model 3 has three chargers, contained in a module located under the rear seat. Each charger is capable of running at a maximum current of 16 A. Two of these chargers are connected together in parallel when the car is connected to a single phase charge point, giving a maximum current of 32 A, or about 7.36 kW from 230 VAC. All three chargers are used when the car is connected to a three phase charge point, giving a maximum current of 16 A per phase, or about 11.04 kW. All three chargers can modulate the charge current below the maximum, if signalled to do so from the charge point CP signal, if the BMS in the battery pack requests a reduced charge current or if the car systems request a reduced charge current.