- Platform information:
- Hardware: AMD64
- OS: ubuntu 20 running docker
- Java Runtime Environment: which java platform is used and what version
- openHAB version:2.5.5
- Issue of the topic: I’m having trouble making my openhab running in docker pickup the MQTT
This is the GPS.things file I created
Bridge mqtt:broker:GPS “MQTT Broker”
[
host=“10.1.40.9”,
port=1883,
secure=false,
clientid=“openhab”
]
Thing mqtt:topic:GPS:chris “Chris GPS” (mqtt:broker:GPS) @ “GPS”
{
Channels:
Type string : Place "Location: " [ stateTopic=“location” ]
Type number : Battery "Battery: " [ stateTopic=“batt” ]
Type number : Latitude "Lat Coordinates: " [ stateTopic=“lat” ]
Type number : Longitude "Lon Coordinates: " [ stateTopic=“lon” ]
Type number : Accuracy "Accuracy: " [stateTopic=“acc” ]
}
This is my GPS.items file I created
String Chris_Location “Chris Location: [%s]” (GPS) {mqtt="<[mqtt:broker:GPS/chris:state:JSONPATH($.locname):.*]"}
Number Chris_Batt “Chris Battery: [%]” (GPS, Battery) {mqtt="<[mqtt:broker:GPS/chris:state:JSONPATH($.batt):.*]"}
Location Chris_Loc “Chris Location [%s]” (GPS) { mqtt="<[mqtt:broker:GPS/chris:state:JS(owntracks-coordinates.js)]" }
This is the owntracks-coordinates.js file I created
var location = JSON.parse(input);
result = lat + “,” + lon;
I’ve connected to the MQTT server and I can verify that information is being received and that openhab is connecting to it
Output from the MQTT server
chris = {“acc”:50,“lon”:-00.163479,“lat”:00.0984925,“batt”: 18,“location”: Home}
*I manually changed the coordinates for my security when posting.
for the life of me I cannot figure out what I’m doing wrong that none of my items are being populated in openhab everything is coming back blank or not
Control Output in PaperUI
Chris Location: -
Chris Battery: -
For a little back story I was running this in openhabian on a raspberry pi but my SD card corrupted so I decided to move it over to a desktop running docker. Everything else is running great just having issues with this. I didn’t have issues with the script before which generates this MQTT information and obviously the MQTT is working as I can see if on the server. I’m at my wits end here. would love any insight you can give.
Chris