How to use distanceFrom on Raspberry Pi (Openhabian)

I had a rule using distanceFrom on my Synology NAS installation that worked just fine.

Location Home_L0800
Number Home_N0803
Location iPhone6S_Location

rule “Distance”

Item iPhone6S_Location changed
Home_L0800.state = new PointType(new DecimalType(00.000000), new DecimalType(00.000000))

Since Openhab is no longer supported on Synology NAS I am now running openhab on a raspberry pi.
I can’t figure out how to use distanceFrom in a rule on the raspberry pi.

Can anyone give me an example please?

You’d usually be interested in the state of an Item

While that might work, it is recommended to use postUpdate
That should be a reminder that this Item is not a simple variable, and results take time.
Don’t expect to use the new state in the next line, it will not have happened yet.
You might want to look at this

Thank you very much for your answer. In the meantime I tried various things.
The line


as well as


work just fine.

What seems to be the Problem is the



Means the Line


has no impact on the state of Home_N0803.

Is there something wrong with my code?

By the way: is there something like a log file which shows errors in scripts/rules on the raspberry pi? This was very helpful to me while I was running OH on the NAS.

Yes, it’s essential that you find that. It’ll be openhab.log just as it was on the NAS, but the folder structure is a bit different.

You can’t get the distance from an Item. A general Item might represent a phone number or temperature. It just doesn’t have a distanceFrom() method.

Items do have state, though.
Some Items may have a state that represents a location or point.
You can get distance from that - the state, not the whole Item.

And of course you would need to compare with another point, not a whole Item.

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