How can I use "Location" from Configuration - System - Regional Setting in Rules?

Under Configruration Regional Settings I can set up a Location of my openHab System as Waypoint.

I would like to use this information in my Rules, like here:

rule "iPhone Home"
when
    Item iPhone_Location changed
then
    // specify your home location
    val PointType home_location  = new PointType(new DecimalType(51.0), new DecimalType(4.0))
    val PointType phone_location = iPhone_Location.state as PointType
    val int distance = phone_location.distanceFrom(home_location).intValue()
    // specify your preferred radius (in meters)
    if ( distance < 200) {
        iPhone_Home.postUpdate(ON)
        logInfo("iPhone Home", "iPhone is at home.")
    } else {
        iPhone_Home.postUpdate(OFF)
        logInfo("iPhone Home", "iPhone is away.")
    }
end

without retyping the coordinates.
How can I use the “Location” Waypoint for home_location?
Is there a systems variable or something like this?

1 Like

Not that I know of that is accessible from the rules.
This setting in the UI is accessible to the bindings but I don’t think it is accessible in the rules.

And from my point of view, this is a good candidate to file an issue in openhab/smarthome

1 Like

Does anyone know if this ever made it in to openhab3? It still seems silly that I have to make a dummy location item to hold my system location rather than use from the configuration

1 Like

Totally with you. But to be honest, I forgot to sign an issue / feature request for that.

EDIT ON

submitted a feature request

another question for you - I’m in the US so I have my system set for imperial. By default it looks like the result of “distanceFrom” function is giving me meters and when I assign to my Number:Length Item it says the result is in inches but the number is certainly the meters representation. shouldn’t openhab be handling these conversions for me?
item:
Number:Length scarletwitch_distanceFromHome

rule:
var Number distance = scarletwitch_location.distanceFrom(Home_GPS)
scarletwitch_distanceFromHome.sendCommand(distance)

Update: I see that if I change the command to include “m” at the end ie sendCommand(distance+“m”) it works fine. Shouldn’t the system automatically do the distanceFrom in the configured system measurement already? That is an openhab built function right?