Waiting for events in web console

Nice! Sounds like you saved a device! I eventually want to create a “where in the US are my devices” dashboard but didn’t get around to it yet. I currently use the cell_global_identity located in the Device Vitals on my backend to determine the approximate lat/long of the cell tower it connected to. Similar to you… it’ll get me close enough for my needs. I.e. I Use this information:

"cellular":{
"radio_access_technology":"LTE"
"operator":"AT&T Wireless Inc."
"cell_global_identity":{
"mobile_country_code":310
"mobile_network_code":"410"
"location_area_code":17154
"cell_id":78364944
}

With this Python Code used on my back end that process device Vitals events:

def getLongLatitude(msg):
    jsonCellTower = {
            "cellTowers": [
                {
                "cellId": msg['data']['device']['network']['cellular']['cell_global_identity']['cell_id'],
                "locationAreaCode": msg['data']['device']['network']['cellular']['cell_global_identity']['location_area_code'],
                "mobileCountryCode": msg['data']['device']['network']['cellular']['cell_global_identity']['mobile_country_code'],
                "mobileNetworkCode": msg['data']['device']['network']['cellular']['cell_global_identity']['mobile_network_code']
                }
            ]
            }
    #Request GeoLocation (long, latitude) given cell tower data from the device.
    response = requests.post('https://www.googleapis.com/geolocation/v1/geolocate?key='+Config.GOOGLEMAPS_TOKEN, json=jsonCellTower)
    jsonLatLon = response.json()
    return jsonLatLon

Now the fun part… how can I take the Latitude, Longitude, zip code or some other type of data and plot it on an interactive map for all the devices in the product. It’s been low on the development list but eventually would be nice to show on an interactive map all the devices and where they are located. If I could make this customer facing that would be interesting and possibly even the data from the devices “public” if a user consents to it. It’s on the back burner but it’s been an idea I’ve been toying with. Would non-customers come to the site to see the data from customers, get confidence in the connectivity of a device if they see other remote areas with the device and then want to purchase a device for themselves… not sure. It’s a vague concept right now.

1 Like

@jgskarda ,

Actually, I like your approach better. I thought that Google’s Geolocation API was doing more than just giving the lat / long of the strongest cell tower but, alas, that is all they are doing and they have no plans for using triangulation:

https://issuetracker.google.com/issues/35824952

So, given this is the case, why introduce additional code?

I also would like to create a map of deployed devices and, like you, have put it on my backlog. I will let you know if I make any progress on this.

Thanks,

Chip

Yeah… if it’s a one-time thing… you can manually take the cell ID, location area code, mobile country code and mobile network code from the device vitals and paste it into here: https://www.opencellid.org/ and it’ll give you the location of the cell tower (estimated obviously). I’ve used this a few times for my curiosity and to assist a customer through a weak signal strength. By knowing what cell tower it is connecting to you can strategize other locations on the property to improve signal strength and quality. That said, I wouldn’t say the actual location of the cell tower is 100% accurate until you physically see the tower. Just another data point.

As for plotting multiple devices physical location, I’d likely first look at HighCharts… simply because I use them already to plot the data and the integration for that was fairly easy. Some quick examples of what this could look like:
https://www.highcharts.com/demo/maps/mappoint-latlon
or this:
https://www.highcharts.com/demo/maps/marker-clusters
Looks like you just feed it a JSON Array of names and Lat/Long coordinates so certainly doable.

Alright… this is all a bit off topic now. If/when I get around to it, probably better to start a new thread with that specific topic. Hopefully someday. :slight_smile:

2 Likes

@jgskarda ,

Wow, fantastic maps. I need to get over my resistance to having my own servers. I guess it would not be any different with the Google Maps API.

This is officially in the queue.

Chip