How does an integration access HA's set location?

What is the best practice for a 3rd party Home Assistant Integration to access core configuration?
In particular accessing the Lat, Lon, and Elevation we can set with set_location.

I assume there is a place to read and an event they should track for updates, but I’m not finding what I need in the docs.

SERVICE HOMEASSISTANT.SET_LOCATION

In the zone file :wink:

In hass.config. Link for documentation doesn’t seem to work but here is link to class in core code which shows what properties hass.config has and the method to call to update it.

Also shows that the event fired when config is updated is EVENT_CORE_CONFIG_UPDATE

Thanks… I am passing this info along to the Pirate Weather add-on.
Would be nice for all add-ons to default to using the location in HA config and optionally allow overriding that location as needed.

Get Location from the Home Zone in hass.config · Issue #241 · Pirate-Weather/pirate-weather-ha (github.com)

1 Like