This is becoming quite common in Finland (thanks to insanely high spot prices of electricity). Shelly is usually used to do the automation. Note that the water is not heated "hotter than necessary" but rather water is heated up to the max amount when the price is cheap.
Traditionally water heaters were only on at night.