mlowijs / tesla_api

Lightweight Python API client for the Tesla API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Howto use the Vehicle, Charge and Controls classes?

rgroothuis opened this issue · comments

I'm trying to use commands like:

v.charge.get_state
v.controls.flash_lights()

But each time I get error messages from Python.

Can you provide some more working examples on how to use the various functions within those classes?

For example when using:

data = v.get_state
print data['response']

I get the error message:

TypeError: 'instancemethod' object has no attribute 'getitem'

Hi!

It should be something like:

client = TeslaApiClient(your_email, your_password)
vehicles = client.list_vehicles()
state = vehicles[0].get_state()

The flash_lights() call looks fine to me, which error do you get when calling that one?

For example when using:

data = v.get_state
print data['response']

I get the error message:

TypeError: 'instancemethod' object has no attribute 'getitem'

The flash_lights() call looks fine to me, which error do you get when calling that one?

Thanks for the feedback, I think that was an indent problem in the script, now it seems to be working.

Hi!

It should be something like:

client = TeslaApiClient(your_email, your_password)
vehicles = client.list_vehicles()
state = vehicles[0].get_state()

Excellent, this is what I was looking for, this is working now. Thanks.