core: Tesla component stops updating after change.

Home Assistant release with the issue: 0.103.4 and probably all earlier versions

Last working Home Assistant release (if known): None

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io

Integration: https://www.home-assistant.io/integrations/tesla

Description of problem:

When the Tesla Api for some reason logs you out (I get logged out of IOS app at the same time) It changes the <id_s> and the component stops working correctly. (No updates)

Restart of HA fixes it.

It seems like it’s only doing the get: https://owner-api.teslamotors.com/api/1/vehicles request and not the get: https://owner-api.teslamotors.com/api/1/vehicles/<id_s>/data request after the <id_s> has changed

The id is the new correct one in the vehicles request after the change.

The auth part seems ok.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

tesla:
  username: !secret tesla_username
  password: !secret tesla_password

Traceback (if applicable):

N/A

Additional information:

Debug log’s with some obfuscation.

2019-12-27 12:30:00 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/6286557726394661/data
2019-12-27 12:30:01 DEBUG (MainThread) [teslajsonpy.connection] {"response": {"id": 6286557726394661, "user_id": <user_id>, "vehicle_id": <vehicle_id>, "vin": "<vin>", "display_name": "Old Grey", "option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0", "color": null, "tokens": ["09d605de13b5a7e3", "e95621e7d45cb0d0"], "state": "online", "in_service": false, "id_s": "6286557726394661", "calendar_enabled": true, "api_version": 7, "backseat_token": null, "backseat_token_updated_at": null, "charge_state": {"battery_heater_on": false, "battery_level": 74, "battery_range": 227.89, "charge_current_request": 16, "charge_current_request_max": 16, "charge_enable_request": true, "charge_energy_added": 0.0, "charge_limit_soc": 90, "charge_limit_soc_max": 100, "charge_limit_soc_min": 50, "charge_limit_soc_std": 90, "charge_miles_added_ideal": 0.0, "charge_miles_added_rated": 0.0, "charge_port_cold_weather_mode": false, "charge_port_door_open": false, "charge_port_latch": "Engaged", "charge_rate": 0.0, "charge_to_max_range": false, "charger_actual_current": 0, "charger_phases": null, "charger_pilot_current": 16, "charger_power": 0, "charger_voltage": 2, "charging_state": "Disconnected", "conn_charge_cable": "<invalid>", "est_battery_range": 152.12, "fast_charger_brand": "<invalid>", "fast_charger_present": false, "fast_charger_type": "<invalid>", "ideal_battery_range": 227.89, "managed_charging_active": false, "managed_charging_start_time": null, "managed_charging_user_canceled": false, "max_range_charge_counter": 0, "minutes_to_full_charge": 0, "not_enough_power_to_heat": null, "scheduled_charging_pending": false, "scheduled_charging_start_time": null, "time_to_full_charge": 0.0, "timestamp": 1577446200884, "trip_charging": false, "usable_battery_level": 74, "user_charge_enable_request": null}, "climate_state": {"battery_heater": false, "battery_heater_no_power": null, "climate_keeper_mode": "off", "defrost_mode": 0, "driver_temp_setting": 21.0, "fan_status": 3, "inside_temp": 21.0, "is_auto_conditioning_on": true, "is_climate_on": true, "is_front_defroster_on": false, "is_preconditioning": false, "is_rear_defroster_on": false, "left_temp_direction": 180, "max_avail_temp": 28.0, "min_avail_temp": 15.0, "outside_temp": 2.5, "passenger_temp_setting": 21.0, "remote_heater_control_enabled": true, "right_temp_direction": 181, "seat_heater_left": 1, "seat_heater_rear_center": 0, "seat_heater_rear_left": 0, "seat_heater_rear_right": 0, "seat_heater_right": 1, "side_mirror_heaters": false, "timestamp": 1577446200890, "wiper_blade_heater": false}, "gui_settings": {"gui_24_hour_time": true, "gui_charge_rate_units": "kW", "gui_distance_units": "km/hr", "gui_range_display": "Rated", "gui_temperature_units": "C", "show_range_units": false, "timestamp": 1577446200906}, "vehicle_state": {"api_version": 7, "autopark_state_v2": "unavailable", "calendar_supported": true, "car_version": "2019.40.50.1 7fefc12d805a", "center_display_state": 4, "df": 0, "dr": 0, "fd_window": 0, "fp_window": 0, "ft": 0, "is_user_present": true, "locked": true, "media_state": {"remote_control_enabled": false}, "notifications_supported": true, "odometer": 558.416996, "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, "sentry_mode": false, "sentry_mode_available": false, "software_update": {"download_perc": 0, "expected_duration_sec": 2700, "install_perc": 1, "status": "", "version": ""}, "speed_limit_mode": {"active": false, "current_limit_mph": 90.0, "max_limit_mph": 90, "min_limit_mph": 50, "pin_code_set": false}, "timestamp": 1577446200901, "valet_mode": false, "valet_pin_needed": true, "vehicle_name": "Old Grey"}, "drive_state": {"gps_as_of": 1577446199, "heading": 112, "latitude": 55.770807, "longitude": 12.991592, "native_latitude": 55.770807, "native_location_supported": 1, "native_longitude": 12.991592, "native_type": "wgs", "power": 3, "shift_state": "D", "speed": 12, "timestamp": 1577446200911}, "vehicle_config": {"can_accept_navigation_requests": true, "can_actuate_trunks": true, "car_special_type": "base", "car_type": "model3", "charge_port_type": "CCS", "ece_restrictions": true, "eu_vehicle": true, "exterior_color": "MidnightSilver", "has_air_suspension": false, "has_ludicrous_mode": false, "key_version": 2, "motorized_charge_port": true, "plg": false, "rear_seat_heaters": 1, "rear_seat_type": null, "rhd": false, "roof_color": "Glass", "seat_type": null, "spoiler_type": "None", "sun_roof_installed": null, "third_row_seats": "<invalid>", "timestamp": 1577446200934, "use_range_badging": true, "wheel_type": "Pinwheel18"}}}
2019-12-27 12:33:00 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles
2019-12-27 12:33:00 DEBUG (MainThread) [teslajsonpy.connection] {"response": [{"id": 6286557726394661, "vehicle_id": <vehicle_id>, "vin": "<vin>", "display_name": "Old Grey", "option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0", "color": null, "tokens": ["09d605de13b5a7e3", "e95621e7d45cb0d0"], "state": "online", "in_service": false, "id_s": "6286557726394661", "calendar_enabled": true, "api_version": 7, "backseat_token": null, "backseat_token_updated_at": null}], "count": 1}
2019-12-27 12:35:04 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/6286557726394661/data
2019-12-27 12:35:05 DEBUG (MainThread) [teslajsonpy.connection] {"response": {"id": 6286557726394661, "user_id": <user_id>, "vehicle_id": <vehicle_id>, "vin": "<vin>", "display_name": "Old Grey", "option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0", "color": null, "tokens": ["09d605de13b5a7e3", "e95621e7d45cb0d0"], "state": "online", "in_service": false, "id_s": "6286557726394661", "calendar_enabled": true, "api_version": 7, "backseat_token": null, "backseat_token_updated_at": null, "climate_state": {"battery_heater": false, "battery_heater_no_power": null, "climate_keeper_mode": "off", "defrost_mode": 0, "driver_temp_setting": 21.0, "fan_status": 0, "inside_temp": 20.7, "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": 2.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, "timestamp": 1577446504820, "wiper_blade_heater": false}, "charge_state": {"battery_heater_on": false, "battery_level": 74, "battery_range": 227.89, "charge_current_request": 13, "charge_current_request_max": 16, "charge_enable_request": true, "charge_energy_added": 0.41, "charge_limit_soc": 100, "charge_limit_soc_max": 100, "charge_limit_soc_min": 50, "charge_limit_soc_std": 90, "charge_miles_added_ideal": 1.5, "charge_miles_added_rated": 1.5, "charge_port_cold_weather_mode": false, "charge_port_door_open": true, "charge_port_latch": "Engaged", "charge_rate": 96.2, "charge_to_max_range": true, "charger_actual_current": 0, "charger_phases": null, "charger_pilot_current": 16, "charger_power": 24, "charger_voltage": 2, "charging_state": "Charging", "conn_charge_cable": "IEC", "est_battery_range": 148.96, "fast_charger_brand": "<invalid>", "fast_charger_present": true, "fast_charger_type": "Combo", "ideal_battery_range": 227.89, "managed_charging_active": false, "managed_charging_start_time": null, "managed_charging_user_canceled": false, "max_range_charge_counter": 0, "minutes_to_full_charge": 35, "not_enough_power_to_heat": null, "scheduled_charging_pending": false, "scheduled_charging_start_time": null, "time_to_full_charge": 0.58, "timestamp": 1577446504821, "trip_charging": false, "usable_battery_level": 74, "user_charge_enable_request": null}, "drive_state": {"gps_as_of": 1577446503, "heading": 321, "latitude": 55.7667, "longitude": 12.99049, "native_latitude": 55.7667, "native_location_supported": 1, "native_longitude": 12.99049, "native_type": "wgs", "power": -24, "shift_state": null, "speed": null, "timestamp": 1577446504854}, "vehicle_config": {"can_accept_navigation_requests": true, "can_actuate_trunks": true, "car_special_type": "base", "car_type": "model3", "charge_port_type": "CCS", "ece_restrictions": true, "eu_vehicle": true, "exterior_color": "MidnightSilver", "has_air_suspension": false, "has_ludicrous_mode": false, "key_version": 2, "motorized_charge_port": true, "plg": false, "rear_seat_heaters": 1, "rear_seat_type": null, "rhd": false, "roof_color": "Glass", "seat_type": null, "spoiler_type": "None", "sun_roof_installed": null, "third_row_seats": "<invalid>", "timestamp": 1577446504868, "use_range_badging": true, "wheel_type": "Pinwheel18"}, "gui_settings": {"gui_24_hour_time": true, "gui_charge_rate_units": "kW", "gui_distance_units": "km/hr", "gui_range_display": "Rated", "gui_temperature_units": "C", "show_range_units": false, "timestamp": 1577446504835}, "vehicle_state": {"api_version": 7, "autopark_state_v2": "unavailable", "calendar_supported": true, "car_version": "2019.40.50.1 7fefc12d805a", "center_display_state": 5, "df": 0, "dr": 0, "fd_window": 0, "fp_window": 0, "ft": 0, "is_user_present": false, "locked": false, "media_state": {"remote_control_enabled": false}, "notifications_supported": true, "odometer": 558.87619, "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": 32, "sentry_mode": true, "sentry_mode_available": true, "software_update": {"download_perc": 0, "expected_duration_sec": 2700, "install_perc": 1, "status": "", "version": ""}, "speed_limit_mode": {"active": false, "current_limit_mph": 90.0, "max_limit_mph": 90, "min_limit_mph": 50, "pin_code_set": false}, "timestamp": 1577446504838, "valet_mode": false, "valet_pin_needed": true, "vehicle_name": "Old Grey"}}}
2019-12-27 12:38:00 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles
2019-12-27 12:38:00 DEBUG (MainThread) [teslajsonpy.connection] {"response": [], "count": 0}
2019-12-27 12:40:09 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/6286557726394661/data
2019-12-27 12:40:09 DEBUG (MainThread) [teslajsonpy.connection] {"response": null, "error": "not_found", "error_description": ""}
2019-12-27 12:40:09 DEBUG (MainThread) [teslajsonpy.controller] wake_up needed for get -> None 
Info: args:(<teslajsonpy.controller.Controller object at 0x7f5da2ef1590>, 6286557726394661, 'data', False), kwargs:{}, vehicle_id:6286557726394661, car_online:{6286557726394661: True}
2019-12-27 12:40:09 DEBUG (MainThread) [teslajsonpy.controller] Vehicle is awake, trying function get
2019-12-27 12:40:09 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/6286557726394661/data
2019-12-27 12:40:09 DEBUG (MainThread) [teslajsonpy.connection] {"response": null, "error": "not_found", "error_description": ""}
2019-12-27 12:40:13 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/6286557726394661/data
2019-12-27 12:40:14 DEBUG (MainThread) [teslajsonpy.connection] {"response": null, "error": "not_found", "error_description": ""}
2019-12-27 12:40:22 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/6286557726394661/data
2019-12-27 12:40:22 DEBUG (MainThread) [teslajsonpy.connection] {"response": null, "error": "not_found", "error_description": ""}
2019-12-27 12:40:38 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/6286557726394661/data
2019-12-27 12:40:39 DEBUG (MainThread) [teslajsonpy.connection] {"response": null, "error": "not_found", "error_description": ""}
2019-12-27 12:41:11 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/6286557726394661/data
2019-12-27 12:41:11 DEBUG (MainThread) [teslajsonpy.connection] {"response": null, "error": "not_found", "error_description": ""}
2019-12-27 12:43:00 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles
2019-12-27 12:43:00 DEBUG (MainThread) [teslajsonpy.connection] {"response": [{"id": 68482558381507166, "vehicle_id": <vehicle_id>, "vin": "<vin>", "display_name": "Old Grey", "option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0", "color": null, "tokens": ["09d605de13b5a7e3", "e95621e7d45cb0d0"], "state": "online", "in_service": false, "id_s": "68482558381507166", "calendar_enabled": true, "api_version": 7, "backseat_token": null, "backseat_token_updated_at": null}], "count": 1}
2019-12-27 12:48:09 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles
2019-12-27 12:48:09 DEBUG (MainThread) [teslajsonpy.connection] {"response": [{"id": 68482558381507166, "vehicle_id": <vehicle_id>, "vin": "<vin>", "display_name": "Old Grey", "option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0", "color": null, "tokens": ["340a837a49029a10", "09d605de13b5a7e3"], "state": "online", "in_service": false, "id_s": "68482558381507166", "calendar_enabled": true, "api_version": 7, "backseat_token": null, "backseat_token_updated_at": null}], "count": 1}
2019-12-27 12:53:18 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles
2019-12-27 12:53:18 DEBUG (MainThread) [teslajsonpy.connection] {"response": [], "count": 0}
2019-12-27 12:58:26 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles
2019-12-27 12:58:26 DEBUG (MainThread) [teslajsonpy.connection] {"response": [{"id": 61415054331320089, "vehicle_id": <vehicle_id>, "vin": "<vin>", "display_name": "Old Grey", "option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0", "color": null, "tokens": ["340a837a49029a10", "09d605de13b5a7e3"], "state": "online", "in_service": false, "id_s": "61415054331320089", "calendar_enabled": true, "api_version": 7, "backseat_token": null, "backseat_token_updated_at": null}], "count": 1}
2019-12-27 13:03:30 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles
2019-12-27 13:03:30 DEBUG (MainThread) [teslajsonpy.connection] {"response": [{"id": 61415054331320089, "vehicle_id": <vehicle_id>, "vin": "<vin>", "display_name": "Old Grey", "option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0", "color": null, "tokens": ["ee13a85c1468db13", "340a837a49029a10"], "state": "online", "in_service": false, "id_s": "61415054331320089", "calendar_enabled": true, "api_version": 7, "backseat_token": null, "backseat_token_updated_at": null}], "count": 1}

And the part from home-assistant.log at the same time

2019-12-27 12:40:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.old_grey_charger_switch is taking over 10 seconds
2019-12-27 12:40:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.old_grey_maxrange_switch is taking over 10 seconds
2019-12-27 12:40:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.old_grey_update_switch is taking over 10 seconds
2019-12-27 12:40:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of binary_sensor.old_grey_parking_brake_sensor is taking over 10 seconds
2019-12-27 12:40:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of binary_sensor.old_grey_charger_sensor is taking over 10 seconds
2019-12-27 12:40:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of lock.old_grey_door_lock is taking over 10 seconds
2019-12-27 12:40:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of lock.old_grey_charger_door_lock is taking over 10 seconds
2019-12-27 12:40:36 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.old_grey_temperature_sensor_outside is taking over 10 seconds
2019-12-27 12:40:36 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.old_grey_battery_sensor is taking over 10 seconds
2019-12-27 12:40:36 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.old_grey_mileage_sensor is taking over 10 seconds
2019-12-27 12:40:36 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.old_grey_temperature_sensor_inside is taking over 10 seconds
2019-12-27 12:40:36 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.old_grey_range_sensor is taking over 10 seconds
2019-12-27 12:40:38 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/6286557726394661/data
2019-12-27 12:40:39 DEBUG (MainThread) [teslajsonpy.connection] {"response": null, "error": "not_found", "error_description": ""}
2019-12-27 12:40:56 WARNING (MainThread) [homeassistant.components.switch] Updating tesla switch took longer than the scheduled update interval 0:00:30
2019-12-27 12:40:56 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating tesla binary_sensor took longer than the scheduled update interval 0:00:30
2019-12-27 12:40:56 WARNING (MainThread) [homeassistant.components.lock] Updating tesla lock took longer than the scheduled update interval 0:00:30
2019-12-27 12:40:56 WARNING (MainThread) [homeassistant.components.sensor] Updating tesla sensor took longer than the scheduled update interval 0:00:30
2019-12-27 12:41:10 WARNING (MainThread) [homeassistant.components.climate] Updating tesla climate took longer than the scheduled update interval 0:01:00

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@tobbensoft Please try this. You should be able to overwrite the controller.py file.

I had to make some significant changes so please test the functionality to see if anything broke.