Skip to content
forked from brianmay/ex_tesla

Unofficial thin elixir wrapper for Tesla API.

License

Notifications You must be signed in to change notification settings

bowyern/ex_tesla

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExTesla

Unofficial thin elixir wrapper for Tesla API. As per unofficial documentation.

Installation

If available in Hex, the package can be installed by adding ex_tesla to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_tesla, "~> 0.0.1"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_tesla.

Sample Usage

{:ok, token} = ExTesla.get_token
client = ExTesla.client(token)
{:ok, result} = ExTesla.list_all_vehicles(client)
Enum.each(result, fn vehicle ->
    IO.puts(vehicle["display_name"])
    IO.inspect(vehicle)

    {:ok, vehicle_state} = ExTesla.get_vehicle_state(client, vehicle)
    IO.inspect(vehicle_state)

    {:ok, charge_state} = ExTesla.get_charge_state(client, vehicle)
    IO.inspect(charge_state)

    {:ok, climate_state} = ExTesla.get_climate_state(client, vehicle)
    IO.inspect(climate_state)

    {:ok, drive_state} = ExTesla.get_drive_state(client, vehicle)
    IO.inspect(drive_state)
end)

...

# Some time elapsed, need to check token hasn't expired.
{:ok, token} = ExTesla.check_token(token)
client = ExTesla.client(token)
{:ok, result} = ExTesla.list_all_vehicles(client)

Disclaimers

This API should not be considered final and is subject to change.

About

Unofficial thin elixir wrapper for Tesla API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Elixir 100.0%