Open evanrich opened 5 years ago
I cannot tell for the older version, i just adapted the whole Dockerfile now, and it works fine for me. ofcoz you need the application/json request header, the python modules cares for it. Is your Docker container maybe connecting through a proxyserver?
Try the new dockercompose. It should be better.
I haven't tried the compose yet, just tried building the docker container as-is so i could toss it in my kubernetes cluster. Literally did the following steps:
1.) git clone...
2.) docker build -t teslaapi:latest .
3.) docker run -p 3000:3000 --name teslaapi3 -e "TESLA_USERNAME=
Get the following output:
Starting influxdb...
influxdb process was started [ OK ]
Starting Grafana Server: failed!
Failed to initialize Owner API
going straight to the internet, no proxy. I am able to resolve, although not ping the owner-api.teslamotors.com hostname so DNS isn't an issue:
ping owner-api.teslamotors.com
PING owner-api.vn.tesla.services (205.234.31.120) 56(84) bytes of data.
So I went and changed my password, from the 40+ character one I had (with "%" in it), to some 16 character one without "%" in it. Ran the container again, it now works. I don't have a lot of time to debug now, but I'm guessing maybe "%" isn't being parsed correctly in your code. I'll try to debug later this week but for now, it works without a very long password + special characters.
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...dr: old value: , new value: 0
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...ft: old value: , new value: 0
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...is_user_present: old value: , new value: False
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...locked: old value: , new value: True
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...media_state: old value: , new value: {'remote_control_enabled': True}
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...notifications_supported: old value: , new value: True
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...odometer: old value: , new value: 55715.782341
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...parsed_calendar_supported: old value: , new value: True
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...pf: old value: , new value: 0
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...pr: old value: , new value: 0
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...remote_start: old value: , new value: False
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...remote_start_supported: old value: , new value: True
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...rt: old value: , new value: 0
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...software_update: old value: , new value: {'expected_duration_sec': 2700, 'status': ''}
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...speed_limit_mode: old value: , new value: {'min_limit_mph': 55, 'active': False, 'max_limit_mph': 90, 'current_limit_mph': 56.0, 'pin_code_set': True}
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...sun_roof_percent_open: old value: , new value: 0
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...sun_roof_state: old value: , new value: unknown
2019-04-16 03:31:01 DEBUG Value Change, SG: vehicle_state: Logging...valet_mode: old value: , new value: False
2019-04-16 03:31:01 INFO Writing Points to Influx: vehicle_state
2019-04-16 03:31:01 INFO Asleep since: 0 Sleeping for 1 seconds..
2019-04-16 03:31:02 DEBUG Car State: online Poll Interval: 1
2019-04-16 03:31:02 DEBUG >> Request vehicle data
2019-04-16 03:31:03 DEBUG Only minimal range difference received. No change registered to avoid wakelock.
2019-04-16 03:31:03 DEBUG Only minimal range difference received. No change registered to avoid wakelock.
2019-04-16 03:31:03 DEBUG Only minimal range difference received. No change registered to avoid wakelock.
2019-04-16 03:31:03 DEBUG starting thread elevator: <redacted>
Lockfile detected, skipping
2019-04-16 03:31:03 INFO Asleep since: 0 Sleeping for 2 seconds..
2019-04-16 03:31:04 DEBUG Elevation: 27
DEBUG:apiscraper:Elevation: 27
2019-04-16 03:31:05 DEBUG Car State: online Poll Interval: 2
DEBUG:apiscraper:Car State: online Poll Interval: 2
Just a guess - lines 72 and 73 of the Dockerfile use a sed one-liner to substitute the environment variables of TESLA_USERNAME and TESLA_PASSWORD into the config.py file and it's likely % or otherwise reserved characters is the problem.
So I went and changed my password, from the 40+ character one I had (with "%" in it), to some 16 character one without "%" in it. Ran the container again, it now works. I don't have a lot of time to debug now, but I'm guessing maybe "%" isn't being parsed correctly in your code. I'll try to debug later this week but for now, it works without a very long password + special characters.
I am running into a similar issue, originally I did have symbols in my password, but even after changing my password to be only alpha numeric characters I get the same error.
I am getting the "failed to initialize Owner API" here too. I just finished installing, so it could be a setup-problem. However, I know 100% sure that:
Tried running your docker example, verbatim (didn't change anything),, and whne it starts up exits with a 401 unauthorized:
If I use POSTMAN to test this, it works...not sure what it is in your code, but something's off:
I left part of my password in in case that might be the issue has & and % in it). from what I can tell, the url you query is correct, and the client secret /ID match what i've found in other examples for tesla api.. only thing i can think of is either the password isn't being parsed right or something else.
Edit: In postman, when i took out "content-type: application/json", i got a 401 in postman. looking at teslajson.py, i dont see any headers being sent on the get?