Don't forget to account for the additional battery wear from extra charging and discharging. However your cost saving probably exceeds the wear cost.