Awesome that did the deal! Any description on what this s% actually means? i saw that that in a couple of items also some other variables but didnt find a good description around it.
Seams like im going somewhere butim already hittign the next problem i created some items:
Location locationthomas “Thomas location [%s] " (loc)
String positionthomasraw “Thomas Raw Data [%s]” (loc) { mqtt=”<[mosquitto:owntracks/thomas/iPhone:state:default]" }
String thomaslatitude “Thomas’s Lat [%s]” (loc)
String thomaslongitude “Thomas’s Lon [%s]” (loc)
String thomasaccuracy “Thomas’s Accuracy [%s]” (loc)
String thomasbattery “Thomas’s [%s%%]” (loc)
and try to parse the data with this rule:
import org.openhab.core.library.types.*
rule “MqttPostionParsethomas"
when
Item positionthomasraw changed
then
val String json = (positionthomasraw.state as StringType).toString
// {”_type": “location”, “lat”: “47.5010314”, “lon”: “8.3444293”,
// “tst”: “1422616466”, “acc”: “21.05”, “batt”: “40”}
val String type = transform(“JSONPATH”, “$._type”, json)
if (type == “location”) {
val String lat = transform(“JSONPATH”, “$.lat”, json)
val String lon = transform(“JSONPATH”, “$.lon”, json)
val String acc = transform(“JSONPATH”, “$.acc”, json)
val String batt = transform(“JSONPATH”, “$.batt”, json)
thomaslatitude.postUpdate(lat)
thomaslongitude.postUpdate(lon)
locationthomas.postUpdate(new PointType(lat + "," + lon))
thomasaccuracy.postUpdate(new DecimalType(acc))
thomasbattery.postUpdate(new PercentType(batt))
}
end
works partialy i can see the items thomaslatitude and thomaslongitude being updated.
however thomasbattery, thomasaccuracy and thomaslocation are not being displayed in the sitemap sitemap:
Frame {
Group item=loc {
Switch item=presence_thomas
Text item=positionthomasraw
Text item=locationthomas
Text item=thomaslatitude
Text item=thomaslongitude
Text item=thomasaccuracy
Text item=thomasbattery
My end target is displaying my location on a googlemap within the sitemap and im using prebuild parts for it. But iirst would like to solve the problem with accuracy and battery