AutoVoice Activate wifi switcher with tasker through Google assistant

Discussion in 'AutoApps' started by Schroeder, Dec 13, 2017.

  1. Schroeder

    Schroeder New Member

    Joined:
    Dec 12, 2017
    Messages:
    6
    Likes Received:
    0
    I'm new to tasker and auto voice. Auto voice seems like a middle man. It's too bad Google assistant can't launch tasker tasks directly.

    I am desperately trying to find a wifi switching task. I have for networks in my home. I have 2 2.4GHz and 2 5GHz networks. I want my pixel 2 xl to fluidly switch between them, turn data off, turn ringer volume to max, turn media volume to max, and maybe turn GPS on so I can get accurate weather information.

    If the wifi signal strength drops below 5 (according to the tasker WIFII) for more than 45 seconds I'd like tasker to scan and connect to one of the alternate networks.

    I don't want the task to be triggered by time. This varies too much and also the task can only be ran every two minutes. I don't want to use location. I live in a rural area. 1 cell tower covers a very large area, so triggering the profile and task when I hit a certain cell tower is not an option. Using GPS isn't an option. I leave that off to conserve battery power. I even thought of using an NFC tag, but I'd have to take my phone out, scan it, AND leave NFC on.

    Then I thought that saying something like "ok, Google. Turn wifi scanner on now" would work perfect and awesome! I could have my hands full while coming into the house, closer doors, etc. all while initiating the wifi.

    Is this possible? Does anyone have a good wifi switcher task set up? Here's what I currently have:

    <TaskerData sr="" dvi="1" tv="5.0u7m">
    <Task sr="task2">
    <cdate>1512926092376</cdate>
    <edate>1513126013612</edate>
    <id>2</id>
    <nme>Wifi switch</nme>
    <pri>100</pri>
    <Action sr="act0" ve="7">
    <code>410</code>
    <Str sr="arg0" ve="3">tasker/SSID.txt</Str>
    <Str sr="arg1" ve="3">%WIFII</Str>
    <Int sr="arg2" val="0"/>
    <Int sr="arg3" val="1"/>
    </Action>
    <Action sr="act1" ve="7">
    <code>415</code>
    <Str sr="arg0" ve="3">tasker/SSID.txt</Str>
    <Str sr="arg1" ve="3">5</Str>
    <Str sr="arg2" ve="3">%signum</Str>
    </Action>
    <Action sr="act10" ve="7">
    <code>1698386443</code>
    <Bundle sr="arg0">
    <Vals sr="val">
    <com.twofortyfouram.locale.intent.extra.BLURB>"Linksys02149"</com.twofortyfouram.locale.intent.extra.BLURB>
    <com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
    <jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST>true</jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST>
    <jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST-type>java.lang.Boolean</jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST-type>
    <jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>"Linksys02149"</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>
    <jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>java.lang.String</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>
    <net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
    <net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
    </Vals>
    </Bundle>
    <Str sr="arg1" ve="3">jp.meridiani.apps.wificonnect</Str>
    <Str sr="arg2" ve="3">jp.meridiani.apps.wificonnect.activity.EditActivity</Str>
    <Int sr="arg3" val="0"/>
    </Action>
    <Action sr="act11" ve="7">
    <code>1698386443</code>
    <Bundle sr="arg0">
    <Vals sr="val">
    <com.twofortyfouram.locale.intent.extra.BLURB>"UBER Schroeder Homestead"</com.twofortyfouram.locale.intent.extra.BLURB>
    <com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
    <jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST>true</jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST>
    <jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST-type>java.lang.Boolean</jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST-type>
    <jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>"UBER Schroeder Homestead"</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>
    <jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>java.lang.String</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>
    <net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
    <net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
    </Vals>
    </Bundle>
    <Str sr="arg1" ve="3">jp.meridiani.apps.wificonnect</Str>
    <Str sr="arg2" ve="3">jp.meridiani.apps.wificonnect.activity.EditActivity</Str>
    <Int sr="arg3" val="0"/>
    </Action>
    <Action sr="act12" ve="7">
    <code>1698386443</code>
    <Bundle sr="arg0">
    <Vals sr="val">
    <com.twofortyfouram.locale.intent.extra.BLURB>"TP-LINK_AP_137E"</com.twofortyfouram.locale.intent.extra.BLURB>
    <com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
    <jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST>true</jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST>
    <jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST-type>java.lang.Boolean</jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST-type>
    <jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>"TP-LINK_AP_137E"</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>
    <jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>java.lang.String</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>
    <net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
    <net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
    </Vals>
    </Bundle>
    <Str sr="arg1" ve="3">jp.meridiani.apps.wificonnect</Str>
    <Str sr="arg2" ve="3">jp.meridiani.apps.wificonnect.activity.EditActivity</Str>
    <Int sr="arg3" val="0"/>
    </Action>
    <Action sr="act2" ve="7">
    <code>590</code>
    <Str sr="arg0" ve="3">%signum</Str>
    <Str sr="arg1" ve="3"/>
    <Int sr="arg2" val="0"/>
    </Action>
    <Action sr="act3" ve="7">
    <code>547</code>
    <Str sr="arg0" ve="3">%SigStrength</Str>
    <Str sr="arg1" ve="3">%signum2</Str>
    <Int sr="arg2" val="0"/>
    <Int sr="arg3" val="0"/>
    <Int sr="arg4" val="0"/>
    </Action>
    <Action sr="act4" ve="7">
    <code>30</code>
    <Int sr="arg0" val="0"/>
    <Int sr="arg1" val="45"/>
    <Int sr="arg2" val="0"/>
    <Int sr="arg3" val="0"/>
    <Int sr="arg4" val="0"/>
    </Action>
    <Action sr="act5" ve="7">
    <code>888</code>
    <Str sr="arg0" ve="3">%retest</Str>
    <Int sr="arg1">
    <var>%true</var>
    </Int>
    <Int sr="arg2" val="0"/>
    </Action>
    <Action sr="act6" ve="7">
    <code>137</code>
    <Int sr="arg0" val="0"/>
    <Str sr="arg1" ve="3"/>
    <ConditionList sr="if">
    <bool0>Or</bool0>
    <Condition sr="c0" ve="3">
    <lhs>%SigStrength</lhs>
    <op>6</op>
    <rhs>5</rhs>
    </Condition>
    <Condition sr="c1" ve="3">
    <lhs>%SigStrength</lhs>
    <op>0</op>
    <rhs>5</rhs>
    </Condition>
    </ConditionList>
    </Action>
    <Action sr="act7" ve="7">
    <code>135</code>
    <Int sr="arg0" val="0"/>
    <Int sr="arg1" val="1"/>
    <Str sr="arg2" ve="3"/>
    <ConditionList sr="if">
    <bool0>Or</bool0>
    <Condition sr="c0" ve="3">
    <lhs>%WIFII</lhs>
    <op>2</op>
    <rhs>*Schroeder Homestead*</rhs>
    </Condition>
    <Condition sr="c1" ve="3">
    <lhs>%WIFII</lhs>
    <op>2</op>
    <rhs>*2149*</rhs>
    </Condition>
    </ConditionList>
    </Action>
    <Action sr="act8" ve="7">
    <code>1698386443</code>
    <Bundle sr="arg0">
    <Vals sr="val">
    <com.twofortyfouram.locale.intent.extra.BLURB>"Schroeder Homestead"</com.twofortyfouram.locale.intent.extra.BLURB>
    <com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
    <jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST>true</jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST>
    <jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST-type>java.lang.Boolean</jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST-type>
    <jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>"Schroeder Homestead"</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>
    <jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>java.lang.String</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>
    <net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
    <net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
    </Vals>
    </Bundle>
    <Str sr="arg1" ve="3">jp.meridiani.apps.wificonnect</Str>
    <Str sr="arg2" ve="3">jp.meridiani.apps.wificonnect.activity.EditActivity</Str>
    <Int sr="arg3" val="0"/>
    </Action>
    <Action sr="act9" ve="7">
    <code>1698386443</code>
    <Bundle sr="arg0">
    <Vals sr="val">
    <com.twofortyfouram.locale.intent.extra.BLURB>"Linksys02149_5GHz"</com.twofortyfouram.locale.intent.extra.BLURB>
    <com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
    <jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST>true</jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST>
    <jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST-type>java.lang.Boolean</jp.meridiani.apps.wificonnect.extra.BOOLEAN_SHOWTOAST-type>
    <jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>"Linksys02149_5GHz"</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>
    <jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>java.lang.String</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>
    <net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
    <net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
    </Vals>
    </Bundle>
    <Str sr="arg1" ve="3">jp.meridiani.apps.wificonnect</Str>
    <Str sr="arg2" ve="3">jp.meridiani.apps.wificonnect.activity.EditActivity</Str>
    <Int sr="arg3" val="0"/>
    </Action>
    </Task>
    </TaskerData>

    This doesn't work. I am also wondering what happens if I manually toggle the wifi. Will this break task? I followed this video to a T in there beginning. I simply added all my networks at the bottom where he only added two. Very well-done video, but it doesn't seem to work for me. Please help. This fluid wifi switching was the main reason I got tasker, I think google assistant and auto voice may need to be part of it. Finally, how will stick a setup affect battery life?


    Sent from my Pixel 2 XL using Tapatalk
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,481
    Likes Received:
    806
    Just to be clear: do you already have a wifi switcher that you like working? If so, it'll be very easy to toggle it with your voice :)

    Can you please post the task's description instead of XML? XML is very unreadable for humans :)
     
  3. Schroeder

    Schroeder New Member

    Joined:
    Dec 12, 2017
    Messages:
    6
    Likes Received:
    0
    No, I do not already have a wifi switching app. I know there are some out there that probably do a good job, and believe me, I've been considering just buying one off the playstore with all the time I have in this. I'd like to do it through tasker though because I would still have to enable wifi when I got home- a manual process.

    ***There is ANOTHER portion I need to add to this that I hadn't decided when I originally made this thread.*** I'd like to trigger the home profile by a command through Google voice. I have recently learned a little about auto voice, and I think it's the solution I need. I was not satisfied with the other means of triggering the profile and task. Time varies too much from when I get home from work. Cell tower location isn't accurate enough. GPS isn't an option. I don't leave it on because it drains too much battery. I even considered NFC, but it too has to be left on. Also, if I have to pull my phone out to scan an NFC tag I may as well just pull my phone out and toggle the wifi or whatever else I would select to activate the profile. Now saying "ok Google, xxxxxx xxxx"on the other hand..... I could have my hands full, walk in the door, yell the command, and trigger my home profile (and this wifi switching task) without lifting a finger!

    Yes. I apologize for the XML description. On XDA I recently learned you could export the description. Yes, it is much more readable for humans lol. Here's what I have so far. It isn't functioning correctly. Any help would be appreciated.

    Wifi switch (2)
    A1: Write File [ File:tasker/SSID.txt Text:%WIFII Append:Off Add Newline:On ]
    A2: Read Line [ File:tasker/SSID.txt Line:5 To Var:%signum ]
    A3: Variable Split [ Name:%signum Splitter: Delete Base:Off ]
    A4: Variable Set [ Name:%SigStrength To:%signum2 Recurse Variables:Off Do Maths:Off Append:Off ]
    A5: Wait [ MS:0 Seconds:45 Minutes:0 Hours:0 Days:0 ]
    A6: Variable Add [ Name:%retest Value:%true Wrap Around:0 ]
    A7: Stop [ With Error:Off Task: ] If [ %SigStrength < 5 | %SigStrength eq 5 ]
    A8: Goto [ Type:Action Number Number:1 Label: ] If [ %WIFII ~ *Schroeder Homestead* | %WIFII ~ *2149* ]
    A9: WiFi Connect [ Configuration:"Schroeder Homestead" Timeout (Seconds):0 ]
    A10: WiFi Connect [ Configuration:"Linksys02149_5GHz" Timeout (Seconds):0 ]
    A11: WiFi Connect [ Configuration:"Linksys02149" Timeout (Seconds):0 ]
    A12: WiFi Connect [ Configuration:"UBER Schroeder Homestead" Timeout (Seconds):0 ]
    A13: WiFi Connect [ Configuration:"TP-LINK_AP_137E" Timeout (Seconds):0 ]


    Sent from my Pixel 2 XL using Tapatalk
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,481
    Likes Received:
    806
  5. Schroeder

    Schroeder New Member

    Joined:
    Dec 12, 2017
    Messages:
    6
    Likes Received:
    0
    That looks like a link to a thread about a whatsapp notification. I do appreciate the tutorial you made for me the other day though. I sent you another email last night or yesterday morning asking if there is another way to turn on and then stay connected to the best home network with wifi scanning AND have the location services off. I do not typically have that on and do not want to because of it's battery usage.

    Sent from my Pixel 2 XL using Tapatalk
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,481
    Likes Received:
    806
    Unfortunately Android doesn't make it possible to do wifi scanning while the location is off in the latest versions :( Sorry!
     
: wifi

Share This Page