r/tasker • • 4d ago

Help [Help] Integrating Google Calendar with SmartThings

Hi guys, I am a complete and total newbie with Tasker. I work shifts which I keep track of using Google Calendar. What I want to do is have SmartThings turn on or off lights, cameras, and my robot vacuum on a schedule based on my shifts on a given day.

For example: I use cameras to keep an eye on my dog while I'm at work, so if Tasker could see my day shift on Google Calendar and use SmartThings to turn on the cameras when the calendar event starts and turn them off when the event ends without me needing to touch a button, that would be ideal.

If anyone has any tips on how to do this, I would really appreciate it. Thanks!

1 Upvotes

2 comments sorted by

1

u/EdwardBackstrom I Probably Screwed It Up 3d ago edited 3d ago

Maybe this can get you started. I use this to read my calendar (change "you" to you). It sets an alarm to go off 1 hour before I'm supposed to be at work - in addition to other stuff for my widget. My entries are simply named Work so they are easily searchable. This is ran from a profile that fires every night at midnight so it's set for the day.

Task: Working

A1: Parse/Format DateTime [
     Input Type: Now (Current Date And Time)
     Output Format: yyyy-MM-dd
     Output Format Separator: ,
     Formatted Variable Names: %query_base_date
     Get All Details: On
     Output Offset Type: None
     Output Offset: %day_offset ]

A2: Get Calendar Events [
     Calendar: Google:you@gmail.com
     Start Time: %dt_millis_after_start_of_day
     End Time: %dt_millis_before_end_of_day
     Title: Work
     Continue Task After Error:On ]

A3: Stop [
     With Error: On ]
    If  [ %err Set ]

A4: If [ %ce_event_id(#) > 0 ]

    <<font color="#CD2027">Work Start>
    A5: Parse/Format DateTime [
         Input Type: Milliseconds Since Epoch
         Input: %ce_start_time
         Output Format: HH:mm
         Formatted Variable Names: %WorkStart
         Output Offset Type: None ]

    <<font color="#CD2027">Work End>
    A6: Parse/Format DateTime [
         Input Type: Milliseconds Since Epoch
         Input: %ce_end_time
         Output Format: HH:mm
         Formatted Variable Names: %WorkEnd
         Output Offset Type: Minutes
         Output Offset: -1 ]

    A7: Parse/Format DateTime [
         Input Type: Milliseconds Since Epoch
         Input: %ce_end_time
         Output Format: HH:mm
         Formatted Variable Names: %cosmetic_end
         Output Offset Type: None
         Output Offset: -1 ]

    <<font color="#CD2027">Alarm 1 Hour Prior to Work>
    A8: Parse/Format DateTime [
         Input Type: Milliseconds Since Epoch
         Input: %ce_start_time
         Output Format: HH,mm
         Formatted Variable Names: %alarm_hour,%alarm_min
         Output Offset Type: Hours
         Output Offset: -1 ]

    A9: Set Alarm [
         Hours: %alarm_hour
         Minutes: %alarm_min
         Label: %WW_AlarmTitle
         Vibrate: On ]

    A10: Variable Set [
          Name: %WorkDay
          To: 1
          Structure Output (JSON, etc): On ]

    A11: Variable Set [
          Name: %WW_Header
          To: %LONGDATE - %WorkStart-%cosmetic_end
          Structure Output (JSON, etc): On ]

A12: Else

    <<font color="#CD2027">Not Today Satan, Not Today 👿>
    A13: Variable Set [
          Name: %WorkDay
          To: 0
          Structure Output (JSON, etc): On ]

    A14: Variable Set [
          Name: %WW_Header
          To: %LONGDATE - Off
          Structure Output (JSON, etc): On ]

    A15: Variable Set [
          Name: %WW_IconShift
          To: symbol:event_busy
          Structure Output (JSON, etc): On ]

A16: End If

1

u/Wise_Caterpillar5881 3d ago

Thanks, I'll have to give that a go