Welcome.
As it is a general how do I do this and not such a specific issue or multiple I will give some ideas.
In my system I use time of day rules to know when to do things.
This can act to help you adapt your system during the day.
Create a string item named something like
// To track mode of Heating Acceptable modes are - night absent auto off overide
String Heating_MODE
Next you have to make sure that when oh starts it is put in to a mode and not null. Eater setup a rule or install persistence on the item.
Now that you have an item to manipulate you need to thing of all the conditions you want met to change the string.
eg when the string is override and it is midnight change to auto or night.