That’s how it works for us here in Australia. We have 16Wh of solar and 40KWh of battery, and pay (and receive) wholesale rates for electricity. During the say electricity prices are very low or negative, and we run off the solar and charge the car then. In the evenings when demand is high electricity prices can spike, and our system will automatically sell to the grid then. Sometimes we may need to draw from the grid in the early morning to make up for that, but the price we pay then is insignificant compared to what we make selling the day before.