Ir al contenido principal

Tasker: Profiles with priorities

Hi!

If you read Tasker docs, you may find that with Tasker its not possible to establish actions based on profile priorities if you have two of them activated at the same time; in the other hand Setting Profiles is a unmantained old app that can do this, but have no scripting capabilities like Tasker.

Here is the solution using Tasker powerful environment. The main idea is to do this:

Profiles/Init (44)
A1: If [ %Profiles_pactivelast Is Set & %Profiles_pactivelast !~ %PACTIVE ]
A2: Perform Task [ Name:Profiles/Profile/Default Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 
A3: Variable Set [ Name:%profile_priority To:Work,Class,Study,Sleep,Low battery, Charging weak,Charging strong Do Maths:Off Append:Off ] 
A4: Variable Split [ Name:%profile_priority Splitter:, Delete Base:Off ] 
A5: For [ Variable:%profile Items:%profile_priority() ] 
A6: [X] Flash [ Text:%profile Long:Off ] 
A7: [X] Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ] 
A8: If [ %PACTIVE ~R .*,%profile,.* ]
A9: Flash [ Text:Activo %profile Long:Off ] 
A10: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ] 
A11: Perform Task [ Name:Profiles/Profile/%profile Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 
A12: End If 
A13: End For 
A14: End If 
A15: Variable Set [ Name:%Profiles_pactivelast To:%PACTIVE Do Maths:Off Append:Off ] 

Then you may have several profiles with several conditions, and when any profile actives it will call to "Init" task, so when the are active, the %PACTIVE variable would list them. For example, I have 4 profiles (in priority order, from high to low):

Profiles/Profile/Charging weak (12)
A1: WiFi [ Set:On ] 

Profiles/Profile/Low battery (14)
A1: WiFi [ Set:Off ] 
A2: Vibrate On Ringer [ Set:Off ] 
A3: Auto Brightness [ Set:Off ] 
A4: Display Brightness [ Level:0 Disable Safeguard:Off Ignore Current Level:Off Immediate Effect:Off ] 
A5: Display Timeout [ Secs:15 Mins:0 Hours:0 ] 

Profiles/Profile/Sleep (7)
A1: Silent Mode [ Mode:On ] 
A2: Auto Brightness [ Set:Off ] 
A3: Display Brightness [ Level:0 Disable Safeguard:Off Ignore Current Level:Off Immediate Effect:Off ] 
A4: Display Timeout [ Secs:0 Mins:1 Hours:0 ] 
A5: Media Volume [ Level:2 Display:Off Sound:Off ] 

Profiles/Profile/Default (16)
A1: WiFi [ Set:On ] 
A2: Bluetooth [ Set:On ] 
A3: Silent Mode [ Mode:Off ] 
A4: Default Ringtone [ Type:Alarm Sound:Oxygen ] 
A5: Haptic Feedback [ Set:Off ] 
A6: Alarm Volume [ Level:7 Display:Off Sound:Off ] 
A7: BT Voice Volume [ Level:15 Display:Off Sound:Off ] 
A8: Media Volume [ Level:15 Display:Off Sound:Off ] 
A9: Notification Volume [ Level:7 Display:Off Sound:Off ] 
A10: Ringer Volume [ Level:7 Display:Off Sound:Off ] 
A11: System Volume [ Level:7 Display:Off Sound:Off ] 
A12: Notification Pulse [ Set:On ] 
A13: Display Rotation [ Set:On ] 
A14: Auto Brightness [ Set:On ] 
A15: Display Timeout [ Secs:30 Mins:0 Hours:0 ] 

Finally the Tasker conditions that activates them

Profile: Charging weak (41)
State: Power [ Source:USB ]
Enter: Profiles/Init (44)
Exit: Profiles/Init (44)

Profile: Low battery (39)
State: Battery Level [ From:0 To:20 ]
State: Not Power [ Source:Any ]
Enter: Profiles/Init (44)
Exit: Profiles/Init (44)

Profile: Sleep (6)
State: Calendar Entry [ Title:Dormir* Location:* Description:* Available:Any Calendar:Google:[Sched]Borja ]
Enter: Profiles/Init (44)
Exit: Profiles/Init (44)



Comentarios

Entradas populares de este blog

Yamaha XT 125R Manual

Para aquellos que lo hayan perdido y no quieran comprar uno nuevo por el doble de lo que cuesta cambiar el aceite.. https://mega.nz/#F!ZeYh3QzD !mSOhljTo5UWedfEWq5cCjw Algunos "trucos":  - Si os marca mal la velocidad es porque la teneis configurada mal (supermotard en enduro y viceversa), para cambiar este ajuste teneis que quitar la bateria varios minutos y al volver a enchufar con el boton azul seleccionar la correcta. La mia es enduro  - Si cambiais el aceite:    + Para no tener que desmontar media moto lo mejor es introducir una botella de cocacola de plástico cortada, con el tapón abierto y dejar que el aceite escurra a traves de ella hacia la lata dónde vais a desecharlo    + Para resetear el contador de kilómetros que quedan para el cambio de aceite hay que apagar la moto, pulsar el botón azul, encenderla y esperar hasta que en la pantalla aparezca reseteado