How to create Dashboard Tile with Google Map that shows a device location

Thanks this is very helpful as I'm learning how to code with Groovy.

I will combine your code with mine and publish on Monday including adding Zoom Level as a parameter

2 Likes

You could improve the map type selection with an enum.

Eg.

input "mapType", "enum", title: "Select your desired map type", options: ["h":"Hybrid","k":"Satellite","n":"Normal"], defaultValue: "h"

2 Likes

New version of the driver has been posted to GitHub that contains code contributions from @kahn-hubitat and @Baz2473 along with a new Parameter to set the Zoom level of Map.

3 Likes

@kahn-hubitat Can you please provide a screen shot of your action parameter types? Using your version of the driver using the %value% for the parameter is not pulling the value of the attribute using the 5.1 rule engine e.g.

1 Like

Regarding the zoom level. if you include range: "1..21", this will prevent anyone from putting an out of range number in the input field. :+1:t3:

eg

input "MapZoomLevel", "number", range: "1..21", title: "Enter a value between 1-21 (default is 14) to set Zoom Level for Google Maps", defaultValue:14

1 Like

Need to fill in %value% then turn on variable parameter value toggle.

Great work btw guys.... Great to see this feature and dev's working well together...

2 Likes

Thanks, I've added the range to the code and posted to Github

@kahn-hubitat you lost me on this one. Can you please provide screen shots how to get %value% to work or point me to where I can read how to do it. Thanks!

Everything is.fine in your screen shots above...
Just make sure to turn on the toggle circled in red
In this screen shot.

Also the rule.will not work via testing
It needs an actual value to come in through
The trigger. That.is why it shows zero

1 Like

Thanks the trigger was the issue. As soon as I moved my car and the attribute changed the rule updated. Maybe someday the HE documentation will cover all this.

1 Like

Hi @gomce62.web
Is it possible to present multiple locations on the same map?
The request is to use this driver with the Life 360 integration (that expose the latitude and longitude for each member into a dedicated device) and see all my family members on the same map.
Thanks,

This would require a lot of custom coding of the driver to pass all the required attributes to Google Maps to display multiple waypoints. The current version just accepts one waypoint.

As your goal is to use Life360 I recommend you check out this thread https://community.hubitat.com/t/maps-to-show-location-of-users/74162

Good luck

So these posts are a little old and I hope people are still using this map function. It has a lot of uses in the Dashboard.

I'm trying to get to a point where I can simply look at my dashboard in the morning on my way out the door and see the traffic from google maps on my route to work. Is there any good way of doing this with the current driver, or would that require more coding?

The google maps iframe does not look like there's a 'traffic' layer to be enabled. Although, if you have any programming ability you could take the Google iframe driver and make your own and use the Waze traffic iFrame (I didn't do a search here, there may already be one). From a cursory view the structure is similar (provide lat/long/zoom) so converting google iframe driver should be straightforward.

@user3209 Sorry for the delay in responding. Yes it is possible to create a Dashboard that shows Google Maps traffic for a route using the iFrame Advanced community driver. All the steps are documented at: [RELEASE] iFrameAdvanced - #18 by sburke781

1 Like

@gomce62.web

Thanks for this, seems very useful.

Can anyone suggest how to use this within a sharptools dash?

image

Copying over some of our discussion from the SharpTools Community regarding this topic...


On the SharpTools side, you can use the Hubitat HTML Attribute Custom Tile to display attributes that are stuffed with HTML. The linked thread explains the what and why. :slight_smile:

While the original Hubitat Map SharpTools Custom Tile was designed around a Life360 driver, it should work with any driver which reports a latitude and longitude attribute. So I suspect you should be able to use that custom tile with this driver or any other driver which has latitude and longitude attributes.

1 Like

I'm absolutely useless with this kind of thing, I just end up flopping around in the dark.

I did take a crack at this:

image

That was using:

However, if my hubitat device's lat/long changes, I can't see this reflected in the sharptools tile unless I do a screen refresh.

Additionally, the zoom is a problem and the tile isn't clickable.

Since the questions are about the SharpTools Custom Map Tile, I responded over in the SharpTools community thread with some options so as not to hijack this thread. :slight_smile:

2 Likes