Hi,
Old system: OH 2.5 win10
New system: openhabian 3
*the rule works on the old system no problems at all.
The rule is location via APP gps logger on Android, I see on the map in OH that the phone moves but ITEM does not change from ON to OFF and stays stuck on ON, I checked via Fake GPS and through this the ITEM does change to OFF when I choose a fake location.
val Number DistanceArrived = 150
val Number DistanceLeft = 150
val Number AccuracyThreshold = 200
/* sapir at home */
rule "sapir at home"
when
Item distanceHomesapir received update
then
var Number distance = (distanceHomesapir.state as QuantityType<Number>).doubleValue
var Number accuracy = (accuracysapir.state as QuantityType<Number>).doubleValue
if (accuracy < AccuracyThreshold) { // do only something if the accuracy is high enough
if ((distance < DistanceArrived) && (sapirAtHome.state == OFF)) {
sendCommand(sapirAtHome,ON)
}
else if ((sapirAtHome.state == ON) && (distance > DistanceLeft)) {
sendCommand(sapirAtHome,OFF)
}
}
end