android icon indicating copy to clipboard operation
android copied to clipboard

Send location and extended data on reconnect

Open adwuk opened this issue 3 years ago • 4 comments

This is an enhancement request:

OwnTracks does a good job of detecting when a connection to the MQTT broker has been lost (e.g. through a network change), and establishes a new connection quickly.

It would be helpful if, immediately after a new broker connection is made, the current location and extended data (if selected) were transmitted. This would allow for detecting the change of WiFi state for example, as well as triggering a remote config change.

My use case is to switch off monitoring when connected to home or work WiFi, and to switch to move monitoring when disconnected from WiFi. At the moment, even though OwnTracks handles the WiFi disconnection quickly, I cannot remote switch monitoring modes until I hear from the app that the WiFi is disconnected. I realise that this can be achieved with Tasker, but I would prefer not having the additional complexity of keeping Tasker alive and working when OwnTracks could achieve the same result without it.

App: 2.4.6 Android: 11 Device: Samsun A51 Installation source: Google Play

adwuk avatar Feb 08 '22 17:02 adwuk

Seems reasonable. Not everyone would want it (I use a broker that aggressively FIN's the connection if it doesn't get a keepalive in 60s, so I get lots of reconnects), but can put behind a toggle.

It's only really relavent in MQTT mode, so would just need to figure out how / where to put that in the UI.

growse avatar Feb 10 '22 11:02 growse

Fair point, which I hadn't considered. I am using mosquitto which, I believe, also closes connections if keep alive is not every 60s. Nevertheless, if it isn't too much hassle, it would be worth trying.

adwuk avatar Feb 10 '22 15:02 adwuk

Just thinking about the detection for this. If your actual aim is to get a message pinged when the network condition changes (e.g. Wifi), would it be better to trigger it off that, rather than using the MQTT transport as a proxy? That would then be relavent to HTTP users too.

growse avatar Aug 23 '22 12:08 growse

That makes sense. So my use case is, when a change of Wifi connection is detected an update is sent to the server. Node-red then triggers a config change (e.g. manual to significant changes monitoring) through remote config.

adwuk avatar Aug 25 '22 09:08 adwuk

Closed in #1273

growse avatar Nov 04 '22 11:11 growse