zabuldon / teslajsonpy

Apache License 2.0
57 stars 62 forks source link

[teslajsonpy.controller] Unable to get battery data during setup, battery will still be added. 410: UNKNOWN_ERROR_410 #427

Closed purcell-lab closed 1 year ago

purcell-lab commented 1 year ago

image

It would appear that the BATTERY endpoints are no longer with us due to an upstream API change, which has broken powerwall data in the tesla custom component: https://github.com/alandtse/tesla/issues/724

Lots of unsuccessful attempts to reconnect.

@shred86 are you still around and able to assist?

2023-10-07 15:47:34.433 WARNING (MainThread) [teslajsonpy.controller] Unable to get vehicle data during setup, car will still be added. 429: TOO_MANY_REQUESTS
2023-10-07 15:47:36.987 WARNING (MainThread) [teslajsonpy.controller] Unable to get vehicle data during setup, car will still be added. 429: TOO_MANY_REQUESTS
2023-10-07 15:47:53.098 WARNING (MainThread) [teslajsonpy.controller] Unable to get battery data during setup, battery will still be added. 410: UNKNOWN_ERROR_410
2023-10-07 15:48:48.626 WARNING (MainThread) [teslajsonpy.controller] Unable to get battery data during setup, battery will still be added. 410: UNKNOWN_ERROR_410
2023-10-07 15:49:18.134 DEBUG (MainThread) [teslajsonpy.connection] Connecting with existing access token
2023-10-07 15:49:18.140 DEBUG (MainThread) [teslajsonpy.controller] 402 endpoints loaded
2023-10-07 15:49:18.141 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:59
2023-10-07 15:49:18.142 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {}
2023-10-07 15:49:19.040 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{"id":XXX,"user_id":1458171,"vehicle_id":XXX,"calendar_enabled":true,"api_version":63,"backseat_token":null,"backseat_token_updated_at":null,"ble_autopair_enrolled":false,"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":"TeslaAP3","ece_restrictions":false,"efficiency_package":"Default","eu_vehicle":true,"exterior_color":"MidnightSilver","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":"Performance","plg":false,"pws":true,"rear_drive_unit":"PM216MOSFET","rear_seat_heaters":1,"rear_seat_type":0,"rhd":true,"roof_color":"RoofColorGlass","seat_type":null,"spoiler_type":"Passive","sun_roof_installed":null,"supports_qr_pairing":false,"third_row_seats":"None","timestamp":1696657750327,"trim_badging":"p74d","use_range_badging":true,"utc_offset":36000,"webcam_selfie_supported":true,"webcam_supported":true,"wheel_type":"Stiletto20DarkSquare"},"command_signing":"allowed","release_notes_supported":true},{"energy_site_id":XXX,"resource_type":"battery","site_name":"Gateway","id":"XXXX","gateway_id":"XX","asset_site_id":"XX","warp_site_number":"XXX","energy_left":23843.526315789466,"total_pack_energy":42133,"percentage_charged":56.591095615763095,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":-3750,"go_off_grid_test_banner_enabled":null,"storm_mode_enabled":true,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":null,"sync_grid_alert_enabled":true,"breaker_alert_enabled":true,"components":{"battery":true,"battery_type":"ac_powerwall","solar":true,"solar_type":"pv_panel","grid":true,"load_meter":true,"market_type":"residential","wall_connectors":[{"device_id":"XXX","din":"XXX","is_active":true}]},"features":{"rate_plan_manager_no_pricing_constraint":true}}],"count":3}
2023-10-07 15:49:19.041 DEBUG (MainThread) [teslajsonpy.controller] 51970: Changing car_online from {} to True
2023-10-07 15:49:19.041 DEBUG (MainThread) [teslajsonpy.controller] 51970: Resetting last_wake_up_time to: 1696657759
2023-10-07 15:49:19.041 DEBUG (MainThread) [teslajsonpy.controller] 51970: Resetting last_parked_timestamp to: 1696657758 shift_state None
2023-10-07 15:49:19.042 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:58
2023-10-07 15:49:19.042 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/3744442819727850/vehicle_data {}
2023-10-07 15:49:19.697 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":XXX,"tpms_pressure_fl":2.95,"tpms_pressure_fr":2.9,"tpms_pressure_rl":2.875,"tpms_pressure_rr":2.85,"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":"Betty","vehicle_self_test_progress":0,"vehicle_self_test_requested":false,"webcam_available":true}}}
2023-10-07 15:49:19.698 DEBUG (MainThread) [teslajsonpy.controller] 98201: Changing car_online from {'LRWYHCFS9PC851970': True} to True
2023-10-07 15:49:19.698 DEBUG (MainThread) [teslajsonpy.controller] 98201: Resetting last_wake_up_time to: 1696657760
2023-10-07 15:49:19.698 DEBUG (MainThread) [teslajsonpy.controller] 98201: Resetting last_parked_timestamp to: 1696657758 shift_state None
2023-10-07 15:49:19.699 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:58
2023-10-07 15:49:19.699 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/1492931346064588/vehicle_data {}
2023-10-07 15:49:20.331 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":XXX"tpms_last_seen_pressure_time_fl":1696643337,"tpms_last_seen_pressure_time_fr":1696643337,"tpms_last_seen_pressure_time_rl":1696643337,"tpms_last_seen_pressure_time_rr":1696643337,"tpms_pressure_fl":2.625,"tpms_pressure_fr":2.825,"tpms_pressure_rl":2.8,"tpms_pressure_rr":2.75,"tpms_rcp_front_value":2.95,"tpms_rcp_rear_value":3.0,"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":"Duka","vehicle_self_test_progress":0,"vehicle_self_test_requested":false,"webcam_available":true}}}
2023-10-07 15:49:20.331 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:57
2023-10-07 15:49:20.332 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/2252097574301386/site_info {}
2023-10-07 15:49:20.650 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":"","site_name":"Gateway","backup_reserve_percent":0,"default_real_mode":"self_consumption","installation_date":"2022-03-21T17:15:23+10:00","user_settings":{"go_off_grid_test_banner_enabled":false,"storm_mode_enabled":true,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":false,"sync_grid_alert_enabled":true,"breaker_alert_enabled":false},"components":{"solar":true,"solar_type":"pv_panel","battery":true,"grid":true,"backup":true,"gateway":"teg","load_meter":true,"tou_capable":true,"storm_mode_capable":true,"flex_energy_request_capable":false,"car_charging_data_supported":false,"off_grid_vehicle_charging_reserve_supported":false,"vehicle_charging_performance_view_enabled":false,"vehicle_charging_solar_offset_view_enabled":false,"battery_solar_offset_view_enabled":true,"solar_value_enabled":true,"energy_value_header":"Energy Value","energy_value_subheader":"Estimated Value","energy_service_self_scheduling_enabled":true,"show_grid_import_battery_source_cards":true,"set_islanding_mode_enabled":true,"wifi_commissioning_enabled":true,"backup_time_remaining_enabled":true,"battery_type":"ac_powerwall","configurable":true,"grid_services_enabled":false,"wall_connectors":[{"device_id":"","din":"","is_active":true}],"net_meter_mode":"battery_ok"},"version":"23.12.2 63bc46d8","battery_count":3,"tou_settings":{"optimization_strategy":"economics","schedule":[{"target":"off_peak","week_days":[1,0],"start_seconds":50400,"end_seconds":57600},{"target":"peak","week_days":[1,0],"start_seconds":61200,"end_seconds":66600}]},"nameplate_power":15000,"nameplate_energy":40500,"XXX,"vpp_backup_reserve_percent":5}}
2023-10-07 15:49:20.650 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:57
2023-10-07 15:49:20.651 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/powerwalls/XXX {}
2023-10-07 15:49:20.957 DEBUG (MainThread) [teslajsonpy.connection] 410: {"response":null,"error":"https://powergate.prd.sn.tesla.services:443/api/powerwalls/XXX/fullstatus => Gone","error_description":""}
2023-10-07 15:49:22.319 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:55
2023-10-07 15:49:22.320 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/powerwalls/XXX {}
2023-10-07 15:49:22.600 DEBUG (MainThread) [teslajsonpy.connection] 410: {"response":null,"error":"https://powergate.prd.sn.tesla.services:443/api/powerwalls/XXX/fullstatus => Gone","error_description":""}
2023-10-07 15:49:25.591 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:52
2023-10-07 15:49:25.592 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/powerwalls/XXX {}
2023-10-07 15:49:25.869 DEBUG (MainThread) [teslajsonpy.connection] 410: {"response":null,"error":"https://powergate.prd.sn.tesla.services:443/api/powerwalls/XXX/fullstatus => Gone","error_description":""}
2023-10-07 15:49:30.536 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:47
2023-10-07 15:49:30.536 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/powerwalls/XXX {}
2023-10-07 15:49:30.815 DEBUG (MainThread) [teslajsonpy.connection] 410: {"response":null,"error":"https://powergate.prd.sn.tesla.services:443/api/powerwalls/XXX/fullstatus => Gone","error_description":""}
2023-10-07 15:49:35.651 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:42
2023-10-07 15:49:35.652 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/powerwalls/XXX {}
2023-10-07 15:49:35.931 DEBUG (MainThread) [teslajsonpy.connection] 410: {"response":null,"error":"https://powergate.prd.sn.tesla.services:443/api/powerwalls/XXX/fullstatus => Gone","error_description":""}
2023-10-07 15:49:35.931 WARNING (MainThread) [teslajsonpy.controller] Unable to get battery data during setup, battery will still be added. 410: UNKNOWN_ERROR_410
2023-10-07 15:49:35.931 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:42
2023-10-07 15:49:35.932 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/powerwalls//status {}
2023-10-07 15:49:36.212 DEBUG (MainThread) [teslajsonpy.connection] 410: {"response":null,"error":"https://powergate.prd.sn.tesla.services:443/api/powerwalls/XXXX/status => Gone","error_description":""}
coolscotty commented 1 year ago

changing the end points to /api/1/energy_sites will get it up and running. Tesla hasnt been using BATTERY endpoints for ages in their app and i suspect they have finally removed them.

https://www.teslaapi.io/energy-sites/commands

alandtse commented 1 year ago

These is basically a duplicate and natural consequence of #410 not being resolved. Please follow that one.

Again, I do not have a powerwall so unless people donate for me to get one, I'm not planning to work on this so will be reliant on someone in the community providing a PR.