Convert Location item to Number item

Hi there,
I’ve got a Location item with Longitude and Latitude as output, e.g. 98.765432,9.876543

In a rule, I want to trigger an action as soon as the Location is in a certain area. Therefore, I need to convert the item to two number items.

Number latitude 98.765432
Number longitude 9.876543

I was unsuccessful in searching for a solution online, maybe anyone can help me converting it?

Do you though? The LocationItem has a distanceFrom() method that will return how far apart two LocationItems are in meters. LocationItem (openHAB Core 3.4.0-SNAPSHOT API)

If that won’t work, the state of a LocationItem is a PointType (PointType (openHAB Core 3.4.0-SNAPSHOT API)) which has a getLatitude() and getLogitude() method (among others) including it’s own distanceFrom() method.

NOTE: The Tutorials and Examples category is a place to post a tutorial, not a place to ask for one.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.