On the contiguous-block point for the car, one implementation detail that took me a while.
Finding the cheapest window of length N in a price series is a sliding window: sum each consecutive run of N hours, keep the cheapest. It is a few lines and it runs instantly on 24 or 48 values. There is no need for anything cleverer at this scale.
The subtlety is that you usually want the cheapest window that ends before the deadline, not the cheapest window overall, and those differ often enough to matter. Filter the candidate windows by deadline before comparing them.
Also: use tomorrow's prices as soon as they are published rather than at midnight, so an evening plug-in gets the full night considered rather than only the hours after the automation happens to run.