GithubHelp home page GithubHelp logo

Comments (18)

growse avatar growse commented on June 18, 2024 3

There's a couple of showstopper bugs and at least one feature still to be sorted, but I'm plugging away at them.

from android.

snakedoctr avatar snakedoctr commented on June 18, 2024 2

Thanks @growse for fixing this! Looking forward to v2.5.0.

Thanks @jpmens for the help as well!

from android.

jpmens avatar jpmens commented on June 18, 2024

There’s something wrong with your mosquitto_pub command, IMO. First you’re missing a value for -h and for -p and second I’d use -l (read line) instead of -s (send file from stdin).

Other than that the command looks ok to me.

from android.

snakedoctr avatar snakedoctr commented on June 18, 2024

Sorry -- I forgot to escape the host and port on the post. I changed to -l and now the 00 is not appearing when I publish the message, but the app is still throwing the message failed validation error.

from android.

jpmens avatar jpmens commented on June 18, 2024

mosquitto_pub … -s is adding an additional newline (\n) to the payload, whereas -l doesn’t. I’m assuming that’s the reason Android doesn’t recognized the cmd.

from android.

jpmens avatar jpmens commented on June 18, 2024

Could you please humor me and try

printf '{"_type":"cmd","cmd":"reportLocation"}' | mosquitto_pub ... -l

(use printf i/o echo to completely avoid the newline)

from android.

snakedoctr avatar snakedoctr commented on June 18, 2024

Same thing

from android.

jpmens avatar jpmens commented on June 18, 2024

Is allowRemoteLocation enabled (true) in your settings? (Use the configuration editor to check/set)

from android.

snakedoctr avatar snakedoctr commented on June 18, 2024

hmmm, I'm not seeing allowRemoteLocation in the config.

from android.

jpmens avatar jpmens commented on June 18, 2024

Forgive me for leading you up the garden path: the message needs an action and not a cmd in it:

mosquitto_pub -t owntracks/jpm/s8/cmd -m "$(jo _type=cmd action=reportLocation)" -q 1

This should provoke a location publish with t: r in it:

{"_type":"location","t":"r","tid":"s8","tst":1699562723, ... }

from android.

snakedoctr avatar snakedoctr commented on June 18, 2024

OK, we're getting farther now! Now when the app receives the message it says "[...] Received incoming message: MessageCmd on [...]. It's not pushing a location, though. Could it be related to the allowRemoteLocation config option not being present? I tried adding it, but it said it wasn't a valid key.

from android.

jpmens avatar jpmens commented on June 18, 2024

from android.

snakedoctr avatar snakedoctr commented on June 18, 2024

Gotcha on allowRemoteLocation only being on iOS.

The app is definitely connected to MQTT. It's seeing the MessageCmd come through, and I see it has an updated location. It's just not publishing the location back to MQTT.

I'm guessing it disregards the Minimal location displacement and Location interval when it gets the reportLocation command?

from android.

jpmens avatar jpmens commented on June 18, 2024

It ought to just report the last obtained location, but I think we need expert help here now.

@growse management summary: cmd with action: reportLocation is coming in, but @snakedoctr's device isn't publishing a location (my S8 does). What are we doing wrong?

from android.

growse avatar growse commented on June 18, 2024

Do you have debug logging enabled? If so, do you see a On demand location request debug log entry shortly after the Received incoming message message?

from android.

snakedoctr avatar snakedoctr commented on June 18, 2024

I do:

2023-11-10 10:38:05.049 I MessageProcessor: Received incoming message: MessageCmd on owntracks/user/device
2023-11-10 10:38:05.051 D BackgroundService: On demand location request
2023-11-10 10:38:05.052 D GMSLocationProviderClient: Removing location updates clientcallback=201885842
2023-11-10 10:38:05.052 D GMSLocationProviderClient: Requesting location updates priority=0, interval=null clientCallback=201885842
2023-11-10 10:38:05.053 D GMSLocationProviderClient: transformed location request is Request[PRIORITY_HIGH_ACCURACY requested=3600000ms fastest=600000ms expireIn=60000ms num=1]
2023-11-10 10:38:05.082 D ConnectionPool: BackgroundService On-demand location result received: LocationResult(lastLocation=Location[fused <LAT>,<LON> hAcc=48.0 et=+0d13h18m30s28ms alt=120.0 vAcc=04.0 vel=0.0 sAcc=2.859375 {Bundle[{satellites=0, maxCn0=0, meanCn0=0}]}])
2023-11-10 10:38:05.155 D GMSLocationProviderClient: GMS Background location update request completed: Success=true Cancelled=false

from android.

growse avatar growse commented on June 18, 2024

Huh. So it's asking for, and receiving a location. The only thing that would prevent a location being published at that point is this conditional:

void onLocationChanged(@Nullable Location location, @Nullable String reportType) {
if (location == null) {
Timber.e("no location provided");
return;
}
Timber.v("location update received: tst:%s, acc:%s, lat:%s, lon:%s type:%s", location.getTime(), location.getAccuracy(), location.getLatitude(), location.getLongitude(), reportType);
if (location.getTime() > locationRepo.getCurrentLocationTime()) {
locationProcessor.onLocationChanged(location, reportType);
} else {
Timber.v("Not re-sending message with same timestamp as last");
}
}

So it looks like the device is giving OT a location that's already been published. Now, this is definitely a bug, because the fact that it's an on-demand location request should override this check - that's been fixed in 2.5.0.

fun onLocationChanged(location: Location, reportType: MessageLocation.ReportType) {
Timber.v("location update received: $location, report type $reportType")
if (location.time > locationRepo.currentLocationTime || reportType != MessageLocation.ReportType.DEFAULT) {
lifecycleScope.launch {
locationProcessor.onLocationChanged(location, reportType)
}
} else {
Timber.v("Not re-sending message with same timestamp as last")
}
}

It's only going to get triggered when the device doesn't go and get a fresh location, which is what it should really do with a PRIORITY_HIGH_ACCURACY location request.

from android.

wir3z avatar wir3z commented on June 18, 2024

Excited to try this as well. Any ETA on v2.5.0? Or Beta version that we can sign up for and exercise for you? :)

from android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.