Idea: unify geolocation

Several bindings require a geolocation to work. Some require the system’s location (Astro) while others require any (nearby) location (Weather).

Instead of providing the same latitude and longitude over and over again, I was thinking if this could not be set globally once for the entire installation.

I have come up with these options:

  • Make these a setting that can be managed through Paper UI (much like locale)
  • Provide it through some .cfg file
  • Create a binding that determines this

The bindings or other parts of the system (Eclipse Smarthome or openHAB) could then optionally use this setting. For example,

  • if set, force its use or
  • use it as a default if not explicitly overwritten through the binding configuration

What are your thoughts?

Sounds like a good idea to me actually. I do recommend opening a discussion on this on the Eclipse SmartHome forum as if this were to be implemented, that is probably where it would occur.

Some complications I can think of:

  • how to handle situations where multiple lat/longs may be desired (e.g. multiple weather binding configs for different locations)
  • is this actually a more generic need applicable to more than just lat/long? If so maybe having a way to set reusable variables in the config files would be a better idea (e.g. define lat=XX.XXXX and in your config reference that using ${lat})
  • not sure a binding would work because this would require the bindings and/or core of OH to know to query this binding for the lat/long which I’m not sure is possible

In the short run one could implement a shell script with some sed commands to replace ${lat} with the actual lat number in the config files before OH is started.

+1 and I will comment over there then :slight_smile:

I created a new issue. You are kindly invited to discuss this over there. Please only post in the forum if you do not have and want a GitHub account.