So, do you have any idea where I can read up on similar things?
“Template” seems to be the related “term”,
searching on that alone gives a tremendous amount of hits.
A good point to start with is the templating documentation But this is not really easy, templates are very mighty and are hugh expanding the possibilities of automations, but starting from the beginning costs a lot of time to understand how they work and how the syntax is.
It helped me a lot to look how others solved my problem, if you google for ‘homeassistant.set_location’ first link points you to the solution (i only had to adept the attribute part).