I try to chase landed weather balloons in Germany. Since I do not have the time to check every day 4-8 times, if one has landed in my vicinity, I want Home Assistant to check for me.
I have managed to use the APRS integration to check for balloons for me. It creating a device on the existance of a balloon.
What do I need:
1st of all: I need a wildcard in the automation, since the ID is always increasing (from r2340252 to r2340253 and so on). So my automation would need something like r23402*
Then it should check if it is around 50km of my home town.
Is that possible? How can I do that? I am a little lost.
In node red it would be quite easy since you can use regex in the device names.
The hardest part is probably the calculation of distance from home.
There are examples on how to do it on wikipedia.
If I remember correctly the formula is called something like āgreat circle distanceā or something.
You will probably want to factor in altitude for completeness:
# distance on unit circle
# as is stated, multiply returned value by radius of sphere units you are using
# I use miles, so * 3956.5467
def distance_on_unit_sphere(lat1, long1, lat2, long2):
# Convert latitude and longitude to
# spherical coordinates in radians.
degrees_to_radians = math.pi/180.0
# phi = 90 - latitude
phi1 =(90.0- lat1)*degrees_to_radians
phi2 =(90.0- lat2)*degrees_to_radians
# theta = longitude
theta1 = long1*degrees_to_radians
theta2 = long2*degrees_to_radians
# Compute spherical distance from spherical coordinates.
# For two locations in spherical coordinates
# (1, theta, phi) and (1, theta, phi)
# cosine( arc length ) =
# sin phi sin phi' cos(theta-theta') + cos phi cos phi'
# distance = rho * arc length
cos =(math.sin(phi1)*math.sin(phi2)*math.cos(theta1 - theta2)+
math.cos(phi1)*math.cos(phi2))
arc = math.acos( cos )
# Remember to multiply arc by the radius of the earth
# in your favorite set of units to get length.
return arc
# end of distance_on_unit_sphere
I have a receive station for radiosondes and am exploring using MQTT to capture the data and landed on this page. I would like to integrate my data into HA.