I found example rules who to calculate the distance from home and tried to built my own one.
I get an type mismatch error on the distanceFrom method. “Cannot convert PointType to LocationItem”
All examples I have found use a PointType as argument for the distanceFrom method.
Does anyone know why this is not working (anymore)?
I am still using OH 2.5
Items: Location Timons_iPhone_Ort
rule "Anwesenheit Timon"
when
Item Timons_iPhone_Ort changed
then
val PointType gps_zuhause = new PointType(new DecimalType(48.1577637), new DecimalType(16.2796942))
var int gps_timon_entfernung_zuhause
gps_timon_entfernung_zuhause = Timons_iPhone_Ort.distanceFrom(gps_zuhause).intValue()
logInfo("Anwesenheit Timon", "Entfernung Timon {}",gps_timon_entfernung_zuhause)
}
end
end