I'm trying to do what Dan shows in the tricks section: display a google map showing the GPS location posted by OwnTracks / MQTTitude. Anthony recently did it and was successful, but I'm having trouble.
https://github.com/openhab/openhab/wiki/Samples-Tricks#how-to-display-google-maps-in-a-sitemap-from-a-mqttitude-mqtt-messageI can only get it to displays a blank google map - instead of the map, I just get the gray area where the map should be, but I do see the Google Map zoom bar and the yellow guy and the navigation compass. I've narrowed the problem down to this:
String Location_Dan_Phone {mqtt="<[home:owntracks/daniel/iphone5s:state:JS(mqttitude-coordinates.js)]"}
For troubleshooting, I put the string item "
Location_Dan_Phone" on the sitemap, and it displays a "-". If I make another String Item that is just the GPS MQTT data without the JS transform, I'm able to display it in the sitemap, and it's the same text as I see from mosquitto_subing the topic shows up. So the MQTT message of the GPS is coming in OK, but something is wrong with my transform.
I wasn't certain if I created
<mqttitude-coordinates.js> the way OpenHAB likes them. I used
"nano mqttitude-coordinates.js" in
</openhab/configurations/transform>, and copy and pasted what's in Dan's tutorial:
var location = eval('(' + input + ')');
result = location.lat + "," + location.lon;
In Dan's JS transform file, the <mqttitude-coordinates.js>, how does OpenHAB interpret the .lat and .lon? <
location> was just declared a "var"...how does OH know that a var has a .lat and .lon, or even how many bytes lat and lon are? Is this structure predefined somewhere?
Maybe I'm missing this definition, maybe I was suppose to have put an addon in the addon folder that defines .lat and .lon?