Google Map

Unfortunately I do not know why it does not work in HABDroid - as I use web UI only. The center of the map should be set in function “initializeMap”:

        function initializeMap() {
            // Get home location from openHAB ...
            var location = GetOpenHABItemState("ItemLocationHome");
            // Convert to google data type ...
            var locationHome = new google.maps.LatLng(
                parseFloat(location.split(',')[0]),
                parseFloat(location.split(',')[1]));

            // create map (centered @ home) ...
            map = new google.maps.Map(document.getElementById('map'), {
                center: locationHome,
                mapTypeId: google.maps.MapTypeId.TERRAIN,
                zoom: 10
            });

For the auto-zoom the bounds are important; check that they are set and updated when you add markers (as in the example). The last line of the init map then should set the zoom:

map.fitBounds(bounds);

At the moment the map does not yet auto refresh; you can consider to add a meta to the html to automatically refresh:

<meta http-equiv=”refresh” content=”60" />

with kind regards,
Patrik

1 Like