tesla
tesla copied to clipboard
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}
Please also enable the tesla_custom logs.
Updated to 1.3.0 and re-added the integration.
DEBUG (MainThread) [custom_components.tesla_custom.config_flow] Credentials successfully connected to the Tesla API
DEBUG (MainThread) [teslajsonpy.connection] Connecting with existing access token
DEBUG (MainThread) [teslajsonpy.controller] 276 endpoints loaded
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 4:59:59
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles {}
DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":XXX
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 4:59:58
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {}
DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":XXX
DEBUG (MainThread) [teslajsonpy.controller] tasks [<coroutine object Controller.update at 0x7f8d999633c0>, <coroutine object Controller.update at 0x7f8d99963640>] False
DEBUG (MainThread) [teslajsonpy.controller] Updating XXX
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 4:59:58
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/XXX/vehicle_data {}
DEBUG (MainThread) [teslajsonpy.connection] 408: {"response":null,"error":"{\"error\": \"timeout\"}","error_description":""}
DEBUG (MainThread) [teslajsonpy.controller] Exception: vehicle_unavailable
api(('VEHICLE_DATA',) {'path_vars': {'vehicle_id': XXX}, 'wake_if_asleep': False})
DEBUG (MainThread) [teslajsonpy.controller] Updating XXX
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 4:59:49
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/XXX/vehicle_data {}
DEBUG (MainThread) [teslajsonpy.connection] 408: {"response":null,"error":"{\"error\": \"timeout\"}","error_description":""}
DEBUG (MainThread) [teslajsonpy.controller] Exception: vehicle_unavailable
api(('VEHICLE_DATA',) {'path_vars': {'vehicle_id': XXX}, 'wake_if_asleep': False})
DEBUG (MainThread) [custom_components.tesla_custom] Connected to the Tesla API
DEBUG (MainThread) [teslajsonpy.controller] Updating XXX
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 4:59:40
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/XXX/vehicle_data {}
DEBUG (MainThread) [teslajsonpy.controller] Updating XXX
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 4:59:40
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/XXX/vehicle_data {}
DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":XXX
DEBUG (MainThread) [teslajsonpy.connection] 408: {"response":null,"error":"{\"error\": \"timeout\"}","error_description":""}
DEBUG (MainThread) [teslajsonpy.controller] Exception: vehicle_unavailable
api(('VEHICLE_DATA',) {'path_vars': {'vehicle_id': XXX}, 'wake_if_asleep': False})
DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 9.088 seconds (success: True)
DEBUG (MainThread) [teslajsonpy.controller] Skipping update of XXX with state online
DEBUG (MainThread) [teslajsonpy.controller] Updating XXX
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 4:59:31
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/XXX/vehicle_data {}
DEBUG (MainThread) [teslajsonpy.connection] 408: {"response":null,"error":"{\"error\": \"timeout\"}","error_description":""}
DEBUG (MainThread) [teslajsonpy.controller] Exception: vehicle_unavailable
api(('VEHICLE_DATA',) {'path_vars': {'vehicle_id': XXX}, 'wake_if_asleep': False})
DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 9.127 seconds (success: True)
Looks like because Tesla is returning 408s, the update task fails. We just need to change asyncio.gather to not interrupt outstanding tasks.
Please check 1.3.1. That may resolve this.
408 error is gone, but still not showing up and nothing else different in the debug logs. Removed/re-installed the custom integration and restarted HA.
Seems like teslajsonpy only calls the product api once when setting up the integration and all subsequent api calls are only to vehicles.
E: I have the tesla gateway component installed in HA (which uses the local API) and I also use TeslaPy separately for cloud API calls to update powerwall settings outside of HA.
Please provide logs showing result of product call. It only needs to be called once as the list of products won't change enough to justify spamming it.
DEBUG (MainThread) [teslajsonpy.controller] 276 endpoints loaded
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -18923 days, 13:50:15
DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected
DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token
DEBUG (MainThread) [teslajsonpy.connection] Saved new auth info {'access_token':
DEBUG (MainThread) [teslajsonpy.connection] Exchanging bearer token with access token:
DEBUG (MainThread) [teslajsonpy.connection] Received bearer token {'access_token':
DEBUG (MainThread) [teslajsonpy.connection] Successfully refreshed oauth
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles {}
DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{CAR1},{CAR2}],"count":2}
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 5:00:00
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {}
DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{CAR1},{CAR2},{ENERGY}],"count":3}
DEBUG (MainThread) [custom_components.tesla_custom.config_flow] Credentials successfully connected to the Tesla API
DEBUG (MainThread) [teslajsonpy.connection] Connecting with existing access token
DEBUG (MainThread) [teslajsonpy.controller] 276 endpoints loaded
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 5:00:00
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles {}
DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{CAR1},{CAR2}],"count":2}
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 4:59:59
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {}
DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{CAR1},{CAR2},{ENERGY}],"count":3}
DEBUG (MainThread) [teslajsonpy.controller] Updating CAR1
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 4:59:59
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/CAR2/vehicle_data {}
DEBUG (MainThread) [teslajsonpy.controller] Updating CAR2
DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 45 days, 4:59:59
DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles/CAR1/vehicle_data {}
DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{CAR2}}
DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{CAR1}}
DEBUG (MainThread) [custom_components.tesla_custom] Connected to the Tesla API
DEBUG (MainThread) [teslajsonpy.controller] Skipping update of CAR1 with state online
DEBUG (MainThread) [teslajsonpy.controller] Skipping update of CAR2 with state online
DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.000 seconds (success: True)
I need to see the energy data. Don't completely hide it.
To the extent it helps, we only support solar products for now. I don't have any of that so we're reliant on whatever contributions people are willing to provide.
If whatever product you have isn't register as solar, it won't display.
It's solar/powerwall.
{"energy_site_id":123,"resource_type":"battery","site_name":"ABCD","id":"STEXXX","gateway_id":"XXX","asset_site_id":"XXX","energy_left":14573.210526315788,"total_pack_energy":27689,"percentage_charged":52.631769028552085,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":0,"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"}
Yes we don't support that.
I need to see the energy data. Don't completely hide it.
I understand powerwall isn't currently supported by this integration, but you have sorted the authentication.
Just resurfacing this issue as I have the hardware available now, would be good to work together and merge some of the code base from https://github.com/carboncoop/tesla-gateway-ha-component into here, which is no longer working with authentication.
The interesting energy/battery stuff is here:
{
"energy_site_id": XXXXXX,
"resource_type": "battery",
"site_name": "Home Energy Gateway",
"id": "XXXXXX",
"gateway_id": "XXXXXX",
"asset_site_id": "XXXXX",
"energy_left": 8636.210526315788,
"total_pack_energy": 14052,
"percentage_charged": 61.45894197492021,
"battery_type": "ac_powerwall",
"backup_capable": true,
"battery_power": 490,
"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": 2
}
2022-04-26 11:52:00 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {}
2022-04-26 11:52:01 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{"id":1492931346064588,"user_id":1458171,"vehicle_id":XXXXX,"vin":"XXXXXX","display_name":"Duka","option_codes":"AD15,AF00,APFB,APH4,AU3P,BC3R,BT37,CDM0,CH06,COAU,DRRH,DV4W,FC3P,FG31,FM3P,GLFR,HL31,HM30,ID3W,IL31,LTPB,MDL3,MR30,PMNG,PC31,REAP,RF3G,RS3H,S3PB,SA3P,SC04,STCP,SU3C,T3M3,TM00,TW00,UT3P,W32D,WR00,ZINV,MI01,PL31,SLR1,ST30,BG32,I38M,OSSB,AUF1,RSF1,ILF1,FGF1,CPF1,HP30,PT00","color":null,"access_type":"OWNER","tokens":["XXXXX","XXXXXX"],"state":"offline","in_service":true,"id_s":"XXXXXX","calendar_enabled":true,"api_version":34,"backseat_token":null,"backseat_token_updated_at":null,"vehicle_config":{"badge_version":0,"can_accept_navigation_requests":true,"can_actuate_trunks":true,"car_special_type":"base","car_type":"model3","charge_port_type":"CCS","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":"Black","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":"175,35,173,0.9,0.01","performance_package":"Performance","plg":false,"pws":false,"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,"third_row_seats":"None","timestamp":1650918461032,"trim_badging":"p74d","use_range_badging":true,"utc_offset":36000,"webcam_supported":false,"wheel_type":"Stiletto20DarkSquare"},"command_signing":"allowed"},{"energy_site_id":XXXXXX,"resource_type":"battery","site_name":"Home Energy Gateway","id":"XXXXXX","gateway_id":"XXXXXX","asset_site_id":"XXXXX","energy_left":8636.210526315788,"total_pack_energy":14052,"percentage_charged":61.45894197492021,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":490,"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":2}