MQTT, Owntracks Problem

Hi guys im trying to make a combination of Owntracks, MQTT Binding and MQTTidute Binding work. I also would like to display a map with my location in my sitemap.
However im struggling to read the location via MQTT Binding so i have to solve this first.
It seems that the Binding is connected to my Browser because i can see 3 clients connected to it and there are just those three clients.

So first problem: seems that my item doesnt pick up the updates:

String positionthomasraw “Thomas Raw Data” (loc) { mqtt="<[mosquitto:owntracks/thomas/iPhone:state:default]" }

As i said seems that the binding is connected and the channel works as well (tested with mqttfx)
I try to display it in my sitemap as follows ( for troubleshooting)
Text item=positionthomasraw

when i send a location update with the owntracks app i can see it on the mqttfx client but it never appears on my sitemap.

any guesses?

You would want to add [%s] to the item’s label, to see the item’s state:

String   positionthomasraw  "Thomas Raw Data [%s]" (loc)  { mqtt="<[mosquitto:owntracks/thomas/iPhone:state:default]" }
1 Like

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"
Item positionthomasraw changed
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)

  locationthomas.postUpdate(new PointType(lat + "," + lon))
  thomasaccuracy.postUpdate(new DecimalType(acc))
  thomasbattery.postUpdate(new PercentType(batt))


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

Have a look at this:

I think these need to be Number items, since you are posting numeric updates to them.

Please look at other examples on the wiki – they will help a lot!