Giter VIP home page Giter VIP logo

tesla's Introduction

Tesla Custom Integration

GitHub Release GitHub all releases GitHub release (latest by SemVer) GitHub Activity

License

hacs Project Maintenance BuyMeCoffee

Discord Community Forum

A fork of the previous official Tesla integration in Home Assistant which has been removed due to Tesla login issues. Do not report issues to Home Assistant.

To use the component, you will need an application to generate a Tesla refresh token:

Installation

  1. Use HACS, in HACS > Integrations > Explore & Add Repositories search for "Tesla". After adding this https://github.com/alandtse/tesla as a custom repository. Skip to 7.
  2. If you do not have HACS, use the tool of choice to open the directory (folder) for your HA configuration (where you find configuration.yaml).
  3. If you do not have a custom_components directory (folder) there, you need to create it.
  4. In the custom_components directory (folder) create a new folder called tesla_custom.
  5. Download all the files from the custom_components/tesla_custom/ directory (folder) in this repository.
  6. Place the files you downloaded in the new directory (folder) you created.
  7. Restart Home Assistant.
  8. Add Integration or in the HA UI go to "Settings" -> "Devices & Services" then click "+" and search for "Tesla Custom Integration".
  9. For most vehicles, you will need to the Tesla Fleet API Proxy (see below).

Note: This integration will wake up your vehicle(s) during installation.

Tesla Fleet API Proxy

Tesla has deprecated the Owner API for most vehicles in favor of a new Fleet API with end-to-end encryption. You'll know you're affected if you see errors in the log when attempting to send commands (sensors will work regardless)

If your vehicle is affected by this (most likely), you'll need to install the Tesla HTTP Proxy add-on and configure this component to use it. This requires a complex setup; see here for details. After configuring the add-on, tick the box for "Fleet API Proxy" in this component, and the config flow will autofill your Client ID, Proxy URL, and SSL certificate.

Usage

The Tesla integration offers integration with the Tesla cloud service and provides presence detection as well as sensors such as charger state and temperature.

This integration provides the following entities for vehicles:

  • Binary sensors - charger connection, charging status, car online, parking brake, car asleep, and door status.
  • Buttons - horn, flash lights, wake up1, force data update1, trigger HomeLink, and remote start. Note: The HomeLink button is disabled by default as some vehicles don't have this option. Enable via configuration/entities if desired.
  • Climate - turn HVAC on/off, set target temperature, set preset modes (defrost, keep on, dog mode and camp mode).
  • Device tracker - car location1, and active route destination.
  • Cover - Charger door, frunk, trunk, and windows.
  • Locks - door lock, and charge port latch lock. Note: Set state to heat_cool or off to enable/disable your Tesla's climate system via a scene.
  • Selects - seat heaters and cabin overheat protection2. Note: Turning on a heated seat will cause the climate to turn on.
  • Sensors - battery level, charge rate, energy added, charger power, inside/outside temperature, odometer, estimated range, time charge complete, TPMS pressure, active route arrival time and distance to arrival.
  • Switches - heated steering wheel, charger, sentry mode, polling, and valet mode.1.
  • Update - software update2

1 Diagnostics entities.
2 Configuration entities.

This integration provides the following entities for energy sites:

  • Binary sensors - Powerwall charging and grid status.
  • Selects - grid charging, export rule and operation mode.
  • Sensors - solar power, grid power, load power, battery level, battery Wh remaining and backup reserve.

Options

Tesla options are set via Configuration -> Integrations -> Tesla -> Options.

  • Seconds between polling - referred to below as the polling_interval.
  • Wake cars on start - Whether to wake sleeping cars on Home Assistant startup. This allows a user to choose whether cars should continue to sleep (and not update information) or to wake up the cars potentially interrupting long term hibernation and increasing vampire drain.
  • Polling policy - When do we actively poll the car to get updates, and when do we try to allow the car to sleep. See the Wiki for more information.
  • Sync Data from TeslaMate via MQTT - Enable syncing of Data from an TeslaMate instance via MQTT, essentially enabling the Streaming API for updates. This requires MQTT to be configured in Home Assistant.

Potential Battery impacts

Here are some things to consider and understand when implementing the Tesla component and its potential effect on your car's battery.

  • The polling_interval determines when to check if the car is awake and new information is available, but the Tesla integration will not wake up a sleeping car during this polling. By default, the polling will occur every 660 seconds. Polling a car too frequently can keep the car awake and drain the battery. Different firmware versions and measurements of Tesla cars can take from 11 to 15 minutes for sleep mode to occur. There is no official information on sleep mode timings so your mileage may vary and you should experiment with different polling times for an optimal experience.
  • The car will, however, be woken up when a command is actively sent to the car, such as door unlock or turning on the HVAC. It will then also fetch updated information while the car is awake based on the polling_interval.
  • The car can intentionally be woken up to fetch recent information by sending a harmless command, for example, a lock command. This can be used in an automation to, for example, ensure that updated information is available every morning. (Note that the command must be valid for that specific car model. So locking the frunk of a Model 3 will not wake up that car).
  • You can also toggle the polling switch on/off to disable polling of the vehicle completely via automations or the Lovelace UI.

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines

Component built with integration_blueprint.


tesla's People

Contributors

actions-user avatar alandtse avatar bdraco avatar carleeno avatar carryonrewardless avatar cguedel avatar dagstuan avatar danielp370 avatar dependabot[bot] avatar ehendrix23 avatar epenet avatar functionpointer avatar gkwok1 avatar ileodo avatar inthedaylight14 avatar ljungqvist avatar llamafilm avatar megabytemb avatar mitchellhayes avatar mrpaular avatar nitin-pandita avatar olen avatar pre-commit-ci[bot] avatar purcell-lab avatar scop avatar shred86 avatar skipishere avatar smty2018 avatar the00dustin avatar wrt54g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tesla's Issues

Expose Charging Rate (Amps)

Is your feature request related to a problem? Please describe.
I would like to be able to directly control the car's charging rate. THis is now possible via the new API endpoint CHARGING_AMPS (requires vehicle 2021.36.5+).

Describe the solution you'd like
A number entity that lets you set the current, from 5 amps to the vehicle maximum (too tricky? Could just use 48, but some cars won't take more than 32).

Describe alternatives you've considered
Just calling the custom api via the below from an automation triggered by an input_number works well, but it would be nice to be able to rate limit it, check for errors etc.

service: tesla_custom.api
data:
  command: CHARGING_AMPS
  parameters:
    path_vars:
      vehicle_id: '{{ state_attr(''binary_sensor.<car_name>_online_sensor'', ''id'') }}'
    charging_amps: 16

Additional context
Until now i've been using TWCManager to control the charge rate using the wall charger itself. The use case being to track solar production and charge your car using solar power exclusively. TWCManager is somewhat error prone. The codebase is a bit unstable, and it requires a hardware hack i'd just as soon eliminate if possible.

Unexpected error fetching tesla_custom data: get() got an unexpected keyword argument 'data'

Version of the custom_component

v1.2.0

Describe the bug

The solar panel entity doesn't seem to be able to fetch data.

Debug log

2021-10-18 10:22:28 ERROR (MainThread) [custom_components.tesla_custom] Unexpected error fetching tesla_custom data: get() got an unexpected keyword argument 'data'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/tesla_custom/__init__.py", line 291, in _async_update_data
    return await self.controller.update()
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 903, in update
    return any(await asyncio.gather(*tasks))
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 830, in _get_and_process_energysite_data
    data = await self.api(
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 166, in wake_up
    result = await wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 1179, in api
    return await self.__connection.post("", method="get", data=kwargs, url=uri)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/connection.py", line 167, in post
    return await self.__open(
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/connection.py", line 204, in __open
    resp = await getattr(self.websession, method)(
TypeError: get() got an unexpected keyword argument 'data'

AttributeError: 'TeslaDataUpdateCoordinator' object has no attribute 'async_config_entry_first_refresh'

Logger: homeassistant.config_entries
Source: custom_components/tesla/init.py:155
First occurred: 10:45:30 AM (1 occurrences)
Last logged: 10:45:30 AM

Error setting up entry [email protected] for tesla
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 239, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/tesla/init.py", line 155, in async_setup_entry
await coordinator.async_config_entry_first_refresh()
AttributeError: 'TeslaDataUpdateCoordinator' object has no attribute 'async_config_entry_first_refresh'

Integration not showing powerwall products

Version of the custom_component

1.2.1

Describe the bug

Removed and re-added the integration and it's only showing vehicles

Debug log

(removed the vehicle portion of the response)

DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 43 days, 5:58:44
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {}
DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{"energy_site_id":XXX,"resource_type":"battery","site_name":"XXX","id":"STEXXXX","gateway_id":"XXX","asset_site_id":"XXX","energy_left":17850.21052631579,"total_pack_energy":27686,"percentage_charged":64.47377926141657,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":-1340,"sync_grid_alert_enabled":true,"breaker_alert_enabled":false,"components":{"battery":true,"battery_type":"ac_powerwall","solar":true,"solar_type":"pv_panel","grid":true,"load_meter":true,"market_type":"residential"}}],"count":3}

use mdi:car-connected rather than mdi-update for the update-switch

I find the Tesla's use of the word 'update' confusing. It seems to expose:

  • update available - a sensor indicating that there is an update for the car's software.
  • update-switch - an entity controlling whether HA continues to poll the car.

I think it would be better if we used the "mdi:car-connected" icon for the update-switch, and considered renaming it to 'enable polling' or 'enable scans' (as 'scan' is the word used in the configuration).

I've tweaked my dashboard to show these values so that I'm no longer confused, but I wonder if others might benefit from making the change in the actual integration.

image

Slow reaction

It takes up to 40 seconds after command is sent to the car before it reacts. From the Tesla-app it takes max 5 seconds. And the car is not asleep.

Feature Request: implement requested charge rate (amps)

Is your feature request related to a problem? Please describe.
The Tesla API recently introduced new functionality related to setting and reading the preferred charging rate in Amps and it would be great to have this included (without customising yaml with new services etc).

The use-case includes:

  • automation of charging rate to trim charging so that it stays within solar generation limits.
  • accelerated charging before power prices increase.
  • adjusting usage when other high-load devices are operating.

Describe the solution you'd like
A method to read the charge_current_request and charge_current_request_max values (HA sensors?) and a method to set the charging current ideally supported through the standard HA UI (which entity type? Requested Current (amps) will be 1 - 40 (or rather, 1 to charge_current_request_max)

Describe alternatives you've considered
Manually adjusting the charge rate in the app, or using a different tesla automation app.

See also discussion in telsajsonpy: zabuldon/teslajsonpy#246

FR: Set charge limit

Expose https://www.teslaapi.io/vehicles/commands#set-charge-limit

I'm trying to limit how much my car is allowed to charge at home, since I only have inefficient 120v home charging and time of use restrictions. However, I still want to allow home charging up to a certain safety amount (say 40%), rather than always enabling or disabling charging at home.

I could do fancy things like poll the current charge state and use the enable/disable charging switch, but it's a lot more complicated compared to the API which does exactly this, and it also runs into potential problems with the car going to sleep and the charge state not necessarily being available.

Thanks

Cannot import name 'get_content_type' from 'authcaptureproxy.helper'

Version of the custom_component

All

Configuration

Add your logs here.

Describe the bug

After an update of HA, tesla_custom will not load.

Debug log


Logger: homeassistant.config_entries
Source: config_entries.py:671
First occurred: 9:29:15 PM (1 occurrences)
Last logged: 9:29:15 PM

Error occurred loading configuration flow for integration tesla_custom: cannot import name 'get_content_type' from 'authcaptureproxy.helper' (/usr/local/lib/python3.8/site-packages/authcaptureproxy/helper.py)

Error: Need oauth credentials

I updated to the latest version of the custom integration, generated the SSO keys using the "Tesla Tokens" app. When I type in my email address and paste the SSO key I get the following error:

Logger: custom_components.tesla_custom.config_flow
Source: custom_components/tesla_custom/config_flow.py:167
Integration: Tesla Custom Integration (documentation, issues)
First occurred: 6:13:13 PM (9 occurrences)
Last logged: 7:42:54 PM

Authentication error: Need oauth credentials

I also tried using the API token as the email address just in case (but it didn't work either).

What is polling switch?

I see this switch but unsure what it does?

Also, what is the guidance of polling interval? Is this a basic polling interval or is there any special heuristics to reduce polling/vampire drain?

Add support for solar generation totals (not just instantaneous)

Is your feature request related to a problem? Please describe.
No.

Describe the solution you'd like
I'd like to see how much power I've generated today, not just the current output of the array.

Describe alternatives you've considered
I tried using the sum integration but it doesn't seem to work properly.

Additional context
Here's a screenshot showing how the estimated solar production integration looks and the Tesla solar report directly above it:
image

Add option to control seat heaters

I would love to see an option to control the seat heaters (all 5 of them).

Before I was aware of this integration, I had my own server that will turn on my car's HVAC and decide whether to turn on the seat heaters based on the outside temperature when I'm leaving my house. I'm trying to move that logic inside of Home Assistant, but there's no support for seat heaters.

Polling switch - state not retained after HA restart

Version of the custom_component

1.0.0

Configuration

N/A

Describe the bug

If I turn off the polling switch for my car and then restart HA, the polling switch is turned back on. I would expect the state to be retained between HA restarts.

Debug log

N/A

Control the charge cable port lock/unlock via the integration

It would be great to be able to control the charge port lock with a HA routine or Node Red flow. I presume its the charger sensor entity is to show if a cable is plugged in or not but cant find a sensor the port lock/unlock....not sure if this is exposed via the Tesla API or not?

thanks

Some of the entities don't seem to work

Version of the custom_component

Latest

Configuration

Logger: homeassistant
Source: custom_components/tesla_custom/sensor.py:108
Integration: Tesla Custom Integration (documentation, issues)
First occurred: 11:08:57 (22 occurrences)
Last logged: 11:30:09

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/config/custom_components/tesla_custom/tesla_device.py", line 112, in refresh
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 501, in _async_write_ha_state
    extra_state_attributes = self.extra_state_attributes
  File "/config/custom_components/tesla_custom/sensor.py", line 108, in extra_state_attributes
    "charger_power": self.tesla_device.charger_power,
AttributeError: 'ChargingSensor' object has no attribute 'charger_power'

Describe the bug

It might be not a bug, but I can't see or do the following :

  • see the battery level of the car
  • open or close the doors of the car (only the trucks)
  • Tesla mileage sensor
  • Tesla location tracker

Debug log


Add your logs here.

After upgrading to 1.1.1, getting "unknown error occured" when attempting to authenticate during re-setup

Version of the custom_component v1.1.1

Configuration

## This configuration.yaml file is provided by the Home Assistant Core iocage-jail for TrueNAS Core
# Learn more at https://www.home-assistant.io/docs/configuration

homeassistant:
  # https://www.home-assistant.io/docs/configuration/customizing-devices/
  customize: !include customize.yaml
  # https://www.home-assistant.io/docs/configuration/packages/#create-a-packages-folder
  packages: !include_dir_named packages

http:
  # https://www.home-assistant.io/integrations/http/#ip_ban_enabled
  ip_ban_enabled: False
  login_attempts_threshold: 5

## Configure a default setup of Home Assistant Core (frontend, api, etc)
# Learn more at https://www.home-assistant.io/integrations/default_config
default_config:

# Text to speech
tts:
  - platform: google_translate

# Frontend
frontend:
  themes: !include_dir_merge_named themes
  
# Custom Work
media_player:
  - platform: yamaha
    host: 192.168.86.167
    source_names:
      HDMI1: "Apple TV"
      HDMI2: "Shield"
      HDMI3: "PS5"
      HDMI4: "Switch"
      HDMI5: "Blu-ray"
    zone_names:
      Main_Zone: "Living Room"
      Zone_2: "Patio"
      
sleepiq:
  username: !secret 
  password: !secret 

wake_on_lan:

samsungtv:
  - host: 192.168.86.62 
    turn_on_action:
      - service: wake_on_lan.send_magic_packet
        data:
          mac: BC:8C:CD:D8:FE:CB 
spotify:
  client_id: !secret 
  client_secret: !secret 

sensor:
  - platform: bitcoin
    display_options:
      - exchangerate
      - trade_volume_btc

#aarlo:
#  username: !secret
#  password: !secret arlo_password
#  refresh_devices_every: 2
#  stream_timeout: 120
#  tfa_source: push
#  tfa_type: PUSH

#alarm_control_panel:
#  - platform: aarlo
#    away_mode_name: armed
#    home_mode_name: Geofencing
#    night_mode_name: night
#    trigger_time: 30
#    alarm_volume: 8

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
light: !include lights.yaml
#tesla_cc: !include tesla.yaml

logger:
  default: info
  logs:
    hacs: debug
    custom_components.hacs: debug
    queueman: debug
    aiogithubapi: debug

Describe the bug

Unable to set up "Tesla Custom Integration" via the Integrations, when adding email and refresh token error "Unknown Error Occurred" there is MFA on the account, but it worked fine prior to upgrading.

Debug log


Add your logs here.

This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/tesla_custom/config_flow.py:160
Integration: tesla_custom (documentation, issues)
First occurred: 12:42:20 (3 occurrences)
Last logged: 12:43:18

Error handling request
Traceback (most recent call last):
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
    return await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/config/config_entries.py", line 157, in post
    return await super().post(request, flow_id)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/data_entry_flow.py", line 111, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 198, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 256, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/home/homeassistant/homeassistant/custom_components/tesla_custom/config_flow.py", line 56, in async_step_user
    info = await validate_input(self.hass, user_input)
  File "/home/homeassistant/homeassistant/custom_components/tesla_custom/config_flow.py", line 160, in validate_input
    result = await controller.connect(test_login=True)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/teslajsonpy/controller.py", line 349, in connect
    self.__energysite_name[energysite_id] = energysite["site_name"]
KeyError: 'site_name'

Entities are not keeping their last known value

I'm not 100% sure if this is a bug or a feature request. As reported in #4 many of the entities stay in an unknown state until the car is awakened. This is understandable if the car was never awake when the first (or any subsequent) polling happen.

The problem I see is after a successful update happens (the car was awake when polled). If the car goes back to sleep, all the entities go back to being unknown. This shouldn't be the case for most (if not all) of the entities. When a car is asleep, many of these values remain constant. For example, the mileage_sensor should show the last valid value and keep that value until a successful update happens, the same should happen with the location_tracker. I would argue that this behavior should happen with every single entity. The temperature sensor might be an exception, but I rather see the last temperature recorded in my car rather than nothing at all.

Another issue is that some entities default to showing that some doors are actually unlocked, due to the behavior described here (and in #4). The entities are not even greyed out, showing them as unlocked and giving you the option to lock them, which will wake up the car unnecessarily. As an example (see the image in #4), the frunk and trunk locks have this problem.

An example of what we could do if these changes are implemented: we could check the battery (or range) sensors, without waking up the car, to have a rough estimate of how much battery (or range) the car has. I know that there's a drain in the battery even in sleep mode, and it could be as much as 1-2% per day. Nonetheless, being able to have a rough estimate without having to wake up the car is very helpful.

Error in logs when trying custom component through HACS

Operating System
Home Assistant OS 5.13

Core
Version
core-2021.4.6
Newest Version
core-2021.5.0b1

Supervisor
Version
supervisor-2021.04.3
Newest Version
supervisor-2021.04.3

Logger: custom_components.tesla
Source: custom_components/tesla/init.py:253
Integration: Tesla (documentation, issues)
First occurred: 7:58:48 (33 occurrences)
Last logged: 8:30:48

Unexpected error fetching tesla data: 'str' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 173, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/tesla/init.py", line 253, in _async_update_data
return await self.controller.update()
File "/usr/local/lib/python3.8/site-packages/teslajsonpy/controller.py", line 719, in update
cars = await self.get_vehicles()
File "/usr/local/lib/python3.8/site-packages/backoff/_async.py", line 133, in retry
ret = await target(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/teslajsonpy/controller.py", line 407, in get_vehicles
return (await self.__connection.get("vehicles"))["response"]
File "/usr/local/lib/python3.8/site-packages/teslajsonpy/connection.py", line 90, in get
return await self.post(command, "get", None)
File "/usr/local/lib/python3.8/site-packages/teslajsonpy/connection.py", line 112, in post
self.code = await self.get_authorization_code(
File "/usr/local/lib/python3.8/site-packages/teslajsonpy/connection.py", line 405, in get_authorization_code
html = await resp.text()
TypeError: 'str' object is not callable

API is called to refresh every 1 minute instead of every 10 mins

Version of the custom_component

using 1.2.1

Describe the bug

The Tesla API is called every 1 minute. I thought the cadence should be throttled at 10 mins (600 seconds?)

Debug log


2021-10-19 10:24:30 DEBUG (MainThread) [teslajsonpy.controller] Updating 184280630899
2021-10-19 10:24:30 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 43 days, 18:37:27
2021-10-19 10:24:30 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/184280630899/live_status {}
2021-10-19 10:24:30 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":2531,"timestamp":"2021-10-19T10:24:20-07:00"}}
2021-10-19 10:24:30 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.287 seconds (success: True)
2021-10-19 10:25:30 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 43 days, 18:36:27
2021-10-19 10:25:30 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles {}
2021-10-19 10:25:30 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[],"count":0}
2021-10-19 10:25:30 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {}
2021-10-19 10:25:30 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{"energy_site_id":184280630899,"resource_type":"solar","site_name":"Villa Madrona","id":"c7ff07a3-0dad-4b6a-a8d9-1674bd7d7385","asset_site_id":"33d9bc12-b870-4189-8ce7-c0799de0381d","solar_power":1120,"solar_type":"pv_panel","sync_grid_alert_enabled":false,"breaker_alert_enabled":false,"components":{"battery":false,"solar":true,"solar_type":"pv_panel","grid":true,"load_meter":false,"market_type":"residential"}}],"count":1}
2021-10-19 10:25:30 DEBUG (MainThread) [teslajsonpy.controller] Updating 184280630899
2021-10-19 10:25:30 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/184280630899/live_status {}
2021-10-19 10:25:30 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":0,"grid_status":"Unknown","grid_services_active":false,"timestamp":"2021-10-19T10:25:30-07:00"}}
2021-10-19 10:25:30 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.697 seconds (success: True)
2021-10-19 10:26:30 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 43 days, 18:35:27
2021-10-19 10:26:30 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles {}
2021-10-19 10:26:30 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[],"count":0}
2021-10-19 10:26:30 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {}
2021-10-19 10:26:30 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{"energy_site_id":184280630899,"resource_type":"solar","site_name":"Villa Madrona","id":"c7ff07a3-0dad-4b6a-a8d9-1674bd7d7385","asset_site_id":"33d9bc12-b870-4189-8ce7-c0799de0381d","solar_power":1120,"solar_type":"pv_panel","sync_grid_alert_enabled":false,"breaker_alert_enabled":false,"components":{"battery":false,"solar":true,"solar_type":"pv_panel","grid":true,"load_meter":false,"market_type":"residential"}}],"count":1}
2021-10-19 10:26:30 DEBUG (MainThread) [teslajsonpy.controller] Updating 184280630899
2021-10-19 10:26:30 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/184280630899/live_status {}
2021-10-19 10:26:30 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":3429,"timestamp":"2021-10-19T10:26:29-07:00"}}
2021-10-19 10:26:30 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.342 seconds (success: True)
2021-10-19 10:27:30 DEBUG (MainThread) [teslajsonpy.controller] Updating 184280630899
2021-10-19 10:27:30 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 43 days, 18:34:27
2021-10-19 10:27:30 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/184280630899/live_status {}
2021-10-19 10:27:30 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":3101,"timestamp":"2021-10-19T10:27:29-07:00"}}
2021-10-19 10:27:30 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.173 seconds (success: True)

Config flow - missing attribute labels

Version of the custom_component

1.0.0

Configuration

N/A

Describe the bug

When I go to Configuration -> Integrations and select tesla_custom, the attribute labels are missing in the config flow form, so I can't tell what I'm supposed to enter into these fields. See below screenshot.

image

HA version: 2021.9.3

Debug log

N/A

ERROR for site owner: Invalid domain for site key

Version of the custom_component

0.2.1

Configuration

n/a

Describe the bug

In the tesla login page that is proxied, the Captcha doesn't load

image

Page URL in browser is :

https://myhomeassistantdomain/auth/tesla/proxy?config_flow_id=57a927ee399f4c178b1a6cc476ee35c1&callback_url=https://myhomeassistantdomain/auth/tesla/callback?flow_id%3D57a927ee399f4c178b1a6cc476ee35c1

Debug log

2021-09-04 19:48:24 DEBUG (MainThread) [custom_components.tesla_custom.config_flow] Found flow_id; adding 10.1.0.42 to known_ips for 300 seconds
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Received get: https://myhomeassistant.mydomain/auth/tesla/proxy?config_flow_id=e5e4f5a18c31464cae282cb57b0dc019&callback_url=https://myhomeassistant.mydomain/auth/tesla/callback?flow_id%3De5e4f5a18c31464cae282cb57b0dc019 for https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Starting auth capture proxy for https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Final headers {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15', 'Accept-Language': 'en-us', 'Referer': 'https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA', 'Accept-Encoding': 'gzip, deflate, br', 'x-tesla-user-agent': 'TeslaApp/3.10.9-433/adff2e065/android/10', 'X-Requested-With': 'com.teslamotors.tesla'}
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Attempting get to https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA
headers: {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15', 'Accept-Language': 'en-us', 'Referer': 'https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA', 'Accept-Encoding': 'gzip, deflate, br', 'x-tesla-user-agent': 'TeslaApp/3.10.9-433/adff2e065/android/10', 'X-Requested-With': 'com.teslamotors.tesla'}
cookies: <CookieJar[]>
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] GET:
https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA with
{"host": "auth.tesla.com", "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "accept-encoding": "gzip, deflate, br", "connection": "keep-alive", "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15", "accept-language": "en-us", "referer": "https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA", "x-tesla-user-agent": "TeslaApp/3.10.9-433/adff2e065/android/10", "x-requested-with": "com.teslamotors.tesla"}
returned 200:OK with response Headers([('content-type', 'text/html; charset=utf-8'), ('x-dns-prefetch-control', 'off'), ('x-frame-options', 'DENY'), ('strict-transport-security', 'max-age=15552000; includeSubDomains'), ('x-download-options', 'noopen'), ('x-content-type-options', 'nosniff'), ('x-xss-protection', '1; mode=block'), ('x-request-id', 'c98fd737-9f8d-49cf-a808-879d99dbb2bd'), ('x-correlation-id', 'c98fd737-9f8d-49cf-a808-879d99dbb2bd'), ('cache-control', 'no-store'), ('content-security-policy', "connect-src 'self'; default-src 'none'; font-src 'self' data: fonts.gstatic.com; frame-src 'self' www.google.com www.recaptcha.net; img-src 'self' data:; script-src www.recaptcha.net 'self' 'nonce-bb5c161230a3934f834a'; style-src 'unsafe-inline' 'self'"), ('etag', 'W/"709a-rs8SRDKsYNnmvSHcERim/Rvo/TU"'), ('x-response-time', '20.291ms'), ('content-encoding', 'gzip'), ('x-edgeconnect-midmile-rtt', '16'), ('x-edgeconnect-origin-mex-latency', '175'), ('originip', '209.133.79.56'), ('x-akamai-transformed', '9 6251 0 pmb=mTOE,1'), ('date', 'Sat, 04 Sep 2021 17:48:24 GMT'), ('content-length', '6090'), ('connection', 'keep-alive'), ('vary', 'Accept-Encoding'), ('set-cookie', 'tesla-auth.sid=s%3AarDrMEgjr9U7ajsldIHGSyrfT1VYPhOM.EbBQKQy24%2BbtqnGFhGA9um2eDDR%2F9Ooux3loRDg0of4; Path=/; Expires=Tue, 07 Sep 2021 17:48:24 GMT; HttpOnly; Secure; SameSite=Lax'), ('origin_hostname', 'auth.tesla.com'), ('permissions-policy', 'interest-cohort=()'), ('set-cookie', '_abck=F7596CF8A824099CB6D526AC660394D2~-1~YAAQ0nRZaIFRyZ17AQAApv/ssQax2rEvAoEVSCm+LrA0f4gPT6HUiTcheIG34/CSLRAX4nL7KKQovkSKPCIMTooj9kn0ymZcak3ASIZ0/oc9+WYGz5zCo4xH02NNn4lgkZOysy6Q4SU0M2R32lpABG96FWOXbWL/iApmiD7QDRqynv4CcS6lY8UMylB0Ee1/gbTQ3wofptmzM/UxE5oAgB6rw1VKKii8uuo8e+HhJkstLS+QoFu8qdc4VFB5nOoZxx0S9zrkPTwXVvvA6xytlF4RYmFvWkDZl44lqM3faNF8nW6AdsawHeeUqycR8F+Am8ZI6z/aOSA7jInl2kEIafUVEZKNqvBx5eiPt+wo+3/jE3ETgafUkI2elvg=~-1~-1~-1; Domain=.tesla.com; Path=/; Expires=Sun, 04 Sep 2022 17:48:24 GMT; Max-Age=31536000; Secure'), ('set-cookie', 'ak_bmsc=86D6AA52AA22E3528A4E7BFCFDAE87F5~000000000000000000000000000000~YAAQ0nRZaIJRyZ17AQAApv/ssQ2fQnUh5UB7b03KViDtLWMNQbTZ6CJrHGX0R6Q0DDYVQM3mUyzBw9tQVlrnubgKXskheZZnMZ8/wXVgEO4XDswHTloX6KXWvpKyHtWG7Pypp4rhZZM4I05xJR2/swDU8NnjfD/15pFoNjs7epWNK3jadYhslcorUH1VqPhXFTJBT5XSMazYx53SIEmtLOnoDXWO4baA4dP8522B/SAY3VfLuLuVnVDSevV7q8V4ATNcRT4iqBArQPPtNDCc0ycTQBjbhkvcHaDxkCq2hgKt1tk4N+wV/xhReTGxMV0WjKkSwmx7kevNNDnEsOr1j8DQr2fE3uJiqVeEdGJQ6L4tIm5cE39sqH7t; Domain=.tesla.com; Path=/; Expires=Sat, 04 Sep 2021 19:48:24 GMT; Max-Age=7200; HttpOnly'), ('set-cookie', 'bm_sz=C034275AB655FEF9C8B9502642C0B967~YAAQ0nRZaINRyZ17AQAApv/ssQ20xVaSdef2MBbK/UZzR3Jy+VwkejzO/wXc6ZM4C2W7qIW2woUNL6ki96UJNBl0iVqGj09qenAxyiEI2t2u1g7blIPzAgxEmhryeBU//eJROqu1+AM5055Tv4sqyxuI41nNgRcq1M+wXrfKUJt8211vrD4Km0alZG9uzqeu5kNv4AuykI9p8dbVrLjwdUB60CqOOdV6T+/SqUjfpHNpPLgua4zeVN/c9gktnEqeUbjhtuB2yjwYv/UfEJouJSEnchMKYpwTQXAe4Xixa6neXQ==~3486773~4405060; Domain=.tesla.com; Path=/; Expires=Sat, 04 Sep 2021 21:48:24 GMT; Max-Age=14400')])
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Refreshed 1 tests: ['test_url']
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine test_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Refreshed 5 modifiers: ['prepend_relative_urls', 'change_host_to_proxy', 'change_empty_to_proxy', 'prepend_url_ajax', 'prepend_url_i18n']
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine prepend_relative_urls
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for script:src /static/js/i18next.bundle.min.js -> https://myhomeassistant.mydomain/auth/tesla/proxy/static/js/i18next.bundle.min.js
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for script:src /static/js/tds4-i18n.js -> https://myhomeassistant.mydomain/auth/tesla/proxy/static/js/tds4-i18n.js
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for script:src /static/js/minimal.bundle.js -> https://myhomeassistant.mydomain/auth/tesla/proxy/static/js/minimal.bundle.js
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for script:src /static/scripts/utils.js -> https://myhomeassistant.mydomain/auth/tesla/proxy/static/scripts/utils.js
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for script:src /static/js/tds4-site.js -> https://myhomeassistant.mydomain/auth/tesla/proxy/static/js/tds4-site.js
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for script:src /static/js/tds-text-inputs--password.js -> https://myhomeassistant.mydomain/auth/tesla/proxy/static/js/tds-text-inputs--password.js
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for script:src /VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms -> https://myhomeassistant.mydomain/auth/tesla/proxy/VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for link:href /static/css/tds4-minimal.bundle.css -> https://myhomeassistant.mydomain/auth/tesla/proxy/static/css/tds4-minimal.bundle.css
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for link:href /static/css/tds4-shims.min.css -> https://myhomeassistant.mydomain/auth/tesla/proxy/static/css/tds4-shims.min.css
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for a:href /user/password/forgot -> https://myhomeassistant.mydomain/auth/tesla/proxy/user/password/forgot
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function prepend_url
[...]
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine change_host_to_proxy
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function swap_url
[...]
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Modified url for a:href https://www.tesla.com/support/tesla-app?redirect=no#privacy -> https://www.tesla.com/support/tesla-app?redirect=no
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function swap_url
[...]
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running function swap_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine change_empty_to_proxy
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine prepend_url_ajax
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Found 0 patterns for method_func
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Received get: https://myhomeassistant.mydomain/auth/tesla/proxy/VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms for https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Final headers {'Accept': '*/*', 'Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15', 'Accept-Language': 'en-us', 'Referer': 'https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA', 'Accept-Encoding': 'gzip, deflate, br', 'x-tesla-user-agent': 'TeslaApp/3.10.9-433/adff2e065/android/10', 'X-Requested-With': 'com.teslamotors.tesla'}
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Attempting get to https://auth.tesla.com/VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms
headers: {'Accept': '*/*', 'Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15', 'Accept-Language': 'en-us', 'Referer': 'https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA', 'Accept-Encoding': 'gzip, deflate, br', 'x-tesla-user-agent': 'TeslaApp/3.10.9-433/adff2e065/android/10', 'X-Requested-With': 'com.teslamotors.tesla'}
cookies: <CookieJar[<Cookie _abck=F7596CF8A824099CB6D526AC660394D2~-1~YAAQ0nRZaIFRyZ17AQAApv/ssQax2rEvAoEVSCm+LrA0f4gPT6HUiTcheIG34/CSLRAX4nL7KKQovkSKPCIMTooj9kn0ymZcak3ASIZ0/oc9+WYGz5zCo4xH02NNn4lgkZOysy6Q4SU0M2R32lpABG96FWOXbWL/iApmiD7QDRqynv4CcS6lY8UMylB0Ee1/gbTQ3wofptmzM/UxE5oAgB6rw1VKKii8uuo8e+HhJkstLS+QoFu8qdc4VFB5nOoZxx0S9zrkPTwXVvvA6xytlF4RYmFvWkDZl44lqM3faNF8nW6AdsawHeeUqycR8F+Am8ZI6z/aOSA7jInl2kEIafUVEZKNqvBx5eiPt+wo+3/jE3ETgafUkI2elvg=~-1~-1~-1 for .tesla.com/>, <Cookie ak_bmsc=86D6AA52AA22E3528A4E7BFCFDAE87F5~000000000000000000000000000000~YAAQ0nRZaIJRyZ17AQAApv/ssQ2fQnUh5UB7b03KViDtLWMNQbTZ6CJrHGX0R6Q0DDYVQM3mUyzBw9tQVlrnubgKXskheZZnMZ8/wXVgEO4XDswHTloX6KXWvpKyHtWG7Pypp4rhZZM4I05xJR2/swDU8NnjfD/15pFoNjs7epWNK3jadYhslcorUH1VqPhXFTJBT5XSMazYx53SIEmtLOnoDXWO4baA4dP8522B/SAY3VfLuLuVnVDSevV7q8V4ATNcRT4iqBArQPPtNDCc0ycTQBjbhkvcHaDxkCq2hgKt1tk4N+wV/xhReTGxMV0WjKkSwmx7kevNNDnEsOr1j8DQr2fE3uJiqVeEdGJQ6L4tIm5cE39sqH7t for .tesla.com/>, <Cookie bm_sz=C034275AB655FEF9C8B9502642C0B967~YAAQ0nRZaINRyZ17AQAApv/ssQ20xVaSdef2MBbK/UZzR3Jy+VwkejzO/wXc6ZM4C2W7qIW2woUNL6ki96UJNBl0iVqGj09qenAxyiEI2t2u1g7blIPzAgxEmhryeBU//eJROqu1+AM5055Tv4sqyxuI41nNgRcq1M+wXrfKUJt8211vrD4Km0alZG9uzqeu5kNv4AuykI9p8dbVrLjwdUB60CqOOdV6T+/SqUjfpHNpPLgua4zeVN/c9gktnEqeUbjhtuB2yjwYv/UfEJouJSEnchMKYpwTQXAe4Xixa6neXQ==~3486773~4405060 for .tesla.com/>, <Cookie tesla-auth.sid=s%3AarDrMEgjr9U7ajsldIHGSyrfT1VYPhOM.EbBQKQy24%2BbtqnGFhGA9um2eDDR%2F9Ooux3loRDg0of4 for auth.tesla.com/>]>
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] GET:
https://auth.tesla.com/VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms with
{"host": "auth.tesla.com", "accept": "*/*", "accept-encoding": "gzip, deflate, br", "connection": "keep-alive", "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15", "accept-language": "en-us", "referer": "https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA", "x-tesla-user-agent": "TeslaApp/3.10.9-433/adff2e065/android/10", "x-requested-with": "com.teslamotors.tesla", "cookie": {"_abck": "F7596CF8A824099CB6D526AC660394D2~-1~YAAQ0nRZaIFRyZ17AQAApv/ssQax2rEvAoEVSCm+LrA0f4gPT6HUiTcheIG34/CSLRAX4nL7KKQovkSKPCIMTooj9kn0ymZcak3ASIZ0/oc9+WYGz5zCo4xH02NNn4lgkZOysy6Q4SU0M2R32lpABG96FWOXbWL/iApmiD7QDRqynv4CcS6lY8UMylB0Ee1/gbTQ3wofptmzM/UxE5oAgB6rw1VKKii8uuo8e+HhJkstLS+QoFu8qdc4VFB5nOoZxx0S9zrkPTwXVvvA6xytlF4RYmFvWkDZl44lqM3faNF8nW6AdsawHeeUqycR8F+Am8ZI6z/aOSA7jInl2kEIafUVEZKNqvBx5eiPt+wo+3/jE3ETgafUkI2elvg=~-1~-1~-1", "ak_bmsc": "86D6AA52AA22E3528A4E7BFCFDAE87F5~000000000000000000000000000000~YAAQ0nRZaIJRyZ17AQAApv/ssQ2fQnUh5UB7b03KViDtLWMNQbTZ6CJrHGX0R6Q0DDYVQM3mUyzBw9tQVlrnubgKXskheZZnMZ8/wXVgEO4XDswHTloX6KXWvpKyHtWG7Pypp4rhZZM4I05xJR2/swDU8NnjfD/15pFoNjs7epWNK3jadYhslcorUH1VqPhXFTJBT5XSMazYx53SIEmtLOnoDXWO4baA4dP8522B/SAY3VfLuLuVnVDSevV7q8V4ATNcRT4iqBArQPPtNDCc0ycTQBjbhkvcHaDxkCq2hgKt1tk4N+wV/xhReTGxMV0WjKkSwmx7kevNNDnEsOr1j8DQr2fE3uJiqVeEdGJQ6L4tIm5cE39sqH7t", "bm_sz": "C034275AB655FEF9C8B9502642C0B967~YAAQ0nRZaINRyZ17AQAApv/ssQ20xVaSdef2MBbK/UZzR3Jy+VwkejzO/wXc6ZM4C2W7qIW2woUNL6ki96UJNBl0iVqGj09qenAxyiEI2t2u1g7blIPzAgxEmhryeBU//eJROqu1+AM5055Tv4sqyxuI41nNgRcq1M+wXrfKUJt8211vrD4Km0alZG9uzqeu5kNv4AuykI9p8dbVrLjwdUB60CqOOdV6T+/SqUjfpHNpPLgua4zeVN/c9gktnEqeUbjhtuB2yjwYv/UfEJouJSEnchMKYpwTQXAe4Xixa6neXQ==~3486773~4405060", "tesla-auth.sid": "s%3AarDrMEgjr9U7ajsldIHGSyrfT1VYPhOM.EbBQKQy24%2BbtqnGFhGA9um2eDDR%2F9Ooux3loRDg0of4"}}
returned 200:OK with response Headers({'last-modified': 'Mon, 26 Apr 2021 16:10:06 GMT', 'etag': '"d1dbb955755ca44a0b872a64f97c471a45b14e941f69d082c19f792576ae34fb"', 'content-type': 'application/javascript', 'content-encoding': 'gzip', 'content-length': '19642', 'expires': 'Wed, 08 Sep 2021 10:32:21 GMT', 'date': 'Sat, 04 Sep 2021 17:48:24 GMT', 'connection': 'keep-alive', 'vary': 'Accept-Encoding', 'cache-control': 'max-age=21600', 'origin_hostname': 'auth.tesla.com', 'permissions-policy': 'interest-cohort=()', 'set-cookie': '_abck=F7596CF8A824099CB6D526AC660394D2~-1~YAAQ0nRZaJ1RyZ17AQAAkwHtsQaSxPpvlS4ZvXB0GcmrdCdPk6z6KcnQyaI8/CT08szpvUEa/pGvWIY4VGXz2A0ee4I62HUxco+TJytvEHUY769dgP8vfrP0icrZXjQQA4YeY9xOv5Pblh2rL0QRJRhxx5nhKSGfMi2jWjaKBPCQ0WaG6JVlUOqMPdelZRrENZLheWM3eHZedTKfmEsR2vIw5+EN37YMs2ySFGKoWJiEL3ynhsuvJ7DLIvHX4cxaw0y83aI1t5yXvvO1igrBni7t+oN2R/jFG+Zvdymgj/Av09X+fAPJY3K3zEx2O8COG2dgumy6ZI97m/G/kkDIqQ95IJxRB/UBdQoWUcBZUTi6ufAz+emrPHx5WkiVp3Wiz9r+9nWoeW8GJg==~-1~-1~-1; Domain=.tesla.com; Path=/; Expires=Sun, 04 Sep 2022 17:48:24 GMT; Max-Age=31536000; Secure'})
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Refreshed 1 tests: ['test_url']
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine test_url
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine prepend_url_i18n
2021-09-04 19:48:24 DEBUG (MainThread) [authcaptureproxy.examples.modifiers] Found 0 patterns for method_func
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Received post: https://myhomeassistant.mydomain/auth/tesla/proxy/VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms for https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Storing json {'sensor_data': '7a74G7m23Vrp0o5c9271081.7-1,2,-94,-100,Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15,uaend,11011,20030107,en-gb,Gecko,1,0,0,0,401248,7705038,2560,1342,2560,1440,1616,1182,1616,,cpen:0,i1:0,dm:0,cwen:0,non:1,opc:0,fc:0,sc:0,wrc:1,isc:0,vib:0,bat:0,x11:0,x12:1,8923,0.218032634109,815388852519,0,loc:-1,2,-94,-101,do_dis,dm_dis,t_dis-1,2,-94,-105,0,0,0,1,1960,874,0;1,0,0,1,2137,1051,0;-1,2,-94,-102,0,0,0,1,1960,874,0;1,0,0,1,2137,1051,0;-1,2,-94,-108,-1,2,-94,-110,-1,2,-94,-117,-1,2,-94,-111,-1,2,-94,-109,-1,2,-94,-114,-1,2,-94,-103,-1,2,-94,-112,https://myhomeassistant.mydomain/auth/tesla/proxy?config_flow_id=e5e4f5a18c31464cae282cb57b0dc019&callback_url=https://myhomeassistant.mydomain/auth/tesla/callback?flow_id%3De5e4f5a18c31464cae282cb57b0dc019-1,2,-94,-115,1,32,32,0,0,0,0,2,0,1630777705038,-999999,17445,0,0,2907,0,0,4,0,1,2,50,-1,-1,26018161,PiZtE,14672,77,0,-1-1,2,-94,-106,0,0-1,2,-94,-119,-1-1,2,-94,-122,0,0,0,0,1,0,0-1,2,-94,-123,-1,2,-94,-124,-1,2,-94,-126,-1,2,-94,-127,6-1,2,-94,-70,-1-1,2,-94,-80,94-1,2,-94,-116,208036032-1,2,-94,-118,66469-1,2,-94,-129,-1,2,-94,-121,;3;-1;0'}
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Final headers {'Content-Type': 'text/plain;charset=UTF-8', 'Origin': 'https://auth.tesla.com', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive', 'Accept': '*/*', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15', 'Referer': 'https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA', 'Accept-Language': 'en-us', 'x-tesla-user-agent': 'TeslaApp/3.10.9-433/adff2e065/android/10', 'X-Requested-With': 'com.teslamotors.tesla'}
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Attempting post to https://auth.tesla.com/VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms
headers: {'Content-Type': 'text/plain;charset=UTF-8', 'Origin': 'https://auth.tesla.com', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive', 'Accept': '*/*', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15', 'Referer': 'https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA', 'Accept-Language': 'en-us', 'x-tesla-user-agent': 'TeslaApp/3.10.9-433/adff2e065/android/10', 'X-Requested-With': 'com.teslamotors.tesla'}
cookies: <CookieJar[<Cookie _abck=F7596CF8A824099CB6D526AC660394D2~-1~YAAQ0nRZaJ1RyZ17AQAAkwHtsQaSxPpvlS4ZvXB0GcmrdCdPk6z6KcnQyaI8/CT08szpvUEa/pGvWIY4VGXz2A0ee4I62HUxco+TJytvEHUY769dgP8vfrP0icrZXjQQA4YeY9xOv5Pblh2rL0QRJRhxx5nhKSGfMi2jWjaKBPCQ0WaG6JVlUOqMPdelZRrENZLheWM3eHZedTKfmEsR2vIw5+EN37YMs2ySFGKoWJiEL3ynhsuvJ7DLIvHX4cxaw0y83aI1t5yXvvO1igrBni7t+oN2R/jFG+Zvdymgj/Av09X+fAPJY3K3zEx2O8COG2dgumy6ZI97m/G/kkDIqQ95IJxRB/UBdQoWUcBZUTi6ufAz+emrPHx5WkiVp3Wiz9r+9nWoeW8GJg==~-1~-1~-1 for .tesla.com/>, <Cookie ak_bmsc=86D6AA52AA22E3528A4E7BFCFDAE87F5~000000000000000000000000000000~YAAQ0nRZaIJRyZ17AQAApv/ssQ2fQnUh5UB7b03KViDtLWMNQbTZ6CJrHGX0R6Q0DDYVQM3mUyzBw9tQVlrnubgKXskheZZnMZ8/wXVgEO4XDswHTloX6KXWvpKyHtWG7Pypp4rhZZM4I05xJR2/swDU8NnjfD/15pFoNjs7epWNK3jadYhslcorUH1VqPhXFTJBT5XSMazYx53SIEmtLOnoDXWO4baA4dP8522B/SAY3VfLuLuVnVDSevV7q8V4ATNcRT4iqBArQPPtNDCc0ycTQBjbhkvcHaDxkCq2hgKt1tk4N+wV/xhReTGxMV0WjKkSwmx7kevNNDnEsOr1j8DQr2fE3uJiqVeEdGJQ6L4tIm5cE39sqH7t for .tesla.com/>, <Cookie bm_sz=C034275AB655FEF9C8B9502642C0B967~YAAQ0nRZaINRyZ17AQAApv/ssQ20xVaSdef2MBbK/UZzR3Jy+VwkejzO/wXc6ZM4C2W7qIW2woUNL6ki96UJNBl0iVqGj09qenAxyiEI2t2u1g7blIPzAgxEmhryeBU//eJROqu1+AM5055Tv4sqyxuI41nNgRcq1M+wXrfKUJt8211vrD4Km0alZG9uzqeu5kNv4AuykI9p8dbVrLjwdUB60CqOOdV6T+/SqUjfpHNpPLgua4zeVN/c9gktnEqeUbjhtuB2yjwYv/UfEJouJSEnchMKYpwTQXAe4Xixa6neXQ==~3486773~4405060 for .tesla.com/>, <Cookie tesla-auth.sid=s%3AarDrMEgjr9U7ajsldIHGSyrfT1VYPhOM.EbBQKQy24%2BbtqnGFhGA9um2eDDR%2F9Ooux3loRDg0of4 for auth.tesla.com/>]>
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.helper] POST:
https://auth.tesla.com/VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms with
{"host": "auth.tesla.com", "accept": "*/*", "accept-encoding": "gzip, deflate, br", "connection": "keep-alive", "user-agent": "python-httpx/0.19.0", "content-type": "text/plain;charset=UTF-8", "referer": "https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA", "accept-language": "en-us", "x-tesla-user-agent": "TeslaApp/3.10.9-433/adff2e065/android/10", "x-requested-with": "com.teslamotors.tesla", "cookie": {"_abck": "F7596CF8A824099CB6D526AC660394D2~-1~YAAQ0nRZaJ1RyZ17AQAAkwHtsQaSxPpvlS4ZvXB0GcmrdCdPk6z6KcnQyaI8/CT08szpvUEa/pGvWIY4VGXz2A0ee4I62HUxco+TJytvEHUY769dgP8vfrP0icrZXjQQA4YeY9xOv5Pblh2rL0QRJRhxx5nhKSGfMi2jWjaKBPCQ0WaG6JVlUOqMPdelZRrENZLheWM3eHZedTKfmEsR2vIw5+EN37YMs2ySFGKoWJiEL3ynhsuvJ7DLIvHX4cxaw0y83aI1t5yXvvO1igrBni7t+oN2R/jFG+Zvdymgj/Av09X+fAPJY3K3zEx2O8COG2dgumy6ZI97m/G/kkDIqQ95IJxRB/UBdQoWUcBZUTi6ufAz+emrPHx5WkiVp3Wiz9r+9nWoeW8GJg==~-1~-1~-1", "ak_bmsc": "86D6AA52AA22E3528A4E7BFCFDAE87F5~000000000000000000000000000000~YAAQ0nRZaIJRyZ17AQAApv/ssQ2fQnUh5UB7b03KViDtLWMNQbTZ6CJrHGX0R6Q0DDYVQM3mUyzBw9tQVlrnubgKXskheZZnMZ8/wXVgEO4XDswHTloX6KXWvpKyHtWG7Pypp4rhZZM4I05xJR2/swDU8NnjfD/15pFoNjs7epWNK3jadYhslcorUH1VqPhXFTJBT5XSMazYx53SIEmtLOnoDXWO4baA4dP8522B/SAY3VfLuLuVnVDSevV7q8V4ATNcRT4iqBArQPPtNDCc0ycTQBjbhkvcHaDxkCq2hgKt1tk4N+wV/xhReTGxMV0WjKkSwmx7kevNNDnEsOr1j8DQr2fE3uJiqVeEdGJQ6L4tIm5cE39sqH7t", "bm_sz": "C034275AB655FEF9C8B9502642C0B967~YAAQ0nRZaINRyZ17AQAApv/ssQ20xVaSdef2MBbK/UZzR3Jy+VwkejzO/wXc6ZM4C2W7qIW2woUNL6ki96UJNBl0iVqGj09qenAxyiEI2t2u1g7blIPzAgxEmhryeBU//eJROqu1+AM5055Tv4sqyxuI41nNgRcq1M+wXrfKUJt8211vrD4Km0alZG9uzqeu5kNv4AuykI9p8dbVrLjwdUB60CqOOdV6T+/SqUjfpHNpPLgua4zeVN/c9gktnEqeUbjhtuB2yjwYv/UfEJouJSEnchMKYpwTQXAe4Xixa6neXQ==~3486773~4405060", "tesla-auth.sid": "s%3AarDrMEgjr9U7ajsldIHGSyrfT1VYPhOM.EbBQKQy24%2BbtqnGFhGA9um2eDDR%2F9Ooux3loRDg0of4"}, "content-length": "1192"}
returned 201:Created with response Headers({'content-length': '22', 'access-control-allow-headers': 'Content-Type,Authorization', 'access-control-allow-origin': '*', 'date': 'Sat, 04 Sep 2021 17:48:25 GMT', 'connection': 'keep-alive', 'content-type': 'application/json', 'origin_hostname': 'auth.tesla.com', 'originip': '127.0.0.1', 'permissions-policy': 'interest-cohort=()', 'set-cookie': '_abck=F7596CF8A824099CB6D526AC660394D2~-1~YAAQ0nRZaKhRyZ17AQAA9gLtsQZLGr2VdHT3nHrFAZe9tOn1pHmXYuPOAsSYaMN+bKN8UvXy4HjDTdNp/iQXva4Tq0aL8HUT93Q4Aw4pFr48YS/HvOaMB74iPJdl6qkOa8wPMxM25Ul/T0/9GX6GqWgsCUSSoUYztPOsberIj58Cj5eGMKAxKZAZXTUcWKNFHyOzNgkR6bzQxn63T2a2UtElAOGm+bcIy3r5f53I5bpmjeb9qbj1MnMuQwfqwQCQ4SSBMGE1BbSVnFjr7tgIp+ymyNb4SRC09U4jfya8BBLoOThH7+ANARnbXd3gNSy9J3Jjn4DMxGrGP74x86tXtH/PK0AatRnc+QaeoNXi9go9UWxkPY3xyge0W//fD0b+6ET/QZ8ErbxWlg==~-1~-1~-1; Domain=.tesla.com; Path=/; Expires=Sun, 04 Sep 2022 17:48:25 GMT; Max-Age=31536000; Secure'})
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Refreshed 1 tests: ['test_url']
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine test_url
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Passing through ZyEms as application/json
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Received post: https://myhomeassistant.mydomain/auth/tesla/proxy/VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms for https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Storing json {'sensor_data': '7a74G7m23Vrp0o5c9271081.7-1,2,-94,-100,Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15,uaend,11011,20030107,en-gb,Gecko,1,0,0,0,401248,7705038,2560,1342,2560,1440,1616,1182,1616,,cpen:0,i1:0,dm:0,cwen:0,non:1,opc:0,fc:0,sc:0,wrc:1,isc:0,vib:0,bat:0,x11:0,x12:1,8923,0.553902510276,815388852519,0,loc:-1,2,-94,-101,do_dis,dm_dis,t_dis-1,2,-94,-105,0,0,0,1,1960,874,0;1,0,0,1,2137,1051,0;-1,2,-94,-102,0,0,0,1,1960,874,0;1,0,0,1,2137,1051,0;-1,2,-94,-108,-1,2,-94,-110,-1,2,-94,-117,-1,2,-94,-111,-1,2,-94,-109,-1,2,-94,-114,-1,2,-94,-103,-1,2,-94,-112,https://myhomeassistant.mydomain/auth/tesla/proxy?config_flow_id=e5e4f5a18c31464cae282cb57b0dc019&callback_url=https://myhomeassistant.mydomain/auth/tesla/callback?flow_id%3De5e4f5a18c31464cae282cb57b0dc019-1,2,-94,-115,1,32,32,0,0,0,0,588,0,1630777705038,12,17445,0,0,2907,0,0,588,0,1,2,50,437,1490478648,26018161,PiZtE,83930,107,0,-1-1,2,-94,-106,9,1-1,2,-94,-119,200,0,0,0,0,0,0,0,0,0,0,0,0,200,-1,2,-94,-122,0,0,0,0,1,0,0-1,2,-94,-123,-1,2,-94,-124,-1,2,-94,-126,-1,2,-94,-127,6-1,2,-94,-70,-356158881;-894418032;dis;;true;true;true;-120;true;24;24;true;false;-1-1,2,-94,-80,5378-1,2,-94,-116,208036032-1,2,-94,-118,68409-1,2,-94,-129,4d624c99ce55b315c4f2eddf110ab32c60f386cf5ccf175f66d4b8ecaf332b09,1,46b78825e671e79042d6477c5e50fbb644ee6aa0247817cc2b5ee5d1b9058939,Apple Inc.,Apple GPU,847f317542226f5fc40f6864287d658e1815d8fcb65bfffd759afb7588dd4529,26-1,2,-94,-121,;151;6;0'}
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Final headers {'Content-Type': 'text/plain;charset=UTF-8', 'Origin': 'https://auth.tesla.com', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive', 'Accept': '*/*', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15', 'Referer': 'https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA', 'Accept-Language': 'en-us', 'x-tesla-user-agent': 'TeslaApp/3.10.9-433/adff2e065/android/10', 'X-Requested-With': 'com.teslamotors.tesla'}
2021-09-04 19:48:25 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Attempting post to https://auth.tesla.com/VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms
headers: {'Content-Type': 'text/plain;charset=UTF-8', 'Origin': 'https://auth.tesla.com', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive', 'Accept': '*/*', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15', 'Referer': 'https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA', 'Accept-Language': 'en-us', 'x-tesla-user-agent': 'TeslaApp/3.10.9-433/adff2e065/android/10', 'X-Requested-With': 'com.teslamotors.tesla'}
cookies: <CookieJar[<Cookie _abck=F7596CF8A824099CB6D526AC660394D2~-1~YAAQ0nRZaKhRyZ17AQAA9gLtsQZLGr2VdHT3nHrFAZe9tOn1pHmXYuPOAsSYaMN+bKN8UvXy4HjDTdNp/iQXva4Tq0aL8HUT93Q4Aw4pFr48YS/HvOaMB74iPJdl6qkOa8wPMxM25Ul/T0/9GX6GqWgsCUSSoUYztPOsberIj58Cj5eGMKAxKZAZXTUcWKNFHyOzNgkR6bzQxn63T2a2UtElAOGm+bcIy3r5f53I5bpmjeb9qbj1MnMuQwfqwQCQ4SSBMGE1BbSVnFjr7tgIp+ymyNb4SRC09U4jfya8BBLoOThH7+ANARnbXd3gNSy9J3Jjn4DMxGrGP74x86tXtH/PK0AatRnc+QaeoNXi9go9UWxkPY3xyge0W//fD0b+6ET/QZ8ErbxWlg==~-1~-1~-1 for .tesla.com/>, <Cookie ak_bmsc=86D6AA52AA22E3528A4E7BFCFDAE87F5~000000000000000000000000000000~YAAQ0nRZaIJRyZ17AQAApv/ssQ2fQnUh5UB7b03KViDtLWMNQbTZ6CJrHGX0R6Q0DDYVQM3mUyzBw9tQVlrnubgKXskheZZnMZ8/wXVgEO4XDswHTloX6KXWvpKyHtWG7Pypp4rhZZM4I05xJR2/swDU8NnjfD/15pFoNjs7epWNK3jadYhslcorUH1VqPhXFTJBT5XSMazYx53SIEmtLOnoDXWO4baA4dP8522B/SAY3VfLuLuVnVDSevV7q8V4ATNcRT4iqBArQPPtNDCc0ycTQBjbhkvcHaDxkCq2hgKt1tk4N+wV/xhReTGxMV0WjKkSwmx7kevNNDnEsOr1j8DQr2fE3uJiqVeEdGJQ6L4tIm5cE39sqH7t for .tesla.com/>, <Cookie bm_sz=C034275AB655FEF9C8B9502642C0B967~YAAQ0nRZaINRyZ17AQAApv/ssQ20xVaSdef2MBbK/UZzR3Jy+VwkejzO/wXc6ZM4C2W7qIW2woUNL6ki96UJNBl0iVqGj09qenAxyiEI2t2u1g7blIPzAgxEmhryeBU//eJROqu1+AM5055Tv4sqyxuI41nNgRcq1M+wXrfKUJt8211vrD4Km0alZG9uzqeu5kNv4AuykI9p8dbVrLjwdUB60CqOOdV6T+/SqUjfpHNpPLgua4zeVN/c9gktnEqeUbjhtuB2yjwYv/UfEJouJSEnchMKYpwTQXAe4Xixa6neXQ==~3486773~4405060 for .tesla.com/>, <Cookie tesla-auth.sid=s%3AarDrMEgjr9U7ajsldIHGSyrfT1VYPhOM.EbBQKQy24%2BbtqnGFhGA9um2eDDR%2F9Ooux3loRDg0of4 for auth.tesla.com/>]>
2021-09-04 19:48:26 DEBUG (MainThread) [authcaptureproxy.helper] POST:
https://auth.tesla.com/VWl_M/DC/RL/vaO3/5yqzowz/ti5uk00p3r/SFwXZkc/QUELIm/ZyEms with
{"host": "auth.tesla.com", "accept": "*/*", "accept-encoding": "gzip, deflate, br", "connection": "keep-alive", "user-agent": "python-httpx/0.19.0", "content-type": "text/plain;charset=UTF-8", "referer": "https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=NDdjYzY1ZTVkYTQyMDJkODljOWJjMjMyMmMwNmI0OGFkYWVjNDkxM2E1OTQxYzliNDQ2YjQzYTY1ZWU5NzA2OQ%3D%3D&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid+email+offline_access&state=F5VXP2OgN4Ez4CqNEsZ16FMTtL7BYnMaJifZEZdBpVE_XsW_aQjtzyWCl3XLY-igxJ2xwzISIcrjCgV7P9iGrA", "accept-language": "en-us", "x-tesla-user-agent": "TeslaApp/3.10.9-433/adff2e065/android/10", "x-requested-with": "com.teslamotors.tesla", "cookie": {"_abck": "F7596CF8A824099CB6D526AC660394D2~-1~YAAQ0nRZaKhRyZ17AQAA9gLtsQZLGr2VdHT3nHrFAZe9tOn1pHmXYuPOAsSYaMN+bKN8UvXy4HjDTdNp/iQXva4Tq0aL8HUT93Q4Aw4pFr48YS/HvOaMB74iPJdl6qkOa8wPMxM25Ul/T0/9GX6GqWgsCUSSoUYztPOsberIj58Cj5eGMKAxKZAZXTUcWKNFHyOzNgkR6bzQxn63T2a2UtElAOGm+bcIy3r5f53I5bpmjeb9qbj1MnMuQwfqwQCQ4SSBMGE1BbSVnFjr7tgIp+ymyNb4SRC09U4jfya8BBLoOThH7+ANARnbXd3gNSy9J3Jjn4DMxGrGP74x86tXtH/PK0AatRnc+QaeoNXi9go9UWxkPY3xyge0W//fD0b+6ET/QZ8ErbxWlg==~-1~-1~-1", "ak_bmsc": "86D6AA52AA22E3528A4E7BFCFDAE87F5~000000000000000000000000000000~YAAQ0nRZaIJRyZ17AQAApv/ssQ2fQnUh5UB7b03KViDtLWMNQbTZ6CJrHGX0R6Q0DDYVQM3mUyzBw9tQVlrnubgKXskheZZnMZ8/wXVgEO4XDswHTloX6KXWvpKyHtWG7Pypp4rhZZM4I05xJR2/swDU8NnjfD/15pFoNjs7epWNK3jadYhslcorUH1VqPhXFTJBT5XSMazYx53SIEmtLOnoDXWO4baA4dP8522B/SAY3VfLuLuVnVDSevV7q8V4ATNcRT4iqBArQPPtNDCc0ycTQBjbhkvcHaDxkCq2hgKt1tk4N+wV/xhReTGxMV0WjKkSwmx7kevNNDnEsOr1j8DQr2fE3uJiqVeEdGJQ6L4tIm5cE39sqH7t", "bm_sz": "C034275AB655FEF9C8B9502642C0B967~YAAQ0nRZaINRyZ17AQAApv/ssQ20xVaSdef2MBbK/UZzR3Jy+VwkejzO/wXc6ZM4C2W7qIW2woUNL6ki96UJNBl0iVqGj09qenAxyiEI2t2u1g7blIPzAgxEmhryeBU//eJROqu1+AM5055Tv4sqyxuI41nNgRcq1M+wXrfKUJt8211vrD4Km0alZG9uzqeu5kNv4AuykI9p8dbVrLjwdUB60CqOOdV6T+/SqUjfpHNpPLgua4zeVN/c9gktnEqeUbjhtuB2yjwYv/UfEJouJSEnchMKYpwTQXAe4Xixa6neXQ==~3486773~4405060", "tesla-auth.sid": "s%3AarDrMEgjr9U7ajsldIHGSyrfT1VYPhOM.EbBQKQy24%2BbtqnGFhGA9um2eDDR%2F9Ooux3loRDg0of4"}, "content-length": "1523"}
returned 201:Created with response Headers({'content-length': '22', 'access-control-allow-headers': 'Content-Type,Authorization', 'access-control-allow-origin': '*', 'date': 'Sat, 04 Sep 2021 17:48:26 GMT', 'connection': 'keep-alive', 'content-type': 'application/json', 'origin_hostname': 'auth.tesla.com', 'originip': '127.0.0.1', 'permissions-policy': 'interest-cohort=()'})
2021-09-04 19:48:26 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Refreshed 1 tests: ['test_url']
2021-09-04 19:48:26 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine test_url
2021-09-04 19:48:26 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Passing through ZyEms as application/json

I have a reverse proxy for Home Assistant, it seems to whitelist its IP correctly

EDIT BY ADMIN:
WORKAROUND:
#20 (comment). All credits to sillyfrog.

Not seeing battery range using unsupported version HA 2021.5.x

Thanks for the work on this! I've got this working good and see a laundry list of entities (screenshot included). However, I'm not seeing a way to get the mileage range off my Tesla. I may be missing something totally obvious, or is this not a feature?

Screen Shot 2021-08-28 at 9 22 19 AM

500 error after running through /etc/hosts captcha workaround

Version of the custom_component

0.2.1

Describe the bug

After running through the dirty (in a good way) workaround described here for the Invalid domain for site key bug, I hit a 500. I've continued to hit a 500 subsequently each time I restart the add intigration workflow with popping open the proxy page.

Please let me know if you're needing more regarding the logs.

Debug log

  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/config/custom_components/tesla_custom/config_flow.py", line 325, in wrapped
    return await cls.handler(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/authcaptureproxy/auth_capture_proxy.py", line 396, in all_handler
    result = await run_func(test, test_name, resp, self.data, self.query)
  File "/usr/local/lib/python3.9/site-packages/authcaptureproxy/helper.py", line 83, in run_func
    result = await func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/teslaproxy.py", line 85, in test_url
    code = resp.url.query.get("code")
AttributeError: 'bytes' object has no attribute 'get'
2021-09-09 19:17:45 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/config/custom_components/tesla_custom/config_flow.py", line 325, in wrapped
    return await cls.handler(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/authcaptureproxy/auth_capture_proxy.py", line 396, in all_handler
    result = await run_func(test, test_name, resp, self.data, self.query)
  File "/usr/local/lib/python3.9/site-packages/authcaptureproxy/helper.py", line 83, in run_func
    result = await func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/teslaproxy.py", line 85, in test_url
    code = resp.url.query.get("code")
AttributeError: 'bytes' object has no attribute 'get'
2021-09-09 19:17:55 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/config/custom_components/tesla_custom/config_flow.py", line 325, in wrapped
    return await cls.handler(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/authcaptureproxy/auth_capture_proxy.py", line 396, in all_handler
    result = await run_func(test, test_name, resp, self.data, self.query)
  File "/usr/local/lib/python3.9/site-packages/authcaptureproxy/helper.py", line 83, in run_func
    result = await func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/teslaproxy.py", line 85, in test_url
    code = resp.url.query.get("code")
AttributeError: 'bytes' object has no attribute 'get'
2021-09-09 19:18:22 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/config/custom_components/tesla_custom/config_flow.py", line 325, in wrapped
    return await cls.handler(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/authcaptureproxy/auth_capture_proxy.py", line 396, in all_handler
    result = await run_func(test, test_name, resp, self.data, self.query)
  File "/usr/local/lib/python3.9/site-packages/authcaptureproxy/helper.py", line 83, in run_func
    result = await func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/teslaproxy.py", line 85, in test_url
    code = resp.url.query.get("code")
AttributeError: 'bytes' object has no attribute 'get'

bitmoji

tesla_custom.api throws an UnknownError

Version of the custom_component

1.2.0

Configuration

service: tesla_custom.api
data:
  command: CHANGE_CLIMATE_TEMPERATURE_SETTING
  parameters:
    path_vars:
      vehicle_id: '786889216'
    driver_temp: 23.0
    passenger_temp: 23.0
    wake_if_asleep: true

or

service: tesla_custom.api
data:
  command: REMOTE_SEAT_HEATER_REQUEST
  parameters:
    path_vars:
      vehicle_id: '786889216'
    heater: 1
    level: 1
    wake_if_asleep: true

Describe the bug

Can't seem to get any tesla_custom.api service calls to work.

Both the above examples return an UnknownError immediately. I imagine i'm doing something wrong, but not sure what. I grabbed the vehicle_id from teslafi - it should always be the same, right?

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/tesla_custom/services.py:89
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 4:13:54 PM (3 occurrences)
Last logged: 4:24:49 PM

[281473288586144] Error handling message: Unknown error

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 525, in handle_execute_script
await script_obj.async_run(msg.get("variables"), context=context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1219, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 353, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
await handler.job.target(service_call)
File "/config/custom_components/tesla_custom/services.py", line 43, in async_call_tesla_service
await api(service_call)
File "/config/custom_components/tesla_custom/services.py", line 89, in api
return await controller.api(name=command, path_vars=path_vars, **parameters)
File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 166, in wake_up
result = await wrapped(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 1180, in api
return await self.__connection.post(
File "/usr/local/lib/python3.9/site-packages/teslajsonpy/connection.py", line 167, in post
return await self.__open(
File "/usr/local/lib/python3.9/site-packages/teslajsonpy/connection.py", line 218, in __open
raise TeslaException(resp.status_code)
teslajsonpy.exceptions.TeslaException

Add lokalize support

Is your feature request related to a problem? Please describe.
Since we are no longer in core, we do not get free translations. They can manually be added with a translations submission. However, it's better to use lokalise.

Unable to auth to tesla: 'Controller' object has no attribute 'get_oauth_url'

I installed HACS, installed this repository and the tesla custom component and restarted HA. after restarting and trying to add the integration, i'm getting the following error at the part where it says "The next step will forward to the proxy for Tesla authentication. Tesla protects the login with a web application firewall (WAF) which may require a refresh to get or receive data. Please be cautious with multiple refreshes in a short period of time": Unknown error occured.

Checking XHR requests the POST to api/config/config_entries/flow/ is getting a 500 back (500 Internal Server Error - Server got itself in trouble)

Version core-2021.4.6
Installation Type Home Assistant OS
Development false
Supervisor true
Docker true
Virtual Environment false
Python Version 3.8.7
Operating System Family Linux
Operating System Version 5.4.86
CPU Architecture x86_64
Timezone America/New_YorK

2021-05-01 12:57:32 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 74, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 131, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 155, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 107, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 156, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 214, in _async_handle_step result: dict = await getattr(flow, method)(user_input) File "/config/custom_components/tesla_custom/config_flow.py", line 72, in async_step_user return await self.async_step_start_oauth() File "/config/custom_components/tesla_custom/config_flow.py", line 86, in async_step_start_oauth host_url: URL = self.controller.get_oauth_url() AttributeError: 'Controller' object has no attribute 'get_oauth_url'

Integration does not show up under Configuration/Integrations (even after 2 HA restarts)

Version of the custom_component

Latest, i'm unable to get it running even initially

Configuration

I'm on HA OS on an RPi4, running HA 2021.8.6

Describe the bug

I've added the repo to HACS, rebooted HA (twice), the integration shows up in HACS, but when i go to Configuration/Integrations and try to add it, the Tesla custom component does not show up. I wondered whether i would need to remove the Tesla integration that DOES show up, but have no idea if that is possible for my current config and if so, how.

Debug log

Happy to supply logs, but as far as i can see, there are no relevant messages in the log that explain why the custom Tesla integration does not show up

Decrease polling interval when car is active/driving

Is your feature request related to a problem? Please describe.
To prevent waking up my car (good) this integration has a rather high update interval (bad).

Describe the solution you'd like
When the car is active/driving decrease the polling interval so I get more detailed data of drives.

Describe alternatives you've considered
NA.

Additional context
NA.

Reinstall errors after name change

Source: loader.py:490
First occurred: 11:59:40 (5 occurrences)
Last logged: 11:59:40

Unexpected error importing tesla_custom/media_source.py
Unexpected error importing tesla_custom/group.py
Unexpected error importing tesla_custom/system_health.py
Unexpected error importing tesla_custom/logbook.py
Unexpected error importing tesla_custom/significant_change.py
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/integration_platform.py", line 30, in _process
platform = integration.get_platform(platform_name)
File "/usr/src/homeassistant/homeassistant/loader.py", line 485, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/usr/src/homeassistant/homeassistant/loader.py", line 490, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'custom_components.tesla.media_source'

httpx.CookieConflict: Multiple cookies exist with name=_abck

此错误来自自定义集成。

Logger: aiohttp.server
Source: custom_components/tesla_custom/config_flow.py:132
Integration: Tesla Custom Integration (documentation, issues)
First occurred: 22:57:35 (3 occurrences)
Last logged: 22:57:38

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 77, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 146, in get
return await super().get(request, flow_id)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 95, in get
result = await self._flow_mgr.async_configure(flow_id)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 202, in async_configure
result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/tesla_custom/config_flow.py", line 132, in async_step_finish_oauth
self.controller.set_authorization_code(self.data.get("code", ""))
AttributeError: 'NoneType' object has no attribute 'get'

Version of the custom_component

Configuration

Add your logs here.

Describe the bug

A clear and concise description of what the bug is.

Debug log


Add your logs here.

Unable to access login page

The linked website is opened with an error...

Die Website ist nicht erreichbargcg74bhlxv4rotu8wqhyv1z1u4dsie9s.ui.nabu.casa hat die Verbindung unerwartet geschlossen.
Versuchen Sie Folgendes:

Verbindung prüfen
Proxy und Firewall prüfen
ERR_CONNECTION_CLOSED

KeyError: None on HVAC operations

Version of the custom_component

v1.2.0

Describe the bug

Since updating to v1.2.0 (possibly also seen on 1.1.2; I passed through these versions quickly), attempts to set the state of the car's HVAC are failing with an internal error. I see similar errors when calling eg: lock.unlock

Debug log

eg: when calling climate.set_hvac_mode:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/tesla_custom/climate.py:96
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 11:16:04 (1 occurrences)
Last logged: 11:16:04

[281473065545984] None
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/config/custom_components/tesla_custom/tesla_device.py", line 35, in wrapped
    result = await func(*args, **kwargs)
  File "/config/custom_components/tesla_custom/climate.py", line 96, in async_set_hvac_mode
    await self.tesla_device.set_status(False)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/homeassistant/climate.py", line 140, in set_status
    data = await self._controller.api(
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 202, in wake_up
    result = await instance._wake_up(car_id)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 677, in _wake_up
    async with self.__wakeup_conds[car_vin]:
KeyError: None

entities in unknown state

I don't see anything specific in the logs and the integration is able to connect and recognise my car - however there's a bunch of entities that stay in unknown state:

image

climate/set_hvac_mode. command() missing 1 required positional argument: 'name'

Version of the custom_component

v1.1.0

Error

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/tesla_custom/climate.py:96
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 13:48:49 (3 occurrences)
Last logged: 13:49:33

[281472551118208] command() missing 1 required positional argument: 'name'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/config/custom_components/tesla_custom/tesla_device.py", line 35, in wrapped
    result = await func(*args, **kwargs)
  File "/config/custom_components/tesla_custom/climate.py", line 96, in async_set_hvac_mode
    await self.tesla_device.set_status(False)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/homeassistant/climate.py", line 139, in set_status
    data = await self._controller.command(
  File "/usr/local/lib/python3.9/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
TypeError: command() missing 1 required positional argument: 'name'

Describe the bug

When attempting to change the HVAC mode (using either climate.turn_on or climate.set_hvac_mode), the service call fails and some variation of the above error is seen in the logs.

Last_reset attribute resets too often / doesn't match sensor value

Version of the custom_component

v0.2.0

Configuration

Installed via HACS. Configured via GUI config flow. No errors to report (this is a logic issue, not an error/exception).

Describe the bug

The new energy management stuff in Home Assistant expects that you have an entity which "counts up" as usage is measured, and then at some point if that entity resets to 0, the last_reset attribute on the sensor should be updated to the current timestamp.

The current charge sensor is not behaving this way.

image

Because the last_reset attribute was updated without the sensor resetting, Home Assistant doesn't track any usage in the energy dashboard:

image

Essentially, the last_reset value must be updated nightly at 12 AM, and at the same moment, the sensor must be reset to 0.

Future Thoughts

Today - in 2021.8.x - this is broken.

However, as of 2 days ago, they announced that this mechanism was "deprecated": https://developers.home-assistant.io/blog/2021/08/16/state_class_total (Of course, just as people were starting to implement this whole thing... 🙄)

And instead, they are adding state_class: total_increasing which represents an entity that counts up forever (unless HA restarts).

Ideally, since this custom component is developed much more rapidly than the official integration (ahem...OAuth... 🙄), it would be awesome if we could:

  1. Fix the last_reset attribute issue and push a new version, so that energy monitoring starts working today for users that have this configured
  2. Add support for state_class: total_increasing (or just use the existing state_class: measurement since it sounds like they are tweaking the logic behind this?) and wait for HA to release with these changes
  3. Remove or end support for the last_reset attribute (or leave it... it probably doesn't hurt anything? HA just won't read it.)

I am not a strong Python developer, but if this is really easy to fix and someone could point me in the right direction, I can take a crack at it. I can write Python but I don't have familiarity with running tests or anything like that, sorry. 😅 I want to help if I can, because I think it would be really cool for HA to track my overall kWh used for charging my Tesla!

Feature Request Tracking Entity

I am glad that this integration works, I was wondering if the tracker entity would be something that could be put into this version?

Failed to set up: could not authenticate

I was using this integration fine for quite a while. Recently upgraded to 1.0.0, and it continued working fine for a few days. Starting today, it's showing "Failed to set up: could not authenticate". When I go into Configure, I don't see any options to re-auth. What should I do to get it working again?

reCAPTCHA error message

I recently installed the addon and cannot authenticate due to the CAPTCHA not functioning.

I'm using a public DNS record to access HA remotely (over HTTPS using LetsEncrypt).

image

KeyError: 'site_name' - Can't configure component when site has no name specified

Version of the custom_component

1.1.0

Configuration

Describe the bug

When attempting to configure the integration it fails with this (and yes I put the correct token in the window):

image

I only have a solar system (no car), I think it's related to this: #58. Maybe @giachello knows what's going on?

Debug log

2021-10-12 11:34:20 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 220, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 157, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 111, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 198, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 256, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/tesla_custom/config_flow.py", line 56, in async_step_user
    info = await validate_input(self.hass, user_input)
  File "/config/custom_components/tesla_custom/config_flow.py", line 160, in validate_input
    result = await controller.connect(test_login=True)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 349, in connect
    self.__energysite_name[energysite_id] = energysite["site_name"]
KeyError: 'site_name'

Unable to sign up again Tesla: cannot see CAPTCHA image

Version of the custom_component

0.1.5

Configuration

# Not-applicable, I cannot get it to let me configure it again

# Unless you want my entire config.yaml, but that seems unnecessary,
# and is going to be missing most of the actual configuration in other files.
# Also I try to configure via the UI as much as possible.

I do have my server set up with both internal (homeassistant.local:8123) and external (https://«external-url»:1234) URLs, and the external one is working fine when I check it from inside OR outside my network.

I also verified the https://«external-url»:1234/auth/tesla/callback?flow_id=... is accessible by my browser.

Describe the bug

I had the integration working, then it started failing when everyone's Tesla integration failed (about when I upgraded to HA 2021.08.1).

I removed the integration and tried to re-add it, but now I can't get it to work. The first time, there's usually not a CAPTCHA image. I enter the un/pw and then it reloads asking to include the letters in the image. Except, there's no image to look at. Also, I don't use 2FA, I had just switched to this the last time Tesla logins stopped working, and never switched back.

Because I removed the integration, I can't use the technique where I use the iOS app to get new tokens, either.

I tried waiting 2 days between when this started happening and now in case it was related to too many login attempts, but I haven't had any trouble getting the login to work in other apps or browsers.

Sorry if this is covered somewhere, but I couldn't find mention of it in issues, or in the README.

Debug log

This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/tesla_custom/config_flow.py:325
Integration: Tesla Custom Integration (documentation, issues)
First occurred: 2:40:41 PM (88 occurrences)
Last logged: 2:48:02 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 61, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 283, in handle_async_request
    ) = await self._pool.handle_async_request(
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 136, in handle_async_request
    self.socket = await self._open_socket(timeout)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 163, in _open_socket
    return await self._backend.open_tcp_stream(
  File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/auto.py", line 44, in open_tcp_stream
    return await self.backend.open_tcp_stream(
  File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 154, in open_tcp_stream
    stream = await TLSStream.wrap(
  File "/usr/local/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc) from None
httpcore.ConnectError: All connection attempts failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 197, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/config/custom_components/tesla_custom/config_flow.py", line 325, in wrapped
    return await cls.handler(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/authcaptureproxy/auth_capture_proxy.py", line 385, in all_handler
    resp = await getattr(self.session, method)(site, headers=headers)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1722, in get
    return await self.request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1481, in request
    response = await self.send(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1568, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1604, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1640, in _send_handling_redirects
    response = await self._send_single_request(request, timeout)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1681, in _send_single_request
    ) = await transport.handle_async_request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 278, in handle_async_request
    (
  File "/usr/local/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 78, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed

Feature request - Restrict energy_added_sensor to home

I have a Tesla and a charger installed at my house.

When I looked at the figures of sensor.tesla_XXXXX_energy_added_sensor it seems to increase regardless of the location of charging.
For the HA Energy dashboard to work nicely, it's more reliable to track energy usage to distinct between charges done at home vs. elsewhere using device_tracker.tesla_XXXX_location_tracker

I guess it's possible to use a template to customize this, but looking at the use-case of this sensor it's a good idea I think to embed this in the standard and get two metrics perhaps, so the existing one and a new one for charges at home.

I know it's a nice-to-have feature request.

Error when trying to wake up vehicle by starting charging

Version of the custom_component

Release V1.3.0

Configuration

N/A

Describe the bug

When starting charging for a sleeping vehicle I get the below error.
Same error when trying a door lock or other command to.

All working fine with vehicle awake.

Debug log

2021-10-21 10:34:12 DEBUG (MainThread) [teslajsonpy.connection] post: https://owner-api.teslamotors.com/api/1/vehicles/5025388345911957/command/charge_start {}
2021-10-21 10:34:12 DEBUG (MainThread) [teslajsonpy.connection] 408: {"response":null,"error":"vehicle unavailable: {:error=>\"vehicle unavailable:\"}","error_description":""}
2021-10-21 10:34:12 DEBUG (MainThread) [teslajsonpy.controller] Exception: vehicle_unavailable
api(('START_CHARGE',) {'path_vars': {'vehicle_id': 5025388345911957}, 'wake_if_asleep': True})
2021-10-21 10:34:12 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139941383171328] vehicle_unavailable
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/config/custom_components/tesla_custom/tesla_device.py", line 35, in wrapped
    result = await func(*args, **kwargs)
  File "/config/custom_components/tesla_custom/switch.py", line 35, in async_turn_on
    await self.tesla_device.start_charge()
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/homeassistant/charger.py", line 65, in start_charge
    data = await self._controller.api(
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 166, in wake_up
    result = await wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 1189, in api
    return await self.__connection.post(
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/connection.py", line 167, in post
    return await self.__open(
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/connection.py", line 217, in __open
    raise TeslaException(resp.status_code, "vehicle_unavailable")
teslajsonpy.exceptions.TeslaException: vehicle_unavailable



AttributeError: 'AsyncConnectionPool' object has no attribute 'arequest'

Version of the custom_component

Fresh HACS install

Configuration

Add your logs here.

Describe the bug

A clear and concise description of what the bug is.

Debug log

Traceback (most recent call last):
  File "/home/knutas/anaconda3/envs/hass/lib/python3.8/site-packages/homeassistant-2021.5.0.dev0-py3.8.egg/homeassistant/config_entries.py", line 260, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/home/knutas/.homeassistant/custom_components/tesla_custom/__init__.py", line 127, in async_setup_entry
    result = await controller.connect(
  File "/home/knutas/.homeassistant/deps/lib/python3.8/site-packages/teslajsonpy/controller.py", line 288, in connect
    cars = await self.get_vehicles()
  File "/home/knutas/.homeassistant/deps/lib/python3.8/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/home/knutas/.homeassistant/deps/lib/python3.8/site-packages/teslajsonpy/controller.py", line 407, in get_vehicles
    return (await self.__connection.get("vehicles"))["response"]
  File "/home/knutas/.homeassistant/deps/lib/python3.8/site-packages/teslajsonpy/connection.py", line 90, in get
    return await self.post(command, "get", None)
  File "/home/knutas/.homeassistant/deps/lib/python3.8/site-packages/teslajsonpy/connection.py", line 161, in post
    return await self.__open(
  File "/home/knutas/.homeassistant/deps/lib/python3.8/site-packages/teslajsonpy/connection.py", line 202, in __open
    resp = await getattr(self.websession, method)(
  File "/home/knutas/anaconda3/envs/hass/lib/python3.8/site-packages/httpx-0.17.1-py3.8.egg/httpx/_client.py", line 1539, in get
    return await self.request(
  File "/home/knutas/anaconda3/envs/hass/lib/python3.8/site-packages/httpx-0.17.1-py3.8.egg/httpx/_client.py", line 1361, in request
    response = await self.send(
  File "/home/knutas/anaconda3/envs/hass/lib/python3.8/site-packages/httpx-0.17.1-py3.8.egg/httpx/_client.py", line 1396, in send
    response = await self._send_handling_auth(
  File "/home/knutas/anaconda3/envs/hass/lib/python3.8/site-packages/httpx-0.17.1-py3.8.egg/httpx/_client.py", line 1434, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/home/knutas/anaconda3/envs/hass/lib/python3.8/site-packages/httpx-0.17.1-py3.8.egg/httpx/_client.py", line 1466, in _send_handling_redirects
    response = await self._send_single_request(request, timeout)
  File "/home/knutas/anaconda3/envs/hass/lib/python3.8/site-packages/httpx-0.17.1-py3.8.egg/httpx/_client.py", line 1492, in _send_single_request
    (status_code, headers, stream, ext) = await transport.arequest(
  File "/home/knutas/anaconda3/envs/hass/lib/python3.8/site-packages/httpx-0.17.1-py3.8.egg/httpx/_transports/default.py", line 169, in arequest
    return await self._pool.arequest(
AttributeError: 'AsyncConnectionPool' object has no attribute 'arequest'

Add your logs here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.