- Platform information:
- Hardware: Intel 4th gen i5
- OS: Ubuntu 18.04 LTS
- Java Runtime Environment: zulu-8
- openHAB version: 2.5.3
I setup a VM with a new fresh installation, added the MQTT broker and connected it to my routers MQTT server using its IP address… or so I tought. Apparently you can not use an IP address as I found this in the log:
MqttBroker connection configuration faulty: ID segment ‘10.0
.1.1’ contains invalid characters. Each segment of the ID must match the pattern [A-Za-z0-9_-]*.
You can guess why I was stumped as the input field clearly states “Hostname or IP of the broker.”
Obviously this is due to me not inputting a name as it stated: “If nothing is set, an automatic name based on the host and port will be generated.”
Problem one “solved”, but this needs a fix.
Anyway now I’m at problem two, I have OwnTracks on my phone reporting to my MQTT server on owntracks/username/devices and the following string is published:
{"_type":“location”,“acc”:16,“alt”:45,“batt”:96,“conn”:“w”,“lat”:53.2457576,“lon”:6.6573844,“tid”:“0”,“tst”:1586049211,“vac”:32,“vel”:0}
Using the “Generic MQTT Thing” I want to use its location, but the location thingy requires the following format: lat, lon, alt
If use jsonpath.com with “$.lat,lon,alt” it outputs the correct values, but the openhab.log tells me differently:
Executing the JSONPATH-transformation failed: Invalid path ’
$.lat,lon,alt’ in ‘{"_type":“location”,“acc”:16,“alt”:39,“batt”:100,“conn”:“w”,“lat”:53.2457549,“lon”:6.6573816,“tid”:“0”,“tst”:15860
52042,“vac”:128,“vel”:0}’
How would one extract the required data? Obviously outputting single values with “$.lat” works, but no map…