Here is the overall architecture of my most of my automations.
In order to maintain more advanced logic for your ligthing, music, temperature etc, I reccomend to use multiple layers of state as illustrated in the figure above.
Scenes represent one state of multiple devices. I typically create scenes for each room. Examples of scenes can be "Bathroom night", "Bathroom dimmed", "Bathroom normal", "Living room dimmed", "Living room TV", "Living room dinner".
Aggregated states are varaibles representing a simple value for something. Most of my aggregated states are boolean, such as "is the TV on", "is the sun outside above 30 degrees above horizon", "is someone at home", "is there someone present in the living room". Often multiple sensors are involved in updating an aggregated state, such as a combination of door sensors and motion sensors to represent presence in a room, or multiple presence devices for multiple people to represent whether or not somebody is at home. I also have a few aggregated states that are strings, and not boolean, such as the timeperiod, which can have one of a few predefined text values.
Where to store state?
Currently I am using better logic to store variables. It has the same functionality as the built-in logic, but in addition it has a card that triggers when one of a list of variables is changed. This is crucial functinoality to implement the model above. Therefore I am using better logic for now. If the buit-in logic later gets the same functionality I will switch back.