FiatChamp Refresh Interval always 15 minutes
AndyBowden opened this issue · 32 comments
Whatever Refresh Interval I set in the FiatChamp AddOn Configuration, the actual refresh interval is always 15minutes and the log always includes:
"Fetching COMPLETED. Next update in 15 minutes."
It is important not to send a Refresh Command to a Fiat 500e frequently as each refresh takes significant energy from the car's 12V battery.
Thus my practice is to ensure that Force Refresh Battery Status is false in FiatChamp configuration and to rely on an HA Automation to issue a Refresh command to the car when needed.
The FiatChamp Refresh Interval being stuck at 15 minutes means that there can be a significant delay of car data being updated in HA. For me, 15minutes delay is common and in extreme situations can be near 30minutes.
Ideally, I would wish set the FiatChamp Refresh Interval to 1 minute so that data is rarely more than a minute stale
Hi [AndyBowden],
seems no move from wubbl0zr for some weeks now.
So , i u want, feel free to use my "forked" version of Fiatchamp -> https://github.com/AirBeeSee/FiatUconnect
i dont have time to spend on it, so it s not really link/forked ,
May be u can start from this and continue yourself
or use the version as is , adding my url to ur repo list.
!!!! i ve remove some "useless" (for me) option.
- car / Brand : force fiat
- remove ConvertKmToMiles
- region : force FcaRegion.Europe
What i ve done in "my" version :
- make refresh interval working with the config param
- modify code to not every refresh , publish definion of entity on mqqt, only done once on addon start and discovery process, it s more than 50% of time consuming in original version of wubbl.
- change command (lock , unlock ,light, ....) from switch to button press entity
- add car's name as "prefix" in entity_name
- add some entity to be used directly in HA , ie :
- charge duration (calculate from sensor in the addon)
- charge end time
- readable timestamp of last update for deep / location / ve info
- a location/tracker entity, that return valid gps AND location from ur HA (Home , office , bar , ... )
- a new button "fetch now" that tell the addon to refresh info from api
and last , but not least ,
a simple logic , to avoid calling "deeprefresh" if not needed.
an option , "autoDeeprefresh"
when on , the addon will check on every "normal refresh" , the value of plug/charging
normal refresh is a call on api that does not call the car, no 12v drain.
So , every 15 min (or less if u want) , the process look if the car is plugged/charging , if it detect that the car change from not charging to charging, it push a first deeprefresh , and wait the interval , to do the next refresh and deeprefresh.
when the car stop charging , it stop push deeprefresh command.
another situation , is if u press the deep refresh entity button , the addon check that the car is plugged , because , a "deep" api call if the car is not plugged , result in a error response from API.
Hi AirBeeSee,
That is very promising and might well fix my main problem of refresh being fixed at 15min.
However when I try to install your FiatUconnect add-on I get attached. I think it just means your current version is not compatible with my HA host which is Home Assistant Blue / Hardkernel ODROID-N2/N2+ running HA Core Version 2023.5.4.
FiatUconnect Error.pdf
Thanks for 9.0.0, AirBeeSee.
That installs and runs without errors with a Refresh Interval of 1 minute and AutoDeepRefresh False.
I did stop FiatChamp to prevent any interference between the 2 apps.
I still have to modify my automations, etc to use the Fiat_500e entity names.
It's early days, but things look OK so far. I'll report progress in a few days.
AuroDeepRefresh can be use , it only calls "deep" command if the car is plugged, so , no problem of "wake up" the car or draining the 12v batt. but , i think it shoulb interresting to have a another "interval" for deep , so we can have lower interval for standard refresh , and a bigger (15 min) for the deep.
if my wife doesn't find me silly things to do in the garden this weekend, I'll take a look to try to put an option to distinguish the interval for the deep calls
@AirBeeSee I tried your version (I have a 500e). It's a huge upgrade. AutoDeepRefresh is perfect
I've been using FiatUConnect for a couple of weeks now without problems and it solves the big problem of the FiatChamp's refresh rate being stuck at 15 minutes.
Whilst noting that AutoDeepRefresh only functions when that car is charging, having had problems with my500e's 12V battery going flat and getting locked out of the API when using FiatChamp, I have played safe and chosen to have the refresh interval set at 1 minute so that the data from the car is never very stale and to leave AutoDeepRefesh False, relying on HA Automations to trigger deep refreshes at 15 minute intervals whilst charging and occasionally when not charging, whether or not plugged in.
The fact that FiatUConnect is exclusively valid for Fiats, will be a minor inconvenience for me soon as I will have a new Alfa Romeo as my main car for long journeys and retaining the 500e for local journeys.
As the Alfa is an ICE, I won't be wanting to trigger its API often.
Best solution might seem to be for me to use FiatChamp for the Alfa and FiatUConnect for the 500e or I might create a clone of FiatUConnect for the Alfa.
Many thanks for your work on FiatUConnect, @AirBeeSee.
Hi Andy,
Some note :
- Fiat and Alpha use the same URL / Server : so u should use it on ur Alpha.
But , the car have to be register with the same user, the add-on does not allow to have multi account.
IF it s not the same account , I don t know if it allowed to get 2 instance of an add-on in HA, another way is to create a clone off the Add-on with another "name". - Call Deep command on Api/Server while the car is NOT Plugged result with a "Invalid Call" response.
It's change they ve made a few week/month ago ,before that ,the deep command were always execute and , as u said , result on a 12 v battery drain. - i don't think refresh every minutes is really useful, when u do a refresh , it's only a call to the api server , this call do nothing to the car. Only deep/location and other command send request to the car.
Other informations are send by the car to the server in some case , ie : Start/Stop the car, plug , unplug, charge ...
1 are you sure about that? I'm only going on basis of information posted by wubbl0rz that the URL for Alfa is https://myalfaconnect.alfaromeo.com/ instead of https://myuconnect.fiat.com/. I'm not in a position to test things yet as my current Alfa Giulia doesn't have UConnect. I'm expecting that my new Giulia will be added by the dealer to my current MyAlfa account and not to my MyFiat one. I'll give you an update in late-July.
2 There's an important distinction between plugged in and charging and plugged in and not charging. I plug my car in at home all the time, but charging only happens when there is surplus solar energy over what the house needs. That is under control of HA via my Zappi charger. It is important, I believe, that deep refreshes don't happen when the car is plugged in, but not charging.
3 I find that if one leaves the refresh rate at 15 minutes that HA may only be aware of the deeprefresh results as much as 15 minutes after the deeprefresh. This being due to things running asynchronously. My belief is that MQTT is aware of the recently updated data at the time of the deeprefresh, but HA only gets it at the add-on's following refresh time. For my control automations to work effectively I need to minimise data latency.
Note Alfa Romeo not Alpha. ALFA = Anonima Lombarda Fabbrica Automobili
- I'm not sure , but , in the original code from FiatChamp , Brand Fiat and Alfa use the same part, url , account , token.
- sorry to not be clear , my English is not really good.
let me try to explain what I ve code :
- Not plugged (so not charging) : no deep command send to API , no Auto or manual call
- Plugged but not charging : only manual (button press in ha) are send
- Plugged and charging : manual and autoDeeprefresh .
- I agree , I got the point.
PS : Alpha -> autocorrect from my phone.
Edit : i ve push a new version (9.0.4) with "AutoDeepInterval" param, and an auto call to deep refresh when the status goes from not charging to charging. I ve add that because I see a lot that the first "timing" the car send is always larger than it should (12 hours instead of 3 ...) so a this call force to get the first "valid" values.
1 are you sure about that? I'm only going on basis of information posted by wubbl0rz that the URL for Alfa is https://myalfaconnect.alfaromeo.com/ instead of https://myuconnect.fiat.com/. I'm not in a position to test things yet as my current Alfa Giulia doesn't have UConnect. I'm expecting that my new Giulia will be added by the dealer to my current MyAlfa account and not to my MyFiat one. I'll give you an update in late-July.
The correct URL for me to be able to control my Stelvio in the US is https://www.alfaromeoconnect.com/en-us/my-vehicle/dashboard.html
I would be willing to pay anyone who can get this working $50.
I suspect that the url for Alfa Romeo does differ from Fiat's as julianrinaldi suggests.
My new Giulia was landed at Portbury yesterday so I should have it on the road in early August. We can compare notes then.
As is said : in the original code from wubbl0rz ,
Fiat and Alfa use the same parameters :
private readonly string _loginUrl = "https://loginmyuconnect.fiat.com";
private readonly string _tokenUrl = "https://authz.sdpr-01.fcagcv.com/v2/cognito/identity/token";
private readonly string _apiUrl = "https://channels.sdpr-01.fcagcv.com";
private readonly string _authApiKey = "JWRYW7IYhW9v0RqDghQSx4UcRYRILNmc8zAuh5ys"; // for pin
private readonly string _authUrl = "https://mfa.fcl-01.fcagcv.com"; // for pin
except for Fiat US :
_loginUrl = "https://login-us.fiat.com"; _tokenUrl = "https://authz.sdpr-02.fcagcv.com/v2/cognito/identity/token"; _apiUrl = "https://channels.sdpr-02.fcagcv.com"; _authApiKey = "JWRYW7IYhW9v0RqDghQSx4UcRYRILNmc8zAuh5ys"; // _authUrl = "https://mfa.fcl-01.fcagcv.com"; //
@julianrinaldi :
I've update my version to put back the brand and region selection.
give it a chance using "US" ;)
So it seems to have fixed the login issue, but the vehicle array is empty.
[10:33:57 INF] Refresh Session
[10:33:57 DBG] {
"CallId": "be993bfd0a944fe29f44b874298dfade",
"ErrorCode": 0,
"ErrorDetails": null,
"ErrorMessage": null,
"ApiVersion": 2,
"StatusCode": 200,
"StatusReason": "OK",
"Time": "2023-07-21T14:33:57.641+00:00"
}
[10:33:57 DBG] {
"UID": "deleteduserid",
"SessionInfo": {
"login_token": "deletedtoken"
},
"CallId": "adbe89330cff4bb98b62a178835bd342",
"ErrorCode": 0,
"ErrorDetails": null,
"ErrorMessage": null,
"ApiVersion": 2,
"StatusCode": 200,
"StatusReason": "OK",
"Time": "2023-07-21T14:33:57.886+00:00"
}
[10:33:58 DBG] {
"id_token": "deletedtoken",
"CallId": "e688fa74dfb741d7b260ca27d7924b90",
"ErrorCode": 0,
"ErrorDetails": null,
"ErrorMessage": null,
"ApiVersion": 2,
"StatusCode": 200,
"StatusReason": "OK",
"Time": "2023-07-21T14:33:58.067+00:00"
}
[10:33:58 DBG] {
"IdentityId": "us-east-1:2e776fa6-5d8f-4f1c-9427-7222867c906f",
"Token": "deletedtoken"
}
[10:34:08 INF] Now fetching new data...
[10:34:08 DBG] {
"Userid": "deleteduserid",
"Version": 1689119996143,
"Vehicles": []
}
[10:34:08 INF] Fetching COMPLETED. Next update in 2 minutes.
Any ideas?
@julianrinaldi
strange : "UID": "deleteduserid",
"SessionInfo": {
"login_token": "deletedtoken"
},
Oh, I put that. Wasn't sure if putting my userid or tokens was safe.
Was just trying to show that the Vehicles [] was empty even though it seemed to be connecting ok.
@julianrinaldi
k, i ve push a "debug" version , (10.0.8)
Turn off debug params , and look if the first step goes right ..
-> loginResponse
-> authResponse
-> jwtResponse
-> identityResponse
-> and finaly vehicleResponse
PS: if u can code , may be fork my version. ?
Everything comes back with status code 200 except vehicleResponse which just shows this:
[11:36:37 INF] vehicleResponse: {
"Userid": "MCUSEN_AR2011070008997480x",
"Version": 1689119996143,
"Vehicles": []
}
version: "10.0.14"
-> select new Brand "Debug"
Mix "US" alfaromeo auth with Europe url to get vehicle
i don t think it ll works. ... but .. why not ;)
short in time (my wife is waiting for me to go to the restaurant), but I think we ll need to dump the vehicle response, something wrong with parser ...
Whilst wubbl0rz's code does have the one FIAT url hard coded, he does declare in his Readme that the url for Alfa Romeo's is:
https://myalfaconnect.alfaromeo.com/
He also declares Alfa Romeo functionality as 'unknown' in the readme.
It seems that he never had the opportunity to test FiatChamp with an Alfa Romeo and thus we have no way of telling from his work what the right url is.
I have both the Fiat App, to which my 500e is linked, and the MyAlfaConnect apps on my iPhone.
My current Alfa is a pre-uconnect car so is not linked to the MyAlfaConnect app. I believe my new Alfa when it arrives in 2-3 weeks will get linked to that app, but only time will tell.
@AndyBowden : yes , inspect / debug myuconnect source page give infos , token and url ...
- we use correct url for login (Europe : https://login.alfaromeo.com/ us :https://login-us.alfaromeo.com/ )
and login / auth etc run correctly .... - than using "Europe : https://authz.sdpr-01.fcagcv.com/v2/cognito/identity/token"; US: https://authz.sdpr-02.fcagcv.com/v2/cognito/identity/token";
return a valid token
But , next part , get vehicle infos return empty array.
europe : "https://channels.sdpr-01.fcagcv.com"; US ": https://channels.sdpr-02.fcagcv.com";
FIAT / ALFA / JEEP use the same url except for login.
@julianrinaldi : could u use web inspector on ur alfa my connect dashboard . and have a look at XHR
![Capture d’écran 2023-07-21 à 23 40 24](https://private-user-images.githubusercontent.com/57507903/255290858-98bec6d7-c949-4cf7-b2a4-07ad5894d10c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTU5MDA1MDksIm5iZiI6MTcxNTkwMDIwOSwicGF0aCI6Ii81NzUwNzkwMy8yNTUyOTA4NTgtOThiZWM2ZDctYzk0OS00Y2Y3LWIyYTQtMDdhZDU4OTRkMTBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTE2VDIyNTY0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNhZWM2ZGRhNjBmYmE1YTA5ZjNkZWM2YjU4OGM0NWQxYzViMzU2YTUxNDY3NDA3M2YxODJjYmJjMGRiNmUyMWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.hid7F1hKzO6sNu40bRn918s6UCJCNCswzmXodMfz90E)
There wasn't a "vehicle" one, but there was one named getProfile
{
"userProfile": {
"uid": "myriad",
"eMail": "julian@rinaldi.com",
"coinID": "mycoinid",
"title": "00",
"firstName": "JULIAN",
"lastName": "RINALDI",
"middleName": "",
"businessName": "",
"suffix": "00",
"addressLine1": "my address",
"city": "my city",
"state": "mistake",
"country": "US",
"zip": "my zip",
"workAreaCode": "",
"workPhoneNumber": "",
"homePhoneAreaCode": "",
"homePhoneNumber": "",
"mobileAreaCode": "908",
"mobilePhoneNumber": "my phone",
"faxAreaCode": "",
"faxPhoneNumber": "",
"preferedLanguage": "en-US",
"preferedTime": "",
"dealerCode": "",
"urbCode": "",
"statusFlag": "COMPLETE",
"source": "MCUSEN_A",
"sxmUserId": "mysxmuid"
},
"vehicles": [
{
"uuid": "myuuid,
"userID": "myuid",
"vehicleID": "0",
"vin": "myvin",
"aesVin": "myaesvin",
"year": "2020",
"make": "ALFA",
"model": "STELVIO TI AWD",
"nickName": "Alfa Romeo Stelvio",
"coinFlag": "T",
"cvpEnabled": "T",
"cvpCapable": "T",
"cvpSource": "SXM",
"bevEnabled": "",
"bevCapable": "",
"bevSource": "",
"isBev": false,
"isLegacyBev": false,
"anEnabled": "",
"anCapable": "",
"phev": "",
"isPhev": false,
"viaMobile": "2DC",
"ymmStat": "",
"radio": "RANP",
"color": "PXL",
"navigation": "",
"dateAquired": "2020-11-20",
"sequence": "1",
"doNotShow": "F",
"prfDealerCode": "69101",
"dealerSrcCode": "69048",
"assignDealer": "",
"imageID": "22C",
"vehcileSource": "CVP",
"vehAdditionalSrc": "CVP",
"namePlateDesc": "Stelvio",
"hasOwner": "F",
"isMgr": "",
"isExpired": "",
"subscriber": true,
"ownerId": "",
"odometerDate": "2023/07/21T14:32:06",
"odometerMileage": "13801",
"nextMileage": "",
"serviceTypeCapable": {
"IVM": "true",
"ROAD": "true",
"SQDF": "true",
"VRC": "true",
"ASOS": "true",
"ECALL": "true",
"ASSIST": "true",
"CARE": "true",
"SDPCC": "true",
"HBLF": "true",
"WIFIHOTSPOT": "true",
"HUC": "true",
"PARENT": "true",
"REOFF": "true",
"SVLAAPP": "true",
"RDL": "true",
"LASTMILE": "true",
"BCALL": "true",
"RDU": "true",
"SDV": "true",
"ROC": "true",
"VHSG": "true",
"BRAND": "true",
"VF": "true",
"AOTAC": "true",
"DTC": "true",
"REON": "true",
"IVA": "true",
"SOS": "true",
"SVLA": "true"
},
"serviceTypeEnable": {
"IVM": "true",
"ROAD": "true",
"SQDF": "true",
"VRC": "true",
"ASOS": "true",
"ECALL": "true",
"ASSIST": "true",
"CARE": "true",
"SDPCC": "true",
"HBLF": "true",
"WIFIHOTSPOT": "true",
"HUC": "true",
"PARENT": "true",
"REOFF": "true",
"SVLAAPP": "true",
"RDL": "true",
"LASTMILE": "false",
"BCALL": "true",
"RDU": "true",
"SDV": "true",
"ROC": "true",
"VHSG": "true",
"BRAND": "true",
"VF": "true",
"AOTAC": "true",
"DTC": "true",
"REON": "true",
"IVA": "true",
"SOS": "true",
"SVLA": "true"
},
"images": [
{
"imageId": "M",
"imageURL": "http://www.alfaromeousa.com/mediaserver/iris?COSY-EU-100-1713uLDEMTV1r9s%25WBXaBKFmfKSLC9gIQALMc6UhVk%25GBfM9IW2VRkr72kVid9peewXGXQpMTV1rUhbg6OQCckPquBhS1pVVz7Q88uOnQUtbdt0WEiM7t&&pov=fronthero",
"isCustomImage": false
}
],
"placeHolder": {
"items": [
{
"key": "MARKET",
"value": "US"
},
{
"key": "BODYMOD",
"value": "GUGT74"
}
]
},
"gskillVehicleCapable": "false",
"gskillServiceEnabled": "false",
"ramCareActive": false,
"mvpActive": true,
"type": "TBM",
"isWagoneer": false,
"bodyModel": "GUGT74",
"sxmVehicleId": "1-KF00-1174"
}
],
"notifications": [],
"blockedUsers": [],
"errors": [],
"status": true
}
and one named getVehicles
[
{
"uuid": "myuuid",
"vin": "myvin",
"aesVin": "myaesvin",
"year": "2020",
"make": "ALFA",
"model": "Stelvio",
"title": "Alfa Romeo Stelvio",
"mileage": "13,801",
"image": "http://www.alfaromeousa.com/mediaserver/iris?COSY-EU-100-1713uLDEMTV1r9s%25WBXaBKFmfKSLC9gIQALMc6UhVk%25GBfM9IW2VRkr72kVid9peewXGXQpMTV1rUhbg6OQCckPquBhS1pVVz7Q88uOnQUtbdt0WEiM7t\u0026\u0026pov\u003dfronthero",
"isCustomImage": false,
"isOwner": true,
"isSubscriber": true,
"serviceProvider": "SXM",
"serviceStatus": "active",
"isSelected": true,
"mileageDate": "2023/07/21T14:32:06",
"isVinVehicle": true,
"isRamCareActive": false,
"isDriver": false,
"permission": null,
"radio": null,
"nextServiceMileage": "20,000",
"isWagoneer": false,
"aliasDetails": "STELVIO__TI__AWD"
}
]
Is there anything else I can provide? The $50 offer still stands. I'd even be willing to give temporary access to my account as a last resort if that would help.
I have now taken delivery of my new Alfa Romeo Giulia and I can get data from it and control it from my iPhone 'My Alfa Connect' app.
I'm using FiatUConnect 11.0.3 and having set Brand to AlfaRomeo and done a full restart, HA is still showing live data from the Fiat 500e and is allowing me to control it, not the Giulia.
I remain of the opinion that FiatUConnect is not using the correct url for Alfas.
Being realistic however, the Giulia is an ICE not an EV. I can do everything I need for the Giulia from the iPhone app and viewing the Giulia's data or controlling it from HA would add nothing for me.
Any owners with Alfa EVs, eg a Tonale and in due course the full AR range, will benefit from HA interaction.
I've looked more closely at the FiatUconnect logs, and discovered, whether I set Fiat or AlfaRomeo in the configuration, that some FiatUconnect entities relate to my 500e and others relate to my Giulia. So it would seem that the single url does covers both marques.
I'll look at the data in more detail when I can to see how the data for one car might be distinguished from the other.
It looks as if all the FiatUconnect attributes relating to my Alfa are suffixed '_2'. Though the 'friendly names' are common to the 500e and Giulia entities.
For example, sensor.fiat_500e_location is the location of my Fiat and sensor.fiat_500e_location_2 of my Alfa. Noting that my Fiat has been around for 2 years and the Alfa was added very recently to the fca database, the Alfa comes second.
Some entities are only relevant to EVs and others to ICEs. Nevertheless there seem to be a pair of all vehicleinfo entities, though there are only evinfo entities for the Fiat.
For example, sensor.fiat_500e_vehicleinfo_fuel_fuelamountlevel is null and sensor.fiat_500e_vehicleinfo_fuel_fuelamountlevel_2 is the percentage of my Alfa's fuel tank.
However there is some inconsistency:
sensor.fiat_500e_evinfo_battery_stateofcharge is the SoC of my 500e's main battery whilst
sensor.fiat_500e_vehicleinfo_batteryinfo_batterystateofcharge and sensor.fiat_500e_vehicleinfo_batteryinfo_batterystateofcharge_2 are both null.
So it would seem that FiatUconnect is obtaining valid data from the fca api, though interpreting the data may not prove easy.
Finally, I would observe that my cars are in UK. I would guess that FiatUconnect will function similarly for cars in the EU. North America is another matter.
I have same issue: update interval is 15 minutes. Independent from whatever I set in configuration dialog...
I have changed to FiatUConnect, instead of FiatChamp, to overcome its 15 minute update interval limitation.
Okay, I see. What to do to solve it for me. Car is Fiat500e.
Just replace FiatChamp in Home Assistant by FiatUConnect which can be found at :
https://github.com/AirBeeSee/FiatUconnect
FiatUConnect is based on FiatChamp and they are very similar. FiatUConnect has certain improvements, not least ability to control update interval.
I also have a 500e.