For context, I have cheap electricity between 23:30 and 05:30 every day.
I want to create an automation that switches on my electric heater when the temperature drops below 19C only between 23:30 and 05:30. It must switch off when the temperature reaches 21C.
The temperature sensor and the smart switch to control the electric heater are both connected to HA.