hacf-fr / renault-api

https://readthedocs.org/projects/renault-api/
MIT License
109 stars 38 forks source link

Access Denied on two HA coordinators #342

Open nielsrune opened 3 years ago

nielsrune commented 3 years ago

System: OS: Raspbian 10 on raspberry pi 4 B Home Assistant Supervised 2021.8.4 Python v. 3.9.6 hassRenaultZE v. 3.0.8 renault-api 0.1.4

Car: Reanult Clio V (gas/fuel model from 2020)

I have a gas/fuel car integrated to my Home Assistant. The device tracker is working fine, but I'm getting the following warning and error daily in the logs:

They seems to refer to some function not available at all to a Clio V model (2020), but maybe they should be catched in the code?

WARNING:

Denne fejl stammer fra en brugerdefineret integration. [Danish for: This error stems from an user defined integration]

Logger: custom_components.renault.renault_vehicle
Source: custom_components/renault/renault_vehicle.py:129
Integration: Renault (documentation, issues)
First occurred: 12.33.09 (2 occurrences)
Last logged: 12.33.09

`Access Denied` on HA coordinator cockpit was not caught by `endpoint_available` method. It may be useful to open an issue on https://github.com/hacf-fr/renault-api/issues
`Access Denied` on HA coordinator hvac_status was not caught by `endpoint_available` method. It may be useful to open an issue on https://github.com/hacf-fr/renault-api/issues

ERROR:

Denne fejl stammer fra en brugerdefineret integration. [Danish for: This error stems from an user defined integration]

Logger: custom_components.renault.renault_vehicle
Source: helpers/update_coordinator.py:219
Integration: Renault (documentation, issues)
First occurred: 12.33.09 (2 occurrences)
Last logged: 12.33.09

Error fetching VF1RJA00863129118 cockpit data: This endpoint has been disabled: ('err.func.403', 'Access is denied for this resource')
Error fetching VF1RJA00863129118 hvac_status data: This endpoint has been disabled: ('err.func.403', 'Access is denied for this resource')

From the debug log, I have the following (VIN and GPS anonymized):

2021-08-08 12:33:07 DEBUG (MainThread) [custom_components.renault.renault_hub] Creating RenaultHub
2021-08-08 12:33:09 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 200 on GET to https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/6ad5ba84-571d-423e-a531-77ae3a323731/vehicles?country=DK: {"accountId":"6ad5ba84-571d-423e-a531-77ae3a323731","country":"DK","vehicleLinks":[{"brand":"RENAULT","vin":"VF1R*************","status":"ACTIVE","linkType":"USER","garageBrand":"renault","startDate":"2020-05-20","createdDate":"2020-05-20T07:00:36.902776Z","lastModifiedDate":"2020-06-08T19:47:47.478358Z","cancellationReason":{},"preferredDealer":{"dealerId":"20822024_007","dealerName":"Autohuset Vestergaard A/S Nærum","brand":"RENAULT","createdDate":"2020-05-23T09:52:03.597644Z","lastModifiedDate":"2020-05-23T09:52:03.597644Z"},"connectedDriver":{"role":"MAIN_DRIVER","createdDate":"2020-05-31T16:01:52.551748Z","lastModifiedDate":"2020-06-08T19:47:47.477089Z"},"vehicleDetails":{"vin":"VF1R*************","engineType":"H4D","engineRatio":"450","modelSCR":"CL5","deliveryCountry":{"code":"DK","label":"DENMARK"},"family":{"code":"XJA","label":"XJA FAMILY","group":"007"},"tcu":{"code":"AIVCT","label":"WITH AIVC CONNECTION UNIT","group":"E70"},"navigationAssistanceLevel":{"code":"","label":"","group":""},"battery":{"code":"SANBAT","label":"","group":"968"},"radioType":{"code":"NA40A","label":"ENND, 2BI + 2BO + 2T, DOUBLE-MICRO, FM1/DAB+FM2, WITH MAPS","group":"425"},"registrationCountry":{"code":"DK"},"brand":{"label":"RENAULT"},"model":{"code":"XJA1VP","label":"CLIO V","group":"971"},"gearbox":{"code":"BVM5","label":"5-SPEED MANUAL GEARBOX","group":"427"},"version":{"code":"INT MT 6T"},"energy":{"code":"ESS","label":"PETROL","group":"019"},"registrationNumber":"","vcd":"STANDA/XJA/BJA/EA3/MT/ESS/DG/GDFROI/TR4X2/AFURGE/RV/ABS/CA02/TN/PBNCH/LAC/VT/CPE/RET04/PROJAB/RALU16/CEAVRH/SANCL/AIRBA2/SERIE/DRA/DRAP06/HARM01/ATAR03/SGAV03/SGAR02/OVKPW/BANAL/KM/MCSOL2/TPRM3/AVREPL/SSDECA/ABLAVI/ESPHSA/SSFRPA/ALEVA/SOP03C/SSADPC/STHPLG/KITGRV/VLCUIR/RETRJN/TRSEV1/REPNTC/LVAVIP/LVAREI/SASURV/RSEC01/SGACHA/DNK01/APL03/SAN346/PANP02/FSTPO/ALOUC5/CMAR3P/SAN417/NA40A/BVM5/ECLHB3/RDIF11/PNSTRD/ISOFIX/ENPH01/HRGM01/SANFLT/CSRAFX/SANACF/SDPCLV/TLRP05/FRDIS1/PRODIS/SAN613/SSFAP/AIRBDE/CHC03/PSMREC/E06T/SSPTLP/CHBASE/SANCML/SSFLEX/SDRQAR/SEXTIN/M2018/PHAS1/SPRTQT/SAN913/SSAPLC/THABT1/SSTYAD/HYB01/SSCABA/SANBAT/VEC118/XJA1VP/SSNBT/SUSNPI/H4D/NOADR/SSCAEC/DLIGM2/PGPRT2/SRANCF/FEUAR3/SCDVIT/SANC09/SKTPOU/SKTPGR/SSCCPC/SSPREM/FDIU2/MAPSTD/RCALL/MET04/SDANGM/ECOMOD/SDCOSP/SSRCAR/AIVCT/PRCHR1/AVGSI/ITPK4/MLEXP1/SPERTA/SPERTB/SSPERG/SPERTP/SPERTS/VOLCHA/SSACTE/NODAA/SREACT/AVOSP1/DWGE01/AVC1A/1234Y/NOLIE/NOLII/NOLIS/LIECHS/AEBS07/WOSRE/PRAHL/RRCAM/TCHD0","assets":[{"assetType":"PICTURE","renditions":[{"resolutionType":"ONE_MYRENAULT_LARGE","url":"https://3dv.renault.com/ImageFromBookmark?configuration=STANDA%2FBJA%2FEA3%2FESS%2FDG%2FRV%2FCA02%2FVT%2FCPE%2FRET04%2FPROJAB%2FRALU16%2FDRA%2FDRAP06%2FHARM01%2FATAR03%2FSGAV03%2FSGAR02%2FOVKPW%2FKM%2FMCSOL2%2FABLAVI%2FESPHSA%2FSSFRPA%2FALEVA%2FSOP03C%2FSSADPC%2FVLCUIR%2FRETRJN%2FREPNTC%2FLVAREI%2FRSEC01%2FSGACHA%2FPANP02%2FNA40A%2FBVM5%2FECLHB3%2FRDIF11%2FCSRAFX%2FSANACF%2FTLRP05%2FAIRBDE%2FCHBASE%2FM2018%2FSSAPLC%2FTHABT1%2FHYB01%2FH4D%2FNOADR%2FSSCAEC%2FDLIGM2%2FPGPRT2%2FSRANCF%2FFEUAR3%2FSKTPOU%2FRCALL%2FMET04%2FSDANGM%2FECOMOD%2FSSRCAR%2FAIVCT%2FPRCHR1%2FAVGSI%2FITPK4%2FMLEXP1%2FSPERTA%2FSPERTB%2FSSPERG%2FSPERTP%2FSPERTS%2FVOLCHA%2FSREACT%2FAVOSP1%2FDWGE01%2FNOLIE%2FNOLII%2FAEBS07%2FRRCAM&databaseId=26decdf3-528f-4403-823f-eadb9e8b4f7f&bookmarkSet=RSITE&bookmark=EXT_34_DESSUS&profile=HELIOS_OWNERSERVICES_LARGE"},{"resolutionType":"ONE_MYRENAULT_SMALL","url":"https://3dv.renault.com/ImageFromBookmark?configuration=STANDA%2FBJA%2FEA3%2FESS%2FDG%2FRV%2FCA02%2FVT%2FCPE%2FRET04%2FPROJAB%2FRALU16%2FDRA%2FDRAP06%2FHARM01%2FATAR03%2FSGAV03%2FSGAR02%2FOVKPW%2FKM%2FMCSOL2%2FABLAVI%2FESPHSA%2FSSFRPA%2FALEVA%2FSOP03C%2FSSADPC%2FVLCUIR%2FRETRJN%2FREPNTC%2FLVAREI%2FRSEC01%2FSGACHA%2FPANP02%2FNA40A%2FBVM5%2FECLHB3%2FRDIF11%2FCSRAFX%2FSANACF%2FTLRP05%2FAIRBDE%2FCHBASE%2FM2018%2FSSAPLC%2FTHABT1%2FHYB01%2FH4D%2FNOADR%2FSSCAEC%2FDLIGM2%2FPGPRT2%2FSRANCF%2FFEUAR3%2FSKTPOU%2FRCALL%2FMET04%2FSDANGM%2FECOMOD%2FSSRCAR%2FAIVCT%2FPRCHR1%2FAVGSI%2FITPK4%2FMLEXP1%2FSPERTA%2FSPERTB%2FSSPERG%2FSPERTP%2FSPERTS%2FVOLCHA%2FSREACT%2FAVOSP1%2FDWGE01%2FNOLIE%2FNOLII%2FAEBS07%2FRRCAM&databaseId=26decdf3-528f-4403-823f-eadb9e8b4f7f&bookmarkSet=RSITE&bookmark=EXT_34_DESSUS&profile=HELIOS_OWNERSERVICES_SMALL_V2"}]}],"yearsOfMaintenance":12,"connectivityTechnology":"NONE","easyConnectStore":false,"electrical":false,"rlinkStore":false,"deliveryDate":"2020-05-19","retrievedFromDhs":false,"engineEnergyType":"OTHER","radioCode":""}}]}
2021-08-08 12:33:09 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 200 on GET to https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/6ad5ba84-571d-423e-a531-77ae3a323731/vehicles/VF1R*************/details?country=DK: {"vin":"VF1R*************","engineType":"H4D","engineRatio":"450","modelSCR":"CL5","deliveryCountry":{"code":"DK","label":"DENMARK"},"family":{"code":"XJA","label":"XJA FAMILY","group":"007"},"tcu":{"code":"AIVCT","label":"WITH AIVC CONNECTION UNIT","group":"E70"},"navigationAssistanceLevel":{"code":"","label":"","group":""},"battery":{"code":"SANBAT","label":"","group":"968"},"radioType":{"code":"NA40A","label":"ENND, 2BI + 2BO + 2T, DOUBLE-MICRO, FM1/DAB+FM2, WITH MAPS","group":"425"},"registrationCountry":{"code":"DK"},"brand":{"label":"RENAULT"},"model":{"code":"XJA1VP","label":"CLIO V","group":"971"},"gearbox":{"code":"BVM5","label":"5-SPEED MANUAL GEARBOX","group":"427"},"version":{"code":"INT MT 6T"},"energy":{"code":"ESS","label":"PETROL","group":"019"},"registrationNumber":"","vcd":"STANDA/XJA/BJA/EA3/MT/ESS/DG/GDFROI/TR4X2/AFURGE/RV/ABS/CA02/TN/PBNCH/LAC/VT/CPE/RET04/PROJAB/RALU16/CEAVRH/SANCL/AIRBA2/SERIE/DRA/DRAP06/HARM01/ATAR03/SGAV03/SGAR02/OVKPW/BANAL/KM/MCSOL2/TPRM3/AVREPL/SSDECA/ABLAVI/ESPHSA/SSFRPA/ALEVA/SOP03C/SSADPC/STHPLG/KITGRV/VLCUIR/RETRJN/TRSEV1/REPNTC/LVAVIP/LVAREI/SASURV/RSEC01/SGACHA/DNK01/APL03/SAN346/PANP02/FSTPO/ALOUC5/CMAR3P/SAN417/NA40A/BVM5/ECLHB3/RDIF11/PNSTRD/ISOFIX/ENPH01/HRGM01/SANFLT/CSRAFX/SANACF/SDPCLV/TLRP05/FRDIS1/PRODIS/SAN613/SSFAP/AIRBDE/CHC03/PSMREC/E06T/SSPTLP/CHBASE/SANCML/SSFLEX/SDRQAR/SEXTIN/M2018/PHAS1/SPRTQT/SAN913/SSAPLC/THABT1/SSTYAD/HYB01/SSCABA/SANBAT/VEC118/XJA1VP/SSNBT/SUSNPI/H4D/NOADR/SSCAEC/DLIGM2/PGPRT2/SRANCF/FEUAR3/SCDVIT/SANC09/SKTPOU/SKTPGR/SSCCPC/SSPREM/FDIU2/MAPSTD/RCALL/MET04/SDANGM/ECOMOD/SDCOSP/SSRCAR/AIVCT/PRCHR1/AVGSI/ITPK4/MLEXP1/SPERTA/SPERTB/SSPERG/SPERTP/SPERTS/VOLCHA/SSACTE/NODAA/SREACT/AVOSP1/DWGE01/AVC1A/1234Y/NOLIE/NOLII/NOLIS/LIECHS/AEBS07/WOSRE/PRAHL/RRCAM/TCHD0","assets":[{"assetType":"PICTURE","renditions":[{"resolutionType":"ONE_MYRENAULT_LARGE","url":"https://3dv.renault.com/ImageFromBookmark?configuration=STANDA%2FBJA%2FEA3%2FESS%2FDG%2FRV%2FCA02%2FVT%2FCPE%2FRET04%2FPROJAB%2FRALU16%2FDRA%2FDRAP06%2FHARM01%2FATAR03%2FSGAV03%2FSGAR02%2FOVKPW%2FKM%2FMCSOL2%2FABLAVI%2FESPHSA%2FSSFRPA%2FALEVA%2FSOP03C%2FSSADPC%2FVLCUIR%2FRETRJN%2FREPNTC%2FLVAREI%2FRSEC01%2FSGACHA%2FPANP02%2FNA40A%2FBVM5%2FECLHB3%2FRDIF11%2FCSRAFX%2FSANACF%2FTLRP05%2FAIRBDE%2FCHBASE%2FM2018%2FSSAPLC%2FTHABT1%2FHYB01%2FH4D%2FNOADR%2FSSCAEC%2FDLIGM2%2FPGPRT2%2FSRANCF%2FFEUAR3%2FSKTPOU%2FRCALL%2FMET04%2FSDANGM%2FECOMOD%2FSSRCAR%2FAIVCT%2FPRCHR1%2FAVGSI%2FITPK4%2FMLEXP1%2FSPERTA%2FSPERTB%2FSSPERG%2FSPERTP%2FSPERTS%2FVOLCHA%2FSREACT%2FAVOSP1%2FDWGE01%2FNOLIE%2FNOLII%2FAEBS07%2FRRCAM&databaseId=26decdf3-528f-4403-823f-eadb9e8b4f7f&bookmarkSet=RSITE&bookmark=EXT_34_DESSUS&profile=HELIOS_OWNERSERVICES_LARGE"},{"resolutionType":"ONE_MYRENAULT_SMALL","url":"https://3dv.renault.com/ImageFromBookmark?configuration=STANDA%2FBJA%2FEA3%2FESS%2FDG%2FRV%2FCA02%2FVT%2FCPE%2FRET04%2FPROJAB%2FRALU16%2FDRA%2FDRAP06%2FHARM01%2FATAR03%2FSGAV03%2FSGAR02%2FOVKPW%2FKM%2FMCSOL2%2FABLAVI%2FESPHSA%2FSSFRPA%2FALEVA%2FSOP03C%2FSSADPC%2FVLCUIR%2FRETRJN%2FREPNTC%2FLVAREI%2FRSEC01%2FSGACHA%2FPANP02%2FNA40A%2FBVM5%2FECLHB3%2FRDIF11%2FCSRAFX%2FSANACF%2FTLRP05%2FAIRBDE%2FCHBASE%2FM2018%2FSSAPLC%2FTHABT1%2FHYB01%2FH4D%2FNOADR%2FSSCAEC%2FDLIGM2%2FPGPRT2%2FSRANCF%2FFEUAR3%2FSKTPOU%2FRCALL%2FMET04%2FSDANGM%2FECOMOD%2FSSRCAR%2FAIVCT%2FPRCHR1%2FAVGSI%2FITPK4%2FMLEXP1%2FSPERTA%2FSPERTB%2FSSPERG%2FSPERTP%2FSPERTS%2FVOLCHA%2FSREACT%2FAVOSP1%2FDWGE01%2FNOLIE%2FNOLII%2FAEBS07%2FRRCAM&databaseId=26decdf3-528f-4403-823f-eadb9e8b4f7f&bookmarkSet=RSITE&bookmark=EXT_34_DESSUS&profile=HELIOS_OWNERSERVICES_SMALL_V2"}]}],"yearsOfMaintenance":12,"preferredDealer":{"dealerId":"20822024_007","dealerName":"Autohuset Vestergaard A/S Nærum","brand":"RENAULT","createdDate":"2020-05-23T09:52:03.597644Z","lastModifiedDate":"2020-05-23T09:52:03.597644Z"},"deliveryDate":"2020-05-19","retrievedFromDhs":false,"radioCode":""}
2021-08-08 12:33:09 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 403 on GET to https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/6ad5ba84-571d-423e-a531-77ae3a323731/kamereon/kca/car-adapter/v2/cars/VF1R*************/cockpit?country=DK: {"type":"FUNCTIONAL","messages":[{"code":"err.func.403","message":"{\"errors\":[{\"status\":\"403\",\"code\":\"security.access\",\"detail\":\"Access is denied for this resource\"}]}"}],"errors":[{"errorCode":"err.func.403","errorMessage":"{\"errors\":[{\"status\":\"403\",\"code\":\"security.access\",\"detail\":\"Access is denied for this resource\"}]}"}],"error_reference":"FUNCTIONAL"}
2021-08-08 12:33:09 ERROR (MainThread) [custom_components.renault.renault_vehicle] Error fetching VF1R************* cockpit data: This endpoint has been disabled: ('err.func.403', 'Access is denied for this resource')
2021-08-08 12:33:09 DEBUG (MainThread) [custom_components.renault.renault_vehicle] Finished fetching VF1R************* cockpit data in 0.271 seconds
2021-08-08 12:33:09 WARNING (MainThread) [custom_components.renault.renault_vehicle] `Access Denied` on HA coordinator cockpit was not caught by `endpoint_available` method. It may be useful to open an issue on https://github.com/hacf-fr/renault-api/issues
2021-08-08 12:33:09 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 403 on GET to https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/6ad5ba84-571d-423e-a531-77ae3a323731/kamereon/kca/car-adapter/v1/cars/VF1R*************/hvac-status?country=DK: {"type":"FUNCTIONAL","messages":[{"code":"err.func.403","message":"{\"errors\":[{\"status\":\"403\",\"code\":\"security.access\",\"detail\":\"Access is denied for this resource\"}]}"}],"errors":[{"errorCode":"err.func.403","errorMessage":"{\"errors\":[{\"status\":\"403\",\"code\":\"security.access\",\"detail\":\"Access is denied for this resource\"}]}"}],"error_reference":"FUNCTIONAL"}
2021-08-08 12:33:09 ERROR (MainThread) [custom_components.renault.renault_vehicle] Error fetching VF1R************* hvac_status data: This endpoint has been disabled: ('err.func.403', 'Access is denied for this resource')
2021-08-08 12:33:09 DEBUG (MainThread) [custom_components.renault.renault_vehicle] Finished fetching VF1R************* hvac_status data in 0.217 seconds
2021-08-08 12:33:09 WARNING (MainThread) [custom_components.renault.renault_vehicle] `Access Denied` on HA coordinator hvac_status was not caught by `endpoint_available` method. It may be useful to open an issue on https://github.com/hacf-fr/renault-api/issues
2021-08-08 12:33:10 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 200 on GET to https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/6ad5ba84-571d-423e-a531-77ae3a323731/kamereon/kca/car-adapter/v1/cars/VF1R*************/location?country=DK: {"data":{"type":"Car","id":"VF1R*************","attributes":{"gpsLatitude":55.*************,"gpsLongitude":12.*************,"lastUpdateTime":"2021-08-06T14:18:39Z"}}}
2021-08-08 12:33:10 DEBUG (MainThread) [custom_components.renault.renault_vehicle] Finished fetching VF1R************* location data in 0.267 seconds
2021-08-08 12:33:10 DEBUG (MainThread) [custom_components.renault.services] Registering renault services
epenet commented 3 years ago

Hi @nielsrune For cockpit, does your mileage appear correctly inside the Renault application on your phone? For hvac_status it is a tricky one as the endpoint doesn't work on all models and we need to review it.

nielsrune commented 3 years ago

Hi @epenet My mileage does not appear in the phone app. See picture. Just below the image of the car I can manually update the mileage (i guess) but it's never updated automatically.

epenet commented 3 years ago

Access denied is probably related to some contracts missing. For electric vehicles, they were called ZE Connect and ZE Interactive.

You should look at your contract list on the Renault application and see if there is something similar that has expired and may need to be renewed.

nielsrune commented 3 years ago

@epenet All my contracts are active and valid, see pic1 and pic2

epenet commented 2 years ago

If you want to make progress on this, then you should provide some fixtures (with vehicle details + vehicle gateway details)

epenet commented 2 years ago

(see #48)

nielsrune commented 2 years ago

Okay I have installed renault-api[cli] and in the log file (after a single run) I can see several json results from various endpoints. Two of them seems identical and looks like the one in the vehicles directory.

However, I cannot see anything similar to the gateway files?

I'm getting error code 403 access denied on the following end point:

Is this the right way to proceed?