TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker and becoming a Supporting Member. For more info: Support TMC
Start a Discussionhttps://teslamotorsclub.com/tmc/tags/

Google Home/Assistant Tesla Commands

Discussion in 'Model S: User Interface' started by highedu, Nov 22, 2016.

  1. highedu

    highedu Member

    Joined:
    Dec 1, 2012
    Messages:
    655
    Location:
    East Bay Area, CA
    I know there is an Alexa service somebody created to summon their Tesla, is anybody here working on a Google Home version?

    I looked through IFTTT and didn't see anything made available to the public. Would be nice to voice control my S or X via Google Home if somebody is working it.
     
  2. HumanGenome

    HumanGenome Member

    Joined:
    Oct 11, 2014
    Messages:
    353
    Location:
    Sacramento, CA
    Tesla Summon + getting my coffee maker on my Google Home and my life would be complete.
     
  3. TR5642

    TR5642 Member

    Joined:
    Sep 7, 2016
    Messages:
    88
    Location:
    California - SF Bay Area
    Google/Alexa warm the car and defrost the windows. <dreaming> Actually I'd settle for being able to turn on the window defrosters with the mobile app.
     
    • Like x 1
    • Funny x 1
  4. president_ltd

    president_ltd Member

    Joined:
    Feb 8, 2013
    Messages:
    63
    Location:
    australia
    Yes, you can integrate via Google Home and IFTTT with a Maker channel that e.g. talks to RPi that in turn talks to Tesla.
    I have something though all I have at the moment is "unlock" and "turn on climate".
    I don't think Tesla have a good way of giving out partial credentials and I already used a RPi at home for various other automations (OpenSprinkerPi, Denon amp, Samsung TV) so it was relatively easy to do.
     
  5. highedu

    highedu Member

    Joined:
    Dec 1, 2012
    Messages:
    655
    Location:
    East Bay Area, CA
    Do you plan on publishing the ifttt?
     
  6. president_ltd

    president_ltd Member

    Joined:
    Feb 8, 2013
    Messages:
    63
    Location:
    australia
    There's nothing to "publish" on IFTTT because as I said in the reply, it uses the "maker channel".
    The steps are:
    - Google Home 'trigger' on IFTTT, e.g. "unlock <carname>"
    - IFTTT action via Maker channel to send request at web server on RPi (RPi has to be on the internet / webserver, static IP or dyndns type setup)
    - web server cgi script that authenticates its actually from IFTTT
    - call relevant Tesla api (variety of these - folks here maintain - or just get it from github)

    All that is required here is to glue all the parts together. But since part of it is on your premises and not in the cloud (Tesla API doesn't have a good OAuth type mechanism) there's some work required by each person.
     
    • Like x 1
  7. BizJet

    BizJet Member

    Joined:
    May 19, 2016
    Messages:
    108
    Location:
    Boston
    I have written an "intent handler" called "Nikola" in Python that accepts Alexa requests (called "intents") specific to the Tesla and then acts via the Tesla API.

    Nikola currently accepts and answers requests like "How charged is my car?", "How far can I drive?", "How warm/cold is my car?", "What does my odometer read?", and "Is my car locked". It also executes simple commands like "Start charging my car to 90 percent", "Unlock my car for 10 minutes," and "Change my maximum charge to 70 percent."

    I must say it's a lot of fun to be around the house and just be able to ask: "Alexa, ask Nikola to charge my car to 75 percent"...and have it just happen.

    I've made this code public in GitHub, and I'd imagine it's adaptable to Google Home. At the moment, I'm filling out more complex functionality (like "Get my car ready for a long drive by 9 o'clock tomorrow morning" -- which will charge the car to 100% just before I'm about to depart, as well as checking the internal temperature and warming/cooling the car to within 5 degrees of the climate control setting), and then was going to start working on an IBM Watson Conversation interface. But adapting it to Google Home might be more interesting. If anyone wants to fork my code and do some work on it, I'd encourage that -- much of the hard work is done on interfacing with the car, and this work will continue.

    For those so inclined, here is the GitHub repository for the Alexa project: Nikola: An Alexa Skill for Monitoring and Managing Tesla Automobiles
     
    • Like x 2
    • Helpful x 1
  8. RubberToe

    RubberToe Supporting the greater good

    Joined:
    Jun 28, 2012
    Messages:
    1,691
    Location:
    Pasadena, Ca
  9. highedu

    highedu Member

    Joined:
    Dec 1, 2012
    Messages:
    655
    Location:
    East Bay Area, CA
    Can't wait to see if somebody adapts it to Google Home....maybe they are waiting for the Google assistant sdk which comes out next month.

    Have you tried adding summon functionality?
     
  10. BizJet

    BizJet Member

    Joined:
    May 19, 2016
    Messages:
    108
    Location:
    Boston
    No, I haven't added Summon functionality to the Nikola app for Alexa quite yet. I'd really like to finish the "Get my car ready for a long/short drive by 9am" functionality first, and then the capper would be to have it pull out of the garage.

    That said, though, pulling out of the garage is incompatible with having it plugged in to charge -- unfortunately, there is not an Eject_Charging_Cable API command (yet) for the car!
     
  11. cytranic

    cytranic Member

    Joined:
    Aug 14, 2015
    Messages:
    89
    Location:
    FL
    I wrote an IFTTT using the maker channel "Hey Google, Honk the Horn" and the Tesla honks its horn. Its very rudimentary. You have to grab your auth token using the API page, and then put that token into your app.

    This simple code here hosted on a server will make your horn honk if you call it with the IFTTT maker app.

    <?php
    $token = "YOURTOKEN";
    $VEHICLE_ID = "YOURID";

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "https://owner-api.teslamotors.com/api/1/vehicles/".$VEHICLE_ID."/command/honk_horn");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Content-Type: application/json; charset=utf-8",
    "Authorization: Bearer $token"
    ));

    $response = curl_exec($ch);

    var_dump($response);
    ?>
     
    • Helpful x 1
  12. cytranic

    cytranic Member

    Joined:
    Aug 14, 2015
    Messages:
    89
    Location:
    FL
    FYI, summon requires websockets, which is a little more difficult to get working with an IFTTT statement.
     
  13. cytranic

    cytranic Member

    Joined:
    Aug 14, 2015
    Messages:
    89
    Location:
    FL
    Good idea, I'll put my RpI to use.... I was using old WAMP server to communicate with the Tesla. RPI is much better option.
     
  14. president_ltd

    president_ltd Member

    Joined:
    Feb 8, 2013
    Messages:
    63
    Location:
    australia
    BizJet's code is good and is already the basis for something that will be for the Google Assistant. ;)
     
  15. BizJet

    BizJet Member

    Joined:
    May 19, 2016
    Messages:
    108
    Location:
    Boston
    Great to hear! I'm continuing to add to the intent handlers every few days, so "Nikola" will keep getting more and more capable. Just added "Where's my car?" today -- returns the street address where your car is parked.
     
  16. president_ltd

    president_ltd Member

    Joined:
    Feb 8, 2013
    Messages:
    63
    Location:
    australia
    Nice! Yeah what I'll do is send you the proposed changes on github so its essentially the same base code.
    I've had to enhance the code for supporting multiple cars, I'll send you that too.
     
  17. BizJet

    BizJet Member

    Joined:
    May 19, 2016
    Messages:
    108
    Location:
    Boston
    That would be awesome -- thanks in advance for contributing!

    Next, I'm working on the whole "Get my car ready for a trip at 9:00am tomorrow" stuff. My Google Home arrives on Tuesday, so I should be able to test it all.

    M
     
  18. grayguy

    grayguy Member

    Joined:
    Nov 8, 2016
    Messages:
    58
    Location:
    Orange County, CA
    If only Google Home could weigh out the beans, grind them, and then make a pour-over for me.
     
  19. HumanGenome

    HumanGenome Member

    Joined:
    Oct 11, 2014
    Messages:
    353
    Location:
    Sacramento, CA
    That's more like it. Forgot what forum we were on.
     
    • Funny x 1
  20. highedu

    highedu Member

    Joined:
    Dec 1, 2012
    Messages:
    655
    Location:
    East Bay Area, CA
    How did the test go?
     

Share This Page