[Demo] Control your TESLA through Siri and Power Automate

[Demo] Control your TESLA through Siri and Power Automate

Imagine a scenario: in a freezing cold winter, you are heading to the parking lot for your Tesla car. You are holding a big box and have no hand to take out the phone then choose the commands from the menus to turn on the AC remotely, or open the rear trunk. So you just talk to your Apple watch and tell Siri to command the car easily and promptly. Is it an interesting experience you wanna try? If so, you may follow the below steps to finish your personal control application.

Process:

Applications Involved:

  • Shortcuts (iOS)
  • Power Automate 
Steps:

Tesla has deprecated the /oauth/token endpoint in favor of using auth.tesla.com.
The below steps are based on latest  Tesla API (unofficial) from tesla-api.timdorr.com.

  1. Get your fresh token.
 There is a little complicated process to get your access token and refresh token, you can check from tesla-api.timdorr.com .I got an issue in this process of using Power Automate. Will update this blog when I figure it out. But for now, as a workaround, you may visit Tesla API Token website to get it.

          Visit website  Tesla API Token to get your fresh token.

 
   

            Copy the Refresh token for use in step 2.


 2.  Create Power Automate Flow to execute the commands from Siri(Shortcut).

      (1) You may download my Flow for your reference. Click for Download
    
      (2)  Import the sample flow zip package into your Powe Apps Studio.





       (3) After sample flow imported, add the Refresh code you got from Step 1 into "Set Refresh Token" action.
       


   (4) Add / Customize the command based on your need.
       You may add new commands following the existing ones. Click for more Commands Details.
       Or you can customize the existing ones.
       In the sample, I just listed several frequently used commands:
  • Open rear trunk
  • Close rear trunk
  • Open front trunk
  •  Honk
  • Flash
  • Lock the door
  • Unlock the door
  • Start AC
  • Stop AC
  • Set temperature

     Before executing each command, we need to wake up the car or make sure the car is online.

   

     After sending out a wake-up request, there needs a delay. 

    I set a Do-Until action with 10 seconds delay each time and 3 loop times at the most. If you find the 30-sec maximum is not enough during your actual use, you may adjust the delay.

    





     3. Create Shortcuts on your iPhone or Mac computer.

         Please make sure the parameter "Tesla" value is in line with the command name in your Power Automate Flow.
         You may follow the same parameter names if you don't change it in Flow.




Done.

You may give it a try from "Hey Siri", then voice your command. Wait 10 to 30 seconds, see if Tesla works for you. If not, you may check the Flow execution history to debug.
If any questions, you may leave a comment below. 




No comments:

Post a Comment