Distance between location items

Hi Guys,

i want to calculate the distance between two different Location Items. A i right that i have to use a rule like this ?

https://github.com/openhab/openhab/blob/master/bundles/core/org.openhab.core.library/src/main/java/org/openhab/core/library/items/LocationItem.java

or this the definition of a location item?

in case i can use it to calc the distance what would be my two items? one would obiously the away item

Yes

I don’t understand the question or you don’t understand OH. You would define two Location Items and they will be populated somehow (Own Tracks?). In a rule you then use:

val distanceM = (myLocation1 as LocationItem).distanceFrom(myLocation2 as LocationItem)
2 Likes

Oh didnt know that it would be that simple. thanks a lot