I want some globaly tracked Variables where to start?

I just started to Use Home Assistant and I need some pointers where to start to do some more complex things. I’m a fairly good coder, and I’m running a complex home lab, so not a newbie when it comes to tech.

One thing I want to do is to have globally tracked Variables. To give an example, I want to switch my flat into “night mode” which means that lights turn on at a minimal brightness level.

Does Homeassitant have the capabilities to keep track of global states like a certain brightness level, and how can I query these states when switching on a light, for example?

Is there a good documentation or tutorials for doing these kinds of things?

Create an Input Number helper to store the desired brightness level between 0 and 100

Turn on a light and use a template to set its brightness_pct option to the value of the Input Number.

There are several kinds of Input helpers. There are also Template Sensors and Template Binary Sensors that can report whatever you want based on your requirements.

For example, a Template Binary Sensor can report on if the current time is within the range you specify as being “night mode” (otherwise it reports off). This binary_sensor can be referenced elsewhere when determining what should be done based on whether it’s currently “night mode” or not.

I agree with the above suggestions BUT if you want more options and an accessible history of states consider this:
https://github.com/Wibias/hass-variables