Skip to content

Instantly share code, notes, and snippets.

@b-turchyn
Created May 3, 2019 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b-turchyn/0c60ce8ef8eb880039a7a15da128f000 to your computer and use it in GitHub Desktop.
Save b-turchyn/0c60ce8ef8eb880039a7a15da128f000 to your computer and use it in GitHub Desktop.
Tasker morning routine

Starts playing music and reads off today's weather when you turn off your alarm

Requirements

  • Sleep as Android
  • Tasker
  • AutoInput
  • Spotify
  • DarkSky API key
  • Spotify playlist URI

Installation

Copy Tasker.xml, replacing the following strings:

  • YOURNAMEHERE: Your name, for text-to-speech
  • DARKSKY_API: Your DarkSky API key
  • DARKSKY_GPS: GPS coordinates for your location, i.e. "-50.123,40.234"
  • PLAYLIST_URI: Spotify Playlist URI, retrieved by right-clicking on the playlist, selecting "Share", then "Copy Spotify URI"
<TaskerData sr="" dvi="1" tv="5.6">
<Profile sr="prof85" ve="2">
<cdate>1556680682274</cdate>
<edate>1556847405523</edate>
<id>85</id>
<mid0>83</mid0>
<nme>Wake Up Work Day</nme>
<Event sr="con0" ve="2">
<code>801067335</code>
<pri>0</pri>
<Bundle sr="arg0">
<Vals sr="val">
<com.twofortyfouram.locale.intent.extra.BLURB>Sleep tracking stop</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<com.urbandroid.sleep.taskerplugin.extra.EVENT>com.urbandroid.sleep.alarmclock.SLEEP_TRACKING_STOPPED</com.urbandroid.sleep.taskerplugin.extra.EVENT>
<com.urbandroid.sleep.taskerplugin.extra.EVENT-type>java.lang.String</com.urbandroid.sleep.taskerplugin.extra.EVENT-type>
<com.urbandroid.sleep.taskerplugin.extra.INT_VERSION_CODE>21675</com.urbandroid.sleep.taskerplugin.extra.INT_VERSION_CODE>
<com.urbandroid.sleep.taskerplugin.extra.INT_VERSION_CODE-type>java.lang.Integer</com.urbandroid.sleep.taskerplugin.extra.INT_VERSION_CODE-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">com.urbandroid.sleep</Str>
<Str sr="arg2" ve="3">com.urbandroid.sleep.addon.taskerplugin.ui.EditEventActivity</Str>
</Event>
<Day sr="con1">
<wday0>2</wday0>
<wday1>3</wday1>
<wday2>4</wday2>
<wday3>5</wday3>
<wday4>6</wday4>
</Day>
</Profile>
<Task sr="task83">
<cdate>1556676630143</cdate>
<edate>1556847138855</edate>
<id>83</id>
<nme>Morning Routine</nme>
<pri>100</pri>
<Share sr="Share">
<d>Morning routine</d>
<t></t>
</Share>
<Action sr="act0" ve="7">
<code>877</code>
<on>false</on>
<Str sr="arg0" ve="3">android.media.action.MEDIA_PLAY_FROM_SEARCH</Str>
<Int sr="arg1" val="0"/>
<Str sr="arg2" ve="3"/>
<Str sr="arg3" ve="3">PLAYLIST_URI</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3">com.spotify.music</Str>
<Str sr="arg8" ve="3"/>
<Int sr="arg9" val="1"/>
</Action>
<Action sr="act1" ve="7">
<code>307</code>
<Int sr="arg0" val="5"/>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="0"/>
</Action>
<Action sr="act2" ve="7">
<code>877</code>
<Str sr="arg0" ve="3">android.intent.action.VIEW</Str>
<Int sr="arg1" val="0"/>
<Str sr="arg2" ve="3"/>
<Str sr="arg3" ve="3">PLAYLIST_URI</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3">com.spotify.music</Str>
<Str sr="arg8" ve="3"/>
<Int sr="arg9" val="1"/>
</Action>
<Action sr="act3" ve="7">
<code>1732635924</code>
<Bundle sr="arg0">
<Vals sr="val">
<ActionId>SHUFFLE PLAY</ActionId>
<ActionId-type>java.lang.String</ActionId-type>
<ActionType>16</ActionType>
<ActionType-type>java.lang.String</ActionType-type>
<FieldSelectionType>0</FieldSelectionType>
<FieldSelectionType-type>java.lang.String</FieldSelectionType-type>
<IsFirstAction>false</IsFirstAction>
<IsFirstAction-type>java.lang.Boolean</IsFirstAction-type>
<IsTaskerAction>false</IsTaskerAction>
<IsTaskerAction-type>java.lang.Boolean</IsTaskerAction-type>
<NearbyText>&lt;null&gt;</NearbyText>
<NearbyText-type>java.lang.String</NearbyText-type>
<Password>&lt;null&gt;</Password>
<Password-type>java.lang.String</Password-type>
<StoredAction>&lt;null&gt;</StoredAction>
<StoredAction-type>java.lang.String</StoredAction-type>
<TextToWrite>&lt;null&gt;</TextToWrite>
<TextToWrite-type>java.lang.String</TextToWrite-type>
<com.twofortyfouram.locale.intent.extra.BLURB>Type: Text
Value: SHUFFLE PLAY
Action : Click</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<net.dinglisch.android.tasker.RELEVANT_VARIABLES>&lt;StringArray sr=""&gt;&lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0&gt;%err
Error Code
Only available if you select &amp;lt;b&amp;gt;Continue Task After Error&amp;lt;/b&amp;gt; and the action ends in error&lt;/_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0&gt;&lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1&gt;%errmsg
Error Message
Only available if you select &amp;lt;b&amp;gt;Continue Task After Error&amp;lt;/b&amp;gt; and the action ends in error&lt;/_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1&gt;&lt;/StringArray&gt;</net.dinglisch.android.tasker.RELEVANT_VARIABLES>
<net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>[Ljava.lang.String;</net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>ActionId FieldSelectionType ActionType plugininstanceid plugintypeid </net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>java.lang.String</net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-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>
<plugininstanceid>1fde43e1-695e-4e25-93f1-fe30c19ea98b</plugininstanceid>
<plugininstanceid-type>java.lang.String</plugininstanceid-type>
<plugintypeid>com.joaomgcd.autoinput.intent.IntentPerformAction</plugintypeid>
<plugintypeid-type>java.lang.String</plugintypeid-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">com.joaomgcd.autoinput</Str>
<Str sr="arg2" ve="3">com.joaomgcd.autoinput.activity.ActivityConfigPerformAction</Str>
<Int sr="arg3" val="20"/>
</Action>
<Action sr="act4" ve="7">
<code>118</code>
<Str sr="arg0" ve="3">https://api.darksky.net:443</Str>
<Str sr="arg1" ve="3">forecast/DARKSKY_API/DARKSKY_GPS</Str>
<Str sr="arg2" ve="3">lang=en
units=ca
exclude=minutely,hourly,alerts,flags</Str>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Int sr="arg5" val="10"/>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3"/>
<Int sr="arg8" val="0"/>
</Action>
<Action sr="act5" ve="7">
<code>129</code>
<Str sr="arg0" ve="3">var data = JSON.parse(global('HTTPD'));
var currently = data.currently;
var today = data.daily.data[0];
var tempType = "apparentTemperature";
var currentlytext = "It is " + currently.summary + " and " + Math.round(currently[tempType]) + " degrees.";
var todaytext = "Today will be " + today.summary + " High of " + Math.round(today[tempType + "High"]) + " degrees, with a low of " + Math.round(today[tempType + "Low"]) + " degrees.";
alert(currentlytext + "\n" + todaytext);</Str>
<Str sr="arg1" ve="3"/>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="45"/>
</Action>
<Action sr="act6" ve="7">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="10"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act7" ve="7">
<code>559</code>
<Str sr="arg0" ve="3">Good morning YOURNAMEHERE. %currentlytext %todaytext</Str>
<Str sr="arg1" ve="3">com.google.android.tts:eng-aus</Str>
<Int sr="arg2" val="3"/>
<Int sr="arg3" val="5"/>
<Int sr="arg4" val="5"/>
<Int sr="arg5" val="1"/>
<Int sr="arg6" val="1"/>
<Int sr="arg7" val="0"/>
</Action>
</Task>
</TaskerData>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment