AutoVoice Chaining voice commands where variable values match

Discussion in 'AutoApps' started by BenGmuN, Jan 27, 2016.

  1. BenGmuN

    BenGmuN New Member

    Joined:
    Sep 28, 2015
    Messages:
    25
    Likes Received:
    6
    Hi all,

    I'm trying to chain two voice-command-activated profiles:

    Profile 1/Command ID= action1:
    Filter (regex): (?<action>watch|play) (?<device>TV|playstation) in the (?<room>bedroom|lounge)
    e.g. triggered by: "I want to watch TV in the bedroom"

    Profile 2/Last Command ID= action1:
    Filter (regex): and (?<action2>watch|play) (?<device2>TV|playstation) in the (?<room2>bedroom|lounge)
    e.g. triggered by: "and play playstation in the lounge" (only if LastCommandID = action1)

    I want to be able to trigger just action 1 on its own or both actions at once, i.e.:
    "I want to watch TV in the bedroom and play playstation in the lounge" will perform both tasks
    "I want to watch TV in the bedroom" will just perform the first task

    At the moment, I've linked both profiles just to an Alert --> "Say" task so that it just repeats the values of <action> <device> <room> <action2> <device2> <room2>

    What's happening, however, is that the values of <action2> <device2> and <room2> seem to be being set to the values of <action> <device> and <room>, even though they should be different. I guess this is because the filter I'm using for profile 2 matches that of profile 1? Can I stop this?

    Any ideas?

    Thank you!
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    My advice is, don't use chaining at all :)
    The chaining issue existed on older Tasker version, but now you can simply use "AutoVoice" actions in the same task back-to-back and chain it that way. sorry for the trouble!
     
  3. BenGmuN

    BenGmuN New Member

    Joined:
    Sep 28, 2015
    Messages:
    25
    Likes Received:
    6
    Thank you so much for your speedy reply!

    The reason I tried to chain is that I couldn't figure out how to get one profile to trigger when I say either:
    "I want to watch TV in the bedroom and play playstation in the lounge"
    or just:
    "I want to watch TV in the bedroom"

    I guess what I'm asking is: How do I make the second part (i.e. the 'and play playstation in the lounge' bit) optional?
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    You just need to create 2 profiles :)

    One for "I want to watch TV in the bedroom" and another one for "play playstation in the lounge"
    Then if you say them both in one sentence both will trigger. as simple as that :)

    Hope this helps
     
  5. BenGmuN

    BenGmuN New Member

    Joined:
    Sep 28, 2015
    Messages:
    25
    Likes Received:
    6
    Thanks again, Joao. Unfortunately I'm still struggling!

    I'm trying to build a task that will fire up the relevant Logitech Harmony (infra red hub) activity. Unfortunately, It is not possible to run more than one Harmony activity at once. Therefore, if I have two profiles and two tasks and I say both commands in one sentence, the first activity will be stopped (switched off) and will be replaced by the second.

    This is a massive pain in the a$$, and is a limitation of the Harmony app - not Tasker/AutoVoice, obviously. So I have had to create a number of Harmony activities containing various different combinations of devices, e.g.:
    - Lounge TV
    - Lounge TV, Bedroom Playstation
    - Bedroom Playstation
    - Kitchen TV, Lounge Playstation
    - Kitchen Nintendo
    - Office TV, Lounge Nintendo
    - Lounge XBox, Office TV
    ....etc. etc.

    So I really need a single profile that will execute when I ask for just one device/location or two. Can I build a regex that I can use in my command filter for a single profile that would fire both when I ask for just one device as well as two?

    I'm thinking maybe I will need to stick with two profiles, but have each of them simply set global variables, and have a third profile that triggers when these variables are set before running the activity I want and then clearing the variables again... any other ideas? Thanks again.
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    I see. Yeah, you can do that as well if you use a regex like this :)

    Code (Text):
    I want to watch TV in the bedroom(?<playstation> and play playstation in the lounge)?
    If the %playstation variable is set, that means that you said the whole sentence. Hope this helps!
     

Share This Page