Controlling Tesla with voice using Alexa and Homeseer

Although it has been about two years since my last post on home automation I haven’t been doing nothing, it’s basically laziness and a lack of documentation I’m blaming it on! Since then I have moved from Vera to HomeAssistant and then finally to HomeSeer which is the system that I am currently using. There are plenty of reasons of me taking this journey and I will probably get back to that in a later post, but for now this is to be a guide on how to enable voice control of a Tesla using Alexa and Homeseer. Enjoy!

Pre requisites:

  • This guide is written for the linux version of Homeseer running on Ubuntu Server 17.04, it could be that this would work on a raspberry pi as well, but I have not tested that.
  • A running Homeseer instance on a linux server with Alexa already set up to control your devices, see here for more information.

Equipment used in this example:


There are two ways of controlling a Tesla through Alexa:

  1. Using an already available skill from the skill directory of Alexa. One example can be found here but there are several different ones. The pros to this is that it is very easy to set up and only requires you to fill inn username and password to your Tesla in the Amazon skill itself. The downsides are that you have to use the “Alexa, tell “skill” to turn the heat up in the car” way of communicating with Alexa instead of “Computer, turn on car heating” which you can use with the Homeseer skill itself. Second thing is that I am a little reluctant of giving up my username and password to anyone on the Internet and would prefer it to stay stored inside my house.
  2. Controlling a Tesla through the use of the Homeseer Alexa skill which we will be going through here.


  1. First we need to enable us to communicate with the tesla. I run Homeseer on a linux server called Homeseer, yes..very creative.. I have another server called Media where I run a lot of other services to reduce the amount of stuff installed on the Homeseer server. So what I want to do is to have the Homeseer server communicate with the Media server which will be the one communicating with my Tesla. The communication chain will basically be:
    Voice -> Alexa -> Homeseer Alexa Skill -> Homeseer -> Tesla Virtual Device in Homeseer -> Tesla REST call to Tesla.This means that I start at the end with the interface to Tesla which I will implement on my Media server (also a linux machine).
  2. A lot of awesome people have put together the Tesla API and packetized it into a an implementation in Node.js so that we can easily use it. If this is all greek to you then just follow the instructions 🙂
    Log on to your server using ssh and run the following commands:
    NPM and NodeJS installation:

    curl -sL | sudo -E bash -
    sudo apt-get install -y nodejs
    sudo apt-get install -y build-essential
  3. Now we are ready to install the interface to Tesla using the NPM packet manager, the installation guide and description of the interface can be found here:sudo npm install -g teslams

    Then go to the folder where the teslams was installed, for me that folder was “/usr/lib/node_modules/teslams”. Run the following command:

    npm install
  4. Now you have installed the interface! Now we should test it to see if it is working. There are many ways of using this interface but the easiest to get started with is the teslacmd command. Run the following command on the same server as you installed the teslams packet:teslacmd -u insertusernameformytesla -p passwordformytesla -i

    This should print out information on hour car! Replace the “i” with a “H” and the car horn should honk twice. More information on how to use the teslacmd.js is provided on the git repo page of the teslams Nodejs packet

  5. Now that we have my Media server communicating with Tesla it’s about time we create a virtual device in HomeSeer to integrate with.
    It’s pretty simple, just create a new device.. Mine looks like this:
  6. This device will then be picked up by your Alexa which you can confirm by going to and opening the smart home menu and clicking discover.
  7. Now we are going to use the virtual device we set up to trigger the interface to Tesla when it is turned on. This is done by making an event in Homeseer that then triggers an ssh command like we did with teslacmd. Here is what my event looks like:

  8. If you are running the Teslams interface we installed on the same server you have to make som changes to the event to run the command as a sh instead of ssh as I am doing. But as I am running this on a separate server I am sending the command from the Homeseer server via SSH to the Media server and running the teslacmd command on the Media server. To be able to do this without using username and password you have to set up key based login which is detailed here: To be able to run the command you have to enable key based login as the root user on the Homeseer machine. To do this step by step do the following:
    Log into the Homeseer machine with ssh and run the following command to be logged in as the root user:

    sudo su

    Now run the following commands to enable key based login between the servers:
    Homeseer server (press enter on all questions during the next command to go with default passwordless login):

    ssh-copy-id username@your_server_ip
  9. Now you should be able to run the event from HomeSeer by clicking the blue play button in the event.

You should now be able to say Alexa turn on “whatever you called your virtualdevice” to start the heater in the car as my event did. Mine is for example called “car heating” so my phrase is “Computer, turn on car heating”.


Got something to say? Go for it!