alandtse / tesla

Tesla custom integration for Home Assistant. This requires a refresh token be generated by third-party apps to login.
Apache License 2.0
601 stars 99 forks source link

Failed to call service switch/turn_on. unknown error - Charger #1000

Open gabzqc1 opened 5 months ago

gabzqc1 commented 5 months ago

Is there an existing issue for this?

I have read about the Fleet API and understand I may need to use it

Version of the Tesla component

3.23.0

Version of the Tesla car software

2024.20.1

Model

Model 3

Current Behavior

Attempting to start or stop charge using the "charger" toggle does not work. "Failed to call service switch/turn_on. unknown error"

Tried restart HASS and reboot car.

First noticed today 14/6/2024

Expected Behavior

Car start or stop charging

Debug logs

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.6.2",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.2",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Helsinki",
    "os_name": "Linux",
    "os_version": "6.6.29-haos",
    "supervisor": "2024.06.0",
    "host_os": "Home Assistant OS 12.3",
    "docker_version": "25.0.5",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "kumo": {
      "documentation": "https://github.com/dlarrick/hass-kumo",
      "version": "0.3.11",
      "requirements": [
        "pykumo==0.3.8"
      ]
    },
    "mitsubishi_wf_rac": {
      "documentation": "https://github.com/jeatheak/Mitsubishi-WF-RAC-Integration/",
      "version": "0.4.0",
      "requirements": [
        "aenum>=3.1.11"
      ]
    },
    "tplink_deco": {
      "documentation": "https://github.com/amosyuen/ha-tplink-deco",
      "version": "3.6.2",
      "requirements": [
        "pycryptodome>=3.12.0"
      ]
    },
    "meteogalicia": {
      "documentation": "https://github.com/Danieldiazi/homeassistant-meteogalicia",
      "version": "2023.8",
      "requirements": [
        "MeteoGalicia-API==0.1.1"
      ]
    },
    "nordpool": {
      "documentation": "https://github.com/custom-components/nordpool/",
      "version": "0.0.14",
      "requirements": [
        "nordpool>=0.2",
        "backoff"
      ]
    },
    "tapo_control": {
      "documentation": "https://github.com/JurajNyiri/HomeAssistant-Tapo-Control",
      "version": "5.4.13",
      "requirements": [
        "pytapo==3.3.21"
      ]
    },
    "hacs": {
      "documentation": "https://hacs.xyz/docs/configuration/start",
      "version": "1.34.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "anniversaries": {
      "documentation": "https://github.com/pinkywafer/Anniversaries",
      "version": "5.2.0",
      "requirements": [
        "python-dateutil>=2.8.1",
        "integrationhelper>=0.2.2",
        "voluptuous>=0.12.1"
      ]
    },
    "eaton_ups": {
      "documentation": "https://github.com/jaroschek/home-assistant-eaton-ups",
      "version": "1.1.3",
      "requirements": [
        "pysnmp-lextudio==5.0.34"
      ]
    },
    "samsungtv_smart": {
      "documentation": "https://github.com/ollo69/ha-samsungtv-smart",
      "version": "0.13.4",
      "requirements": [
        "websocket-client!=1.4.0,>=0.58.0",
        "wakeonlan>=2.0.0",
        "aiofiles>=0.8.0",
        "casttube>=0.2.1"
      ]
    },
    "flightradar24": {
      "documentation": "https://github.com/AlexandrErohin/home-assistant-flightradar24",
      "version": "1.14.2",
      "requirements": [
        "FlightRadarAPI==1.3.25",
        "pycountry==23.12.11"
      ]
    },
    "tesla_custom": {
      "documentation": "https://github.com/alandtse/tesla/wiki",
      "version": "3.23.0",
      "requirements": [
        "teslajsonpy==3.12.0"
      ]
    },
    "hslhrt": {
      "documentation": "https://github.com/anand-p-r/hslhrt-hass-custom",
      "version": "0.4",
      "requirements": [
        "python_graphql_client==0.4.3"
      ]
    }
  },
  "integration_manifest": {
    "domain": "utility_meter",
    "name": "Utility Meter",
    "codeowners": [
      "dgomes"
    ],
    "config_flow": true,
    "documentation": "https://www.home-assistant.io/integrations/utility_meter",
    "integration_type": "helper",
    "iot_class": "local_push",
    "loggers": [
      "croniter"
    ],
    "quality_scale": "internal",
    "requirements": [
      "croniter==2.0.2"
    ],
    "is_built_in": true
  },
  "setup_times": {
    "null": {
      "setup": 0.00010936900798697025
    },
    "d52d986def9888e65c18bf093a5508c8": {
      "wait_import_platforms": -1.2960946419916581,
      "config_entry_setup": 1.2982533869944746
    },
    "4928962156a2c5876518bfb2ffc8de39": {
      "wait_import_platforms": -1.2981779539986746,
      "config_entry_setup": 1.2993759300006786
    },
    "1148074869b0d7d1ee5b8e5b5272542d": {
      "wait_import_platforms": -1.2993459340068512,
      "config_entry_setup": 1.3004799870104762
    }
  },
  "data": {
    "config_entry": {
      "data": {},
      "disabled_by": null,
      "domain": "utility_meter",
      "entry_id": "d52d986def9888e65c18bf093a5508c8",
      "minor_version": 1,
      "options": {
        "name": "Tesla KWH Charged Montly v2",
        "source": "sensor.quorra_energy_added",
        "cycle": "monthly",
        "offset": 0.0,
        "tariffs": [],
        "net_consumption": false,
        "delta_values": false,
        "periodically_resetting": true,
        "always_available": true
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "title": "Tesla KWH Charged Montly v2",
      "unique_id": null,
      "version": 2
    },
    "tariff_sensors": [
      {
        "name": "Tesla KWH Charged Montly v2",
        "entity_id": "sensor.tesla_kwh_charged_montly_v2",
        "extra_attributes": {
          "source": "sensor.quorra_energy_added",
          "status": "collecting",
          "last_period": "545.49",
          "last_valid_state": "0.12",
          "meter_period": "monthly",
          "cron pattern": "0 0 1 * *",
          "last_reset": "2024-05-31T21:00:00.004806+00:00",
          "next_reset": "2024-07-01T00:00:00+03:00"
        },
        "last_sensor_data": {
          "native_value": {
            "__type": "<class 'decimal.Decimal'>",
            "decimal_str": "258.77"
          },
          "native_unit_of_measurement": "kWh",
          "last_period": "545.49",
          "last_reset": "2024-05-31T21:00:00.004806+00:00",
          "last_valid_state": "11.02",
          "status": "collecting",
          "input_device_class": "energy"
        }
      }
    ]
  }
}

Anything else?

car is Model 3 2019 with HW 2.5. "Charger" toggle has worked for over a year with no issues.

Since last Tesla HASS Intergration update, the Climate Toggle takes at least 5 mins to change state in HASS, and rarely starts the AC in the vehicle, unless I open the Tesla official app.

gabzqc1 commented 5 months ago

Not sure the Debug worked... information seems kinda useless for this issue...

gabzqc1 commented 5 months ago

2024-06-14 09:58:45.062 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update() 2024-06-14 09:58:45.062 DEBUG (MainThread) [teslajsonpy.controller] Get vehicles. Force: False Time: 20 Interval 60 2024-06-14 09:58:45.063 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.001 seconds (success: True) 2024-06-14 09:58:46.911 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update() 2024-06-14 09:58:46.912 DEBUG (MainThread) [teslajsonpy.controller] Get vehicles. Force: False Time: 22 Interval 60 2024-06-14 09:58:46.912 DEBUG (MainThread) [teslajsonpy.controller] 42903: online. Polling policy: connected. Update state: normal. Since last park: 3623. Since last wake up: 595. Idle interval: 600. shift_state: None sentry: False climate: False, charging: Stopped 2024-06-14 09:58:46.912 DEBUG (MainThread) [teslajsonpy.controller] 42903: online; Polling policy set to 'connected' and car is connected. or last_wake_up_time < IDLE_INTERVAL Polling every 100 seconds 2024-06-14 09:58:46.912 DEBUG (MainThread) [teslajsonpy.controller] 42903: Skipping update with state online. Polling: True. Last update: 90 ago. Last parked: 3623 ago. Last wake up 595 ago. 2024-06-14 09:58:46.912 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.001 seconds (success: True) 2024-06-14 09:58:55.062 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update() 2024-06-14 09:58:55.062 DEBUG (MainThread) [teslajsonpy.controller] Get vehicles. Force: False Time: 30 Interval 60 2024-06-14 09:58:55.062 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.001 seconds (success: True) 2024-06-14 09:58:56.910 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update() 2024-06-14 09:58:56.910 DEBUG (MainThread) [teslajsonpy.controller] Get vehicles. Force: False Time: 32 Interval 60 2024-06-14 09:58:56.911 DEBUG (MainThread) [teslajsonpy.controller] 42903: online. Polling policy: connected. Update state: normal. Since last park: 3633. Since last wake up: 605. Idle interval: 600. shift_state: None sentry: False climate: False, charging: Stopped 2024-06-14 09:58:56.911 DEBUG (MainThread) [teslajsonpy.controller] 42903: online; Polling policy set to 'connected' and car is connected. or last_wake_up_time < IDLE_INTERVAL Polling every 100 seconds 2024-06-14 09:58:56.911 DEBUG (MainThread) [teslajsonpy.controller] 42903: Updating VEHICLE_DATA 2024-06-14 09:58:56.911 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 3:06:04 2024-06-14 09:58:56.911 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/5YJ3E7EB3KF242903/vehicle_data?endpoints=charge_state%3Bclimate_state%3Bdrive_state%3Bgui_settings%3Bvehicle_config%3Bvehicle_state%3Blocation_data {} 2024-06-14 09:58:57.679 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":1492931212315232,"user_id":82355,"vehicle_id":1174770017,"vin":"5YJ3E7EB3KF242903","color":null,"access_type":"OWNER","granular_access":{"hide_private":false},"tokens":["784cfcd19e44ac29","c4fa55ec3fa1c1de"],"state":"online","in_service":false,"id_s":"1492931212315232","calendar_enabled":true,"api_version":76,"backseat_token":null,"backseat_token_updated_at":null,"ble_autopair_enrolled":false,"charge_state":{"battery_heater_on":false,"battery_level":44,"battery_range":126.86,"charge_amps":16,"charge_current_request":16,"charge_current_request_max":16,"charge_enable_request":false,"charge_energy_added":0.12,"charge_limit_soc":80,"charge_limit_soc_max":100,"charge_limit_soc_min":50,"charge_limit_soc_std":80,"charge_miles_added_ideal":0.5,"charge_miles_added_rated":0.5,"charge_port_cold_weather_mode":false,"charge_port_color":"\u003cinvalid\u003e","charge_port_door_open":true,"charge_port_latch":"Engaged","charge_rate":0.0,"charger_actual_current":0,"charger_phases":null,"charger_pilot_current":16,"charger_power":0,"charger_voltage":2,"charging_state":"Stopped","conn_charge_cable":"IEC","est_battery_range":136.75,"fast_charger_brand":"","fast_charger_present":false,"fast_charger_type":"ACSingleWireCAN","ideal_battery_range":126.86,"max_range_charge_counter":0,"minutes_to_full_charge":0,"not_enough_power_to_heat":null,"off_peak_charging_enabled":false,"off_peak_charging_times":"all_week","off_peak_hours_end_time":360,"preconditioning_enabled":false,"preconditioning_times":"weekdays","scheduled_charging_mode":"Off","scheduled_charging_pending":false,"scheduled_charging_start_time":null,"scheduled_charging_start_time_app":240,"scheduled_departure_time":1704368700,"scheduled_departure_time_minutes":825,"supercharger_session_trip_planner":false,"time_to_full_charge":0.0,"timestamp":1718348336592,"trip_charging":false,"usable_battery_level":44,"user_charge_enable_request":false},"climate_state":{"allow_cabin_overheat_protection":false,"auto_seat_climate_left":false,"auto_seat_climate_right":false,"battery_heater":false,"battery_heater_no_power":null,"cabin_overheat_protection":"FanOnly","cabin_overheat_protection_actively_cooling":false,"climate_keeper_mode":"off","cop_activation_temperature":"High","defrost_mode":0,"driver_temp_setting":21.0,"fan_status":0,"hvac_auto_request":"On","inside_temp":30.3,"is_auto_conditioning_on":false,"is_climate_on":false,"is_front_defroster_on":false,"is_preconditioning":false,"is_rear_defroster_on":false,"left_temp_direction":0,"max_avail_temp":28.0,"min_avail_temp":15.0,"outside_temp":20.5,"passenger_temp_setting":21.0,"remote_heater_control_enabled":false,"right_temp_direction":0,"seat_heater_left":0,"seat_heater_rear_center":0,"seat_heater_rear_left":0,"seat_heater_rear_right":0,"seat_heater_right":0,"side_mirror_heaters":false,"supports_fan_only_cabin_overheat_protection":true,"timestamp":1718348336592,"wiper_blade_heater":false},"drive_state":{"gps_as_of":1718347771,"heading":182,"latitude":60.402071,"longitude":25.078937,"native_latitude":60.402071,"native_location_supported":1,"native_longitude":25.078937,"native_type":"wgs","power":0,"shift_state":null,"speed":null,"timestamp":1718348336592},"gui_settings":{"gui_24_hour_time":false,"gui_charge_rate_units":"kW","gui_distance_units":"km/hr","gui_range_display":"Rated","gui_temperature_units":"C","gui_tirepressure_units":"Psi","show_range_units":false,"timestamp":1718348336592},"vehicle_config":{"aux_park_lamps":"Eu","badge_version":0,"can_accept_navigation_requests":true,"can_actuate_trunks":true,"car_special_type":"base","car_type":"model3","charge_port_type":"CCS","cop_user_set_temp_supported":true,"dashcam_clip_save_supported":true,"default_charge_to_max":false,"driver_assist":"ParkerPascal2_5","ece_restrictions":true,"efficiency_package":"Default","eu_vehicle":true,"exterior_color":"SolidBlack","exterior_trim":"Chrome","exterior_trim_override":"Chrome","has_air_suspension":false,"has_ludicrous_mode":false,"has_seat_cooling":false,"headlamp_type":"Premium","interior_trim_type":"Black","key_version":2,"motorized_charge_port":true,"paint_color_override":"","performance_package":"Base","plg":false,"pws":false,"rear_drive_unit":"PM216MOSFET","rear_seat_heaters":1,"rear_seat_type":0,"rhd":false,"roof_color":"RoofColorGlass","seat_type":null,"sentry_preview_supported":false,"spoiler_type":"None","sun_roof_installed":null,"supports_qr_pairing":false,"third_row_seats":"None","timestamp":1718348336592,"trim_badging":"74d","use_range_badging":true,"utc_offset":10800,"webcam_selfie_supported":false,"webcam_supported":true,"wheel_type":"Pinwheel18CapKit"},"vehicle_state":{"api_version":76,"autopark_state_v2":"unavailable","calendar_supported":true,"car_version":"2024.20.1 831cee498fc0","center_display_state":0,"dashcam_clip_save_available":true,"dashcam_state":"Recording","df":0,"dr":0,"fd_window":0,"feature_bitmask":"fbdffbff,24cbc7f","fp_window":0,"ft":0,"homelink_device_count":1,"homelink_nearby":false,"is_user_present":false,"locked":true,"media_info":{"audio_volume":1.3333,"audio_volume_increment":0.333333,"audio_volume_max":10.333333,"media_playback_status":"Stopped","now_playing_album":"","now_playing_artist":"","now_playing_duration":0,"now_playing_elapsed":0,"now_playing_source":"Spotify","now_playing_station":"","now_playing_title":""},"media_state":{"remote_control_enabled":true},"notifications_supported":true,"odometer":82684.747525,"parsed_calendar_supported":true,"pf":0,"pr":0,"rd_window":0,"remote_start":false,"remote_start_enabled":true,"remote_start_supported":true,"rp_window":0,"rt":0,"santa_mode":0,"sentry_mode":false,"sentry_mode_available":true,"service_mode":false,"service_mode_plus":false,"software_update":{"download_perc":0,"expected_duration_sec":2700,"install_perc":1,"status":"","version":" "},"speed_limit_mode":{"active":false,"current_limit_mph":50.0,"max_limit_mph":120,"min_limit_mph":50.0,"pin_code_set":true},"timestamp":1718348336592,"tpms_hard_warning_fl":false,"tpms_hard_warning_fr":false,"tpms_hard_warning_rl":false,"tpms_hard_warning_rr":false,"tpms_last_seen_pressure_time_fl":1718340786,"tpms_last_seen_pressure_time_fr":1718340786,"tpms_last_seen_pressure_time_rl":1718340786,"tpms_last_seen_pressure_time_rr":1718340786,"tpms_pressure_fl":2.9,"tpms_pressure_fr":2.925,"tpms_pressure_rl":2.925,"tpms_pressure_rr":2.9,"tpms_rcp_front_value":2.9,"tpms_rcp_rear_value":2.9,"tpms_soft_warning_fl":false,"tpms_soft_warning_fr":false,"tpms_soft_warning_rl":false,"tpms_soft_warning_rr":false,"valet_mode":false,"valet_pin_needed":false,"vehicle_name":"Quorra","vehicle_self_test_progress":0,"vehicle_self_test_requested":false,"webcam_available":true}}} 2024-06-14 09:58:57.679 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.769 seconds (success: True) 2024-06-14 09:58:58.072 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 255, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 411, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 165, in async_update_listeners update_callback() File "/config/custom_components/eaton_ups/sensor.py", line 132, in _handle_coordinator_update super().async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1000, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1126, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.__async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

gjaegy commented 5 months ago

I'm having a similar error when trying to change the charging amps value.

This issue appeared today as well, I haven't had any single problem so far...

vdiogo commented 5 months ago

+1 here: can't update Amps and can't turn on/ off charging

skipishere commented 5 months ago

Can you perform any write actions (eg open boot, windows, charger door, etc)?

gjaegy commented 5 months ago

It seems to work again now for me. Weird. Server down probably ?

vdiogo commented 5 months ago

It seems to work again now for me. Weird. Server down probably ?

Still not working for me. No actions (setting amps or turning charging on/ off) and updates (eg started charging on the app and no update in Home Assistant)

skipishere commented 5 months ago

@vdiogo are you using the Fleet API?

vdiogo commented 5 months ago

@vdiogo are you using the Fleet API?

Don't know what the fleet API is sorry. I'm using this plugin combined with node-red in home assistant (with home assistant companion)

skipishere commented 5 months ago

Info about Fleet API if you're not using it and only get read data (and write actions fail) then you have to use the Fleet API

vdiogo commented 5 months ago

Info about Fleet API if you're not using it and only get read data (and write actions fail) then you have to use the Fleet API

Thanks buddy, will give it a try (was working until now, though)

raphmur commented 5 months ago

All commands not using Fleet API are now harder than ever to pass through... See issue #961 for a workaround found to send commands via BLE.

pmrosa commented 5 months ago

Hi there, I'm using Tesla Fleet API and after some time all action stop working. Can it be a throttling issue with the API?

2024-06-15 14:34:30.964 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140420847561040] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 977, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1049, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 121, in async_set_value await entity.async_set_native_value(native_value) File "/config/custom_components/tesla_custom/number.py", line 91, in async_set_native_value await self._car.set_charging_amps(value) File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 934, in set_charging_amps data = await self._send_command( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 785, in _send_command raise ex File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 770, in _send_command data = await self._controller.api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 1367, in api response = await self.__post_with_retries( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 142, in async_wrapped return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 58, in __call__ do = await self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 110, in iter result = await action(retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 78, in inner return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 410, in exc_check raise retry_exc.reraise() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 183, in reraise raise self.last_attempt.result() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 61, in __call__ result = await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 1390, in __post_with_retries return await self.__connection.post(command, method=method, data=data, url=url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/connection.py", line 166, in post return await self.__open(url, method=method, headers=self.head, data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/connection.py", line 218, in __open raise TeslaException(resp.status_code) teslajsonpy.exceptions.TeslaException

baylanger commented 5 months ago

@pmrosa did you check Tesla HTTP Proxy logs? I believe the 429 (too many requests, retry later) would show in there. You might need DEBUG level log.

Avatar1976 commented 5 months ago

Just to add, had the same problem here, switching on charger, adjust maximum charge. I did wonder if it is to do with charge on solar, but I think I had the problem before that. Did note the below errors in Homeassistant core: Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:241 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 18:18:55 (12 occurrences) Last logged: 18:26:29

[546329906048] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 977, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1049, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/number/init.py", line 121, in async_set_value await entity.async_set_native_value(native_value) File "/config/custom_components/tesla_custom/number.py", line 49, in async_set_native_value await self._car.change_charge_limit(value) File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 830, in change_charge_limit data = await self._send_command( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 785, in _send_command raise ex File "/usr/local/lib/python3.12/site-packages/teslajsonpy/car.py", line 770, in _send_command data = await self._controller.api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 1367, in api response = await self.post_with_retries( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 142, in async_wrapped return await fn(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 58, in call do = await self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 110, in iter result = await action(retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 78, in inner return fn(args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/init.py", line 410, in exc_check raise retry_exc.reraise() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/init.py", line 183, in reraise raise self.last_attempt.result() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 61, in call result = await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 1390, in post_with_retries return await self.connection.post(command, method=method, data=data, url=url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/connection.py", line 166, in post return await self.open(url, method=method, headers=self.head, data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/teslajsonpy/connection.py", line 218, in open raise TeslaException(resp.status_code) teslajsonpy.exceptions.TeslaException

raphmur commented 5 months ago

Really same symptoms as API rate limitations. My logs were exactly as yours... #959

pmrosa commented 5 months ago

@pmrosa did you check Tesla HTTP Proxy logs? I believe the 429 (too many requests, retry later) would show in there. You might need DEBUG level log.

I saw the logs and there was nothing relevant there but debug was off. I turned it ON now but the integration started working again since yesterday, what shows a little bit more that it should be rate limitation. It's bad because I have a solar surplus management in node red that can turn car charging on and off some times during the day :-( ... but not much (I manage that at node red) so the API should allow only a very limited rate :-(

pmrosa commented 5 months ago

Just to add, had the same problem here, switching on charger, adjust maximum charge. I did wonder if it is to do with charge on solar, but I think I had the problem before that. Did note the below errors in Homeassistant core: Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:241 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 18:18:55 (12 occurrences) Last logged:

I also have charge on solar and I am seeing this although I had seen it before even without the car at home.

pmrosa commented 5 months ago

@pmrosa did you check Tesla HTTP Proxy logs? I believe the 429 (too many requests, retry later) would show in there. You might need DEBUG level log.

Got it now on the logs with DEBUG on:

2024-06-16T15:44:47+01:00 [debug] Server returned 429: Too Many Requests: Retry in 33313 seconds

2024-06-16T15:44:47+01:00 [debug] [cc5d536a8caa27ecc62fbc93004d9a35] Retrying transmission after error: Retry in 33313 seconds

:-(

pmrosa commented 5 months ago

I beleive that this info in the developers Tesla site show the rates of each type of request and charging is limited to 5.

Screenshot 2024-06-16 at 19 28 28
vikdb commented 5 months ago

5 charging commands only? Will this be the same when using the fleet API?

pmrosa commented 5 months ago

5 charging commands only? Will this be the same when using the fleet API?

This is USING the Fleet API.

eaggeler commented 5 months ago

Same issue here. Did anyone try this with tessie or teslafi? AFAIK they use the fleet API as well but might have different limits?

In general, using the Fleet API to change charging AMPs only should not fall under the 5 limits per day as it might be "Energy Settings Limits" and have 50k requests a day?

tux43 commented 3 months ago

File "/usr/local/lib/python3.12/site-packages/teslajsonpy/controller.py", line 1407, in __post_with_retries_except_unavailable I'm getting the same! Any solution or are we done?