Finding your hotspot neighbors with python

I’m starting to share some of my API code in helium_block_scraper. First up is a way to see hotspots near you- including their distance in miles.

Grab the repo, or here are some basic steps if that’s above your comfort level:

pip3 install requirements geopy
python3 your-hotspot-name

For instance:

$ python3 Mean Alabaster Piranha
normalized name: mean-alabaster-piranha
dist score name
11.4    18 Electric Pickle Marmot
11.8    25 Electric Banana Lynx
 8.5    12 Bent Corduroy Tortoise
 8.3    43 Clean Lava Sheep
29.2    25 Long Zinc Aardvark
24.9    25 Tall Raisin Hyena
 1.2    94 Icy Purple Porpoise

Great! Do you have a code snippet for determining if a nearby hotspot has directly exchanged a packet with your hotspot?

The easiest way to do this right now is by examining witness data via the API. The API call looks like this:<gateway_address>

This will give you a list of Hotspots that have witnessed packets from the target hotspot (called gateway in the API), along with the RSSIs of those packets, the number of times they have been witnessed at a given RSSI, and a few other things.

For example:

produces data like the following:

{"address":"112tZNnHJt61zCU5hkyJdsKxt8Qr5KtyGwGU1oVcFdsT7j96WNB4","first_time":1571451804618356476,"hist":{"-132":0,"-123":0,"-114":71,"-105":36,"-96":0,"-87":0,"-79":0,"-70":0,"-61":0,"-52":0,"28":0},"name":"Slow Flaxen Locust","recent_time":1573795857104187306}

I just pushed an update to the repo that does this. Here’s the sample output:

hotspot name         count  recent time
Clumsy Peanut Wasp       8  2019-11-20T02:03:26.858747
Powerful Daisy Rat       1  2019-11-18T22:26:18.660485

I had it locally but things were hardcoded to my address.

Thanks! (This note has to be 20 char…