npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-tesla

v2.0.0

Published

Node red module to control Tesla vehicles and devices

Downloads

118

Readme

Node red contrib tesla

Node red nodes for controlling and communicating with Tesla devices, like the Model 3 and Model S electric cars. Based on the TeslaJS library.

How to install:

Run npm install node-red-contrib-tesla --save or just install it from the Node-red dashboard (manage palette).

2.0 updates:

I made a lot of changes in this update:

  • new auth flow (email and refresh token). The teslaJS library is no longer used to fetch the token, but it is still used for all other commands. Therefor, the newer commands (like setting the charging amps) are not supported just yet. Just be patient a bit longer, i will add them in time.
  • Autowakeup is now a setting (it was always enabled, now you can choose). It's also overwritable by setting msg.autoWakeUp.
  • Auto-retrying the wakeup command 5 times with 4 second intervals. In my case this was always enough to get any command to work. No more complex try-catch-delay nodes needed!
  • auto fetching the vehicle list
  • Node statusses

How to use:

First of all, you need a third party solution to generate a Tesla API refresh token, for example:

This package only has one node (and one configuration node).
When you add the tesla api node to your flow, you must create a new configuration with your tesla account email and refresh token. Access tokens will be generated automatically by the node whenever needed.

Node: tesla api

This is the node that allows you to send commands to the Tesla api. Create a tesla account configuration (see above), and then deploy the node first. Then open (edit) it again. Now the vehicle list should be populated automatically. The vehicle id can also be set by setting the msg.vehicleID property. Make sure to use the id_s property from the Tesla API response. You can select a command from the list, or set the msg.command property to override it. Some commands require extra arguments. Set the msg.commandArgs property with an object of the required arguments. For example, when you use the navigationRequest command, you need 3 arguments: subject, text, and locale.

msg.commandArgs = {subject: "my subject value", text: "My text value", locale: "en"} 

Select 'Wakeup car automatically', but you can also override this by setting then msg.autoWakeUp property. Any output returned by the command will be set on the msg.payload property.

See example flow in ./src/examples for more details.

Work in progress

This node should be fairly stable, but i haven't tested any devices other than the Model 3. In the future, i hope to be able to support all Tesla devices, including the Powerwall and solar installations.

FAQ

I am getting 404 responses

You have probably used the wrong vehicle Id. Use the vehicles command and use the id_s property from the response.

I am getting a 408 response

This means that your vehicle is not awake, or not able to respond for another reason. Selecting autoWakeup is the easiest solution. When selected, the node will try waking up the car first. It will automatically retry 5 times. Sometimes this may not be enough. The vehicle may have bad reception or no connection at all. Just try again later.

How do i login, enter the captcha or my MFA token?

Since Tesla updated it's authentication flow, it is no longer possible to login automatically. You need to use a third party solution to obtain a refresh token. This token is valid for a long time, and the api node will automatically fetch a new access token whenever necessary. A few third party options to generate a Tesla refresh token: