Set the Homeassistant location using a template sensor

I want to do this:

homeassistant:
  latitude: "{{ states('sensor.DecLatitude') }}"
  longitude: "{{ states('sensor.DecLongitude')  }}"

But it will not parse. Is it not possible to set the homeassistant attributes like this? Do they need to be static?

Most configuration variables do not accept templating. Those that do are marked in their integration’s Configuration Variables section with “template” as the acceptable data type instead of “string”, “integer”, “float”, etc.

https://community.home-assistant.io/search?q=RV%20zone

I think I just figured it out. Put the code into an automation…

trigger:
  - platform: time_pattern
    minutes: /10
condition: []
action:
  - service: homeassistant.set_location
    data_template:
      latitude: |
        {{ states('sensor.DecLatitude') }}
      longitude: |
        {{ states('sensor.DecLongitude') }}
mode: single

Well that’s a service I never noticed before…

Entity IDs need to be slugs… switch the upper case letters to lower case and it should be good.

It actually works.
I have seen this slugs advice before and I am slowly getting into the habit. But actually all my code works with uppercase names. Must be some situations where it is bad.