How do I fetch the OpenHAB "Location" from runtime.cfg (org.openhab.i18n.location)?

Sorry if this is an obvious question, I’m still trying to get my feet wet on HABApp :slight_smile:

I noticed that the the scheduler for on_sun_dawn and on_sun_dusk need the location to be set (shame on me, could have read the docs first) which can be done in config.yml

On the other hand, I have the same location information already available in runtime.cfg and therefore somewhere in the live configuration of OpenHAB.

Is there a way to fetch this information from OpenHAB instead of hardcoding it in two seperate places (runtime.cfg or interactive on one side, and config.yml on the other side)? A startup rule which does this would be excellent :slight_smile:


Currently there is no easy way. You could read the value through the RestAPI and then programmatically create a new config.yml but that seems like overkill

Ah o.k., thank you. I’ll go with hardcoding in multiple places for the time being then.

Location can be requested from the serivces in the REST API:

Result looks like:

  "timezone": "Europe/Berlin",
  "variant": "POSIX",
  "language": "en",
  "location": "52.31682772120481,8.863952398300173",
  "measurementSystem": "SI",
  "region": "DE"