Change location during runtime (openHAB2)

Hi everyone,

apologies if I am asking a dumb question…

I am traveling a lot, so I was thinking of having weather information and maybe astro data displayed for my CURRENT location.

I was thinking of creating a file with all possible (appr. 50) destinations I am traveling to like:
MBJ: 18.502401, -77.914524
FRA: 50.037933, 8.562152
MRU: -20.432267, 57.684116
and so on…

My first idea was to use the CalDav binding and hook it up to my nextcloud work-calendar. Thus the system would have known where I am.
Unfortunately I learned that the CalDav binding is not really working with openHAB2.

So maybe it is possible to have a drop down menu on the sitemap to choose the destination from.

But how does the dropdown menu change the coordinates in the .cfg file? Will it get updated next time the binding pulls new weather/astro data?

Is this possible at all?

likonaus

I can think of a couple of ways to do this but it is going to be a whole lot of tedious work.

So you can have a selection on your sitemap. It is designed for a few items. 50 might break it. This selection would be tied to a String Item representing your location.

Your weather config will need to include a config for all 50 locations (beware of maxing out your allotted API calls to the weather services). You cannot dynamically change the location with weather binding or HTTP binding.

Then you need to put all the weather Items for all 50 locations on your sitemap using the visibility flag to only show the set of Items that correspond with the value in the selection Item.

You would be much better off just using some weather app on your phone to tell you the weather where you are.

Ok, I think I got the message.

Thank you for your reply!

There is going to be a much simpler way soon, check out this issue.
We will provide a central system configuration property for your current location - so all you will have to do is to change that setting and your astro and weather things for “current location” will automatically update.

And if you want to make the location updates automatically through a binding, there might be some workaround for that as well.

2 Likes

Wow, that sounds exciting. Thank you for the heads up…