rdz_ttgo_sonde icon indicating copy to clipboard operation
rdz_ttgo_sonde copied to clipboard

[feature request] Add distance to MQTT report / minimum distance

Open g3gg0 opened this issue 2 years ago • 2 comments

Hi, great piece of software, thanks a lot.

I am using MQTT also for push information for my home stuff.

Could you please add the calculated distance to the report sent via MQTT? It would also be really helpful to set a minimum distance at which MQTT packets get sent. So whenever a sonde enters e.g. a 25km bubble, my mobile will display the message.

Thanks

g3gg0 avatar Feb 03 '22 23:02 g3gg0

Interesting idea, but not sure if it is the right thing to implement on the TTGO (where code space in scarce).

Would it not be easier to have such functionality implemented elsewhere in the network, like in a simple client that subscribes to the MQTT messages and creates alerts based on distance?

dl9rdz avatar Feb 03 '22 23:02 dl9rdz

Hi, I agree to DL9RDZ and ressoucres on TTGO are very rare. To read distance from MQTT is about the same effort than additionally calculate the current distance from actual position (and use it for other nice things like a messenger bot for notification),

On your client side you can simply subscribe to the messages like in my JS example:

function onConnect() { client.subscribe('rdz_sonde_server/packet'); };

The parse the message by a second function on each message arriving:

function onMessageArrived(message) { const m = JSON.parse(message.payloadString) ... }

Now you can access m.lat and m.lon objects to use these as parameters for your distance calculation.

DL2MF avatar Feb 12 '22 21:02 DL2MF