Location alias, aka "Home" "Work" etc

Tags: #<Tag:0x00007f5cad1a2140>

Hello fellow openHABians.

Could someone point me in the right direction. I’m trying to give some locations specific names:
Long, Lat = x,y -> Call it “Home”
Long, Lat = a,b -> Call it “Work”

I have tried to find answers in the forums, but have been unsuccessful. Sorry if I missed something.
Any help is, as always, greatly appreciated.

Thank you in advance.
Kind regards from Detmold, DE
David

Have a look here and here (location matching).

Thanks for pointing these out. I have seen them earlier, but couldn’t figure out how to meet my needs.

The iCloud binding is already in place, so I already see battery level, status, location, etc.
So my question is: Do I still need to implement the whole solution you pointed me towards, or can I merely rename the location information I already have, using postUpdate() ?

EDIT: OK, excuse my ignorance - I have found what I’m looking for in the documentation of the iCloud binding. Will update this with my exact solution later, for my own reference…

EDIT 2: Apparantly I can’t get it to work. What I’m asking for is a simple update of the BasicUI string for my location. Any takers?

Like this? You have to adapt the item and location names to your setup and save it in your rules file.

rule "Location Match"
when
  Item YouriPhone_Location changed
then
  val PointType location = YouriPhone_Location.state as PointType
  var int distance
  
  // my home location
  val PointType home = new PointType(new DecimalType(50.xxxxxx), new DecimalType(9.xxxxxx))
  distance = location.distanceFrom(home).intValue()
  if (distance < 200) {
    YouriPhone_LocationMatch.postUpdate(String::format("%s (%dm)", "Home", distance))
    return;
  }
  // my work location
  val PointType work = new PointType(new DecimalType(51.xxxxxx), new DecimalType(8.xxxxxx))
  distance = location.distanceFrom(work).intValue()
  if (distance < 200) {
    YouriPhone_LocationMatch.postUpdate(String::format("%s (%dm)", "Work", distance))
    return;
  }
  YouriPhone_LocationMatch.postUpdate("(on the way)")
end 

Thank you, it works now. Couldn’t figure it out before you put it together for me.