first of all I’m new to openHAB. I’ve managed to get it running and setting up the first items/things/… however they are called. During the initial setup I had to enter the location for this installation.
I’ve already created an OpenWeatherMap thing for my account there. But when I’m going to create (sub)things of it, I’m always asked to enter a location but I don’t find a way to say: “Use the default location I’ve entered during set up!”
Is there any way to use this location setting?
If not - and that’s a strange thing that should be corrected/enhanced - is there any chance to create a default location that can be used for other items/things/… requiring a location?
But at this time. I don’t think binding authors have access to that, or if they do not all binding authors take advantage of it.
I know this has been asked for and worked on in the past. I don’t know what came off it though, whether there was some intractable technical issue to make it available, or is shady been made available but binding authors don’t use it yet.
In fact, there are some Bindings, which can use the location, but some other don’t, because the location is based on the coordinates, while e.g. the weather thing asks for regions or cities, and while it should be possible to get the correct region and city from the coordinates, it may vary how to set the name correctly.
OpenWeatherMap e.g. is using coordinates, they can be entered directly or by clicking through a map, that’s not a problem. And it’s probably also not a problem if the locations of various things differ by a few meters but I like consistency.
I’ve created an “House” item of type location but I don’t find a way to assign coordinates to it …
And then probably the next problem will be how to use this item in things requiring coordinates?
Make a feature request. I once had a discussion with our main UI developer he showed me how to retrieve it you can probably find it if you search old issues of openhab-webui.
But it was no general solution that would also work in rules DSL and others.
I’d request a “system” type of channel so we easily get the data into items.
But while it’s perfectly possible to get the information:
rule "get location"
when
Time cron "1 2/15 * * * ?" or // read once every 15 minutes
System started
then
createTimer(now.plusSeconds(10), [|
val header = newHashMap("Authorization" -> "Bearer <here insert the token to use>",
"WWW-Authenticate" -> "Basic")
val json = sendHttpGetRequest("http://openhabian:8080/rest/services/org.openhab.i18n/config",header,5000)
val theLocation = transform("JSONPATH","$.location",json)
logInfo("location","Location is {}",theLocation)
])
end
it seems to be a bit… err… complex… to get a more or less static information