How to switch track recording profiles with broadcasts

Wolfgang shared this question 2 months ago
Answered

Hi,

I want to automate with MacroDroid my trackrecording. I want to do the following:

When MacroDroid recognizes Hiking then I want locus switches my profile to hiking and when driving by car is recognized it should switch the profile as well.


What is the right behavior to realize that? As far Is I know i'm not able to just switch the profile while recording. Do I have to do the following?

switch to car: stop recording, autosave / wait 1 second / start recording with profile name car

switch to hiking: stop recording, autosave / wait 1 second / start recording profile name hiking

Or is there any easier/better way?

Thanks Wolfgang

Best Answer
photo

Hello Wolfgang,

interesting use-case.

The current solution for ACTION_START:

  • Locus check if the recording is running. If so, ends this task.
  • Otherwise check if "name" parameter exists, if so, try to set a recording profile. In case of fail (profile does not exist), ends this task
  • Finally, start recording

New solution since next version:

  • Locus check if "name" parameter exists, if so, try to set a recording profile. In case of fail (profile does not exists), ends this task
  • Then check if the recording is running. If yes, nothing changed otherwise start recording

Usable?

Jiří M. aka Menion

Comments (6)

photo
1

Hello Wolfgang,

interesting use-case.

The current solution for ACTION_START:

  • Locus check if the recording is running. If so, ends this task.
  • Otherwise check if "name" parameter exists, if so, try to set a recording profile. In case of fail (profile does not exist), ends this task
  • Finally, start recording

New solution since next version:

  • Locus check if "name" parameter exists, if so, try to set a recording profile. In case of fail (profile does not exists), ends this task
  • Then check if the recording is running. If yes, nothing changed otherwise start recording

Usable?

Jiří M. aka Menion

photo
1

In other words, when the recording is already running, I only would have to send a

tasks: { track_record: { action: "start", name: "Hiking" } }

or

tasks: { track_record: { action: "start", name: "Car" } }

and then it just would switch the profile? Is that right?


photo
1

Yes, exactly this I wanted to say. "action: start" should be then used only to change a profile.

photo
1

Sounds great :D I'll stop any testing and wait for next version :))

Thanks Wolfgang

photo
1

Hey Menion,

today I got the new update. That was a quick one - wow.

I think I did not yet understand how to handle all.


First of all (basics):

I think I did not yet really understand how a track is recorded. Until today I thought I'm able to switch the profile while recording, but could it be that that is not true? One track per profile seems to be how recording works - right?

That means if I want to record "hiking", "driving" and then again "hiking" I have to record three independent tracks?


Second:

If yes that only one profile per track is possible. So when I use the API I probably have first to save a track before I start a new profile?


Third:

I started a track recording via API but when I stopped it manually I lost the track. Did I something wrong here or is there a malfunction?


Thanks Wolfgang

photo
1

Hello,

it works a little bit different. Recording profile defines mainly set of parameters how new locations should be stored into track. Anyway, you may try on your own, that it is possible to change recording profile during active recording! and nothing serious happens, Locus will just without problems continue in recording with parameters from new profile. Correct behavior? Not 100% sure, but this is how it works now.

So if you want to have your recording saved as separate tracks, you really firstly needs to stop the previous recording and then start new. If you don't stop it, all three "segments" will be saved into the same single track.

Third: little weird. I see only two possible reasons for this: a) track has no data, so it was discarded or you have defined automatic saving in your recording profile, so there was no need for some confirmation.

Not sure, my answers are clear. Feel free to ask if not.

Menion

photo