My cat away last week, thankfully we found her. I am now hoping to triangulate her location via the tile tracker in her collar. As it will help me prevent her from escaping unnoticed again. Any help would be much appreciated!
Issue: I have set up three ESPresence sensors that work great but only provide me with a sensor that tell the distance from the tile (beacon) to the nearest ESPresence (base station).
Goal: Get a single sensor with distances from each base station the beacon is.
I asked help from a family member who knows Python very well but doesn’t know HA. He helped me alter the script from the first link to get the following:
import requests
def print_response(state = ‘unknown’):
print'{"state": "%s", "attributes": {"unit_of_measurement": "m", "friendly_name": "Tango Mango"}}' % state
#retrieve the data
response = requests.get('http://192.168.0.27/json/devices')
if response is None:
print_response()
return
#if no data
data = response.json()
if data is None:
print_response()
return
#check data for tile distance
for device in data.get('devices', {}):
if device.get('mac', '') == 'dec2f1061282':
distance = device.get('distance', '')
if distance != '':
print_response(distance)
return
print_response()
We formatted the output based on the information in the HTTP sensor documentation but I now think that it should output a hass variable as noted in the Python Scripts documentation and as shown in the second forum post I linked.
Any assistance in altering my script to output a sensor with distances from each base station would be greatly appreciated.
I dont know if you considered this but, i did something similar with my dog but instead of tracking distance which can be hit and miss. Instead i just use presense in general. I have a base station on each porch and if she goes from one room to the porch and then ‘away’ it sends me a notification that she may have escaped… distance can be difficult because the zone is a circular radius around the beacon and you cant reallydo directions.
I have given that some thought but I also want to know the direction my cat is heading. I can put a beacon by the door but I also want at least one more to tell me if she went through the door or back inside the house.
I get ya. I wouldnt say its impossible, but i thnk it will be difficult using distance. I have been playing with this repo as well as espresence. I like both, espresence is simple and works but, additional options or uses for the boaed are limited. This BT repo does a pretty good job showing distance and i can request BT devices battery level or any other esphome functions.
The one issue i havnt quite worked out is interference like walls and such, they throw the distance reading off a good amount. If you can position them where interference wont be an issue, this may work good for you.
I would just try both honestly. Like i said, i like things avout each. You may be able to find some good non-esphome repos too. Straight C++ like from Arduino. The only problem there is youd have to send your distance data to esphome via mqtt or something else.
Ive been playing with this card in HA to display BT beacons. I can send you the info if you want it.
Tells you the room and distance. Its pretty cool.
I was just gonna say, the person that runs blueCharmBeacons is pretty active on here and makes good BLE beacons but, last i checked they only ship within the US. Theyre really good and personally i like them better than Tile.