audiconnect / audi_connect_ha

Adds an audi connect integration to home assistant
MIT License
236 stars 96 forks source link

1.6: `Oil level` became `Unavailable` #386

Closed mm98 closed 6 months ago

mm98 commented 6 months ago

Describe the bug

Thanks for all the work you guys do. Much appreciated! This isn't really a big problem for me. I just wanted to report it.

Suddenly (after upgrading to 1.6) my Oil level became Unavailable. It had previously returned 100%. The variable OIL_LEVEL_DIPSTICKS_PERCENTAGE (value: true) is present in the debug logs.

This entity is no longer being provided by the audiconnect integration. If the entity is no longer in use, delete it in settings.

To Reproduce None.

Expected behavior Showing some kind of value.

Screenshots image

Logfile home-assistant_audiconnect_2024-04-16T12-55-52.255Z.log

mm98 commented 6 months ago

When I look at how this was previously implemented. I understand why it is now returning Unavailable. Since the JSON returned doesn't contain any float value, but an boolean value for OIL_LEVEL_DIPSTICKS_PERCENTAGE. Meaning it had been wrong all the time.

coreywillwhat commented 6 months ago

Thanks for reporting @mm98 !

383 should have removed the old sensor (as it did), and added a new sensor (binary) for your True state value. Seems it didn't do the latter portion. I'll look into it in a little bit. I think some logs are showing true while others are showing True. I wouldn't think that would be an issue, but we can adjust for that easily.

Kolbi commented 6 months ago

I guess the new binary sensor is there? The old sensor you can delete safely.

mm98 commented 6 months ago

I guess the new binary sensor is there? The old sensor you can delete safely.

Your right. I could use the binary_sensor.audi_a5_sportback_oil_level_binary instead. Thanks.

mm98 commented 6 months ago

I'll close this, since I can just use the binary sensor.

arandax commented 6 months ago

My sensor became unavailable but no other binary sensor is showing

xhemp commented 6 months ago

I have the same problem as @arandax. Scratch that, I have the binary but the previous oil sensor was there, I just disabled it and all is well.

coreywillwhat commented 6 months ago

@arandax @xhemp please provide logs so we can investigate.

heymoe commented 6 months ago

@coreywillwhat Just tossing my hat into the ring here too. The original oil level sensors became unavailable as described by the OP of this issue. I deleted it since Home Assistant said it wasn't being managed or something like that anymore. The replacement / newer binary_sensor mentioned as the solution to this issue does not exist / was not created The only oil related sensors I have now are the oil change distance and oil change time.

Other than the missing oil level sensors, everything else seems to be working fine (34 entities created by this integration with valid data)

I did enabled debug logging but didn't see any unusual errors. I do have 2x 403 ClientResponseErrors but those are for the trip data and climater which I'm pretty sure are not features supported by my 2019 B9 Audi (US).

The only oil level related log lines I found are the following:

2024-04-29 01:56:46.309 DEBUG (MainThread) [custom_components.audiconnect.audi_models] TRY APPEND FIELD: Searching for 'OIL_LEVEL_DIPSTICKS_PERCENTAGE' at location=['oilLevel', 'oilLevelStatus', 'value', 'value']
2024-04-29 01:56:46.309 DEBUG (MainThread) [custom_components.audiconnect.audi_models] TRY APPEND FIELD: Value for 'OIL_LEVEL_DIPSTICKS_PERCENTAGE' is None or missing; not appending field.

Here is the DEBUG log line for "Vehicle data returned for VIN":

2024-04-29 01:56:46.308 DEBUG (MainThread) [custom_components.audiconnect.audi_services] Vehicle data returned for VIN: *************XXXX: {'access': {'accessStatus': {'value': {'overallStatus': 'safe', 'carCapturedTimestamp': datetime.datetime(2024, 4, 27, 23, 56, 22, tzinfo=datetime.timezone.utc), 'doors': [{'name': 'bonnet', 'status': ['closed']}, {'name': 'frontLeft', 'status': ['locked', 'closed']}, {'name': 'frontRight', 'status': ['locked', 'closed']}, {'name': 'rearLeft', 'status': ['locked', 'closed']}, {'name': 'rearRight', 'status': ['locked', 'closed']}, {'name': 'trunk', 'status': ['locked', 'closed']}], 'windows': [{'name': 'frontLeft', 'status': ['closed']}, {'name': 'frontRight', 'status': ['closed']}, {'name': 'rearLeft', 'status': ['closed']}, {'name': 'rearRight', 'status': ['closed']}, {'name': 'roofCover', 'status': ['unsupported']}, {'name': 'sunRoof', 'status': ['closed']}], 'doorLockStatus': 'locked'}}}, 'fuelStatus': {'rangeStatus': {'value': {'carCapturedTimestamp': datetime.datetime(2024, 4, 27, 23, 56, 22, tzinfo=datetime.timezone.utc), 'carType': 'gasoline', 'primaryEngine': {'type': 'gasoline', 'currentSOC_pct': 100, 'remainingRange_km': 667, 'currentFuelLevel_pct': 100}, 'totalRange_km': 667}}}, 'measurements': {'rangeStatus': {'value': {'carCapturedTimestamp': datetime.datetime(2024, 4, 27, 23, 56, 22, tzinfo=datetime.timezone.utc), 'gasolineRange': 667, 'totalRange_km': 667}}, 'odometerStatus': {'value': {'carCapturedTimestamp': datetime.datetime(2024, 4, 27, 23, 56, 22, tzinfo=datetime.timezone.utc), 'odometer': 35153}}, 'fuelLevelStatus': {'value': {'carCapturedTimestamp': datetime.datetime(2024, 4, 27, 23, 56, 22, tzinfo=datetime.timezone.utc), 'currentFuelLevel_pct': 100, 'primaryEngineType': 'gasoline', 'carType': 'gasoline'}}}, 'vehicleLights': {'lightsStatus': {'value': {'carCapturedTimestamp': datetime.datetime(2024, 4, 27, 23, 56, 22, tzinfo=datetime.timezone.utc), 'lights': [{'name': 'right', 'status': 'off'}, {'name': 'left', 'status': 'off'}]}}}, 'vehicleHealthInspection': {'maintenanceStatus': {'value': {'carCapturedTimestamp': datetime.datetime(2024, 4, 27, 23, 56, 12, tzinfo=datetime.timezone.utc), 'inspectionDue_days': 384, 'inspectionDue_km': 25589, 'mileage_km': 35153, 'oilServiceDue_days': 19, 'oilServiceDue_km': 9495}}}}

I hope the above is helpful.

-Gary

mm98 commented 6 months ago

The only oil level related log lines I found are the following:

That is actualy a bit strange, that there can be such a big different between the Audi response data (EV vs gasoline maybe). I just checked my logs and found this. The sensor is working by me.

Audi API response:

'oilLevel': {'oilLevelStatus': {'value': {'carCapturedTimestamp': datetime.datetime(2024, 4, 28, 13, 12, 43, tzinfo=datetime.timezone.utc), 'value': True}}}

Audi Connect parsing:

TRY APPEND FIELD: Searching for 'OIL_LEVEL_DIPSTICKS_PERCENTAGE' at location=['oilLevel', 'oilLevelStatus', 'value', 'value']
TRY APPEND FIELD: Found 'OIL_LEVEL_DIPSTICKS_PERCENTAGE' with value=True, loc=['oilLevel', 'oilLevelStatus', 'value', 'carCapturedTimestamp'], ts=2024-04-28 13:12:43+00:00

Located with OIL_LEVEL_DIPSTICKS_PERCENTAGE=true. So what would a true value define - that there would be more information available somewhere (the first api response doesn't contain any) ?

home-assistant_audiconnect_2024-04-29T07-19-42.831Z.log

heymoe commented 6 months ago

On a side note, I just loaded up the MyAudi App (Android) and it also no longer shows me the oil level or even simple status (e.g: Oil Level: OK) in there. I see fuel level but no oil level unless they hid it somewhere that I have not found yet.

So, maybe for me, not having an oil level status is an Audi issue (or "feature") for my car and not a problem with the integration?

I did find an Audi World forum post of others talking about the MyAudi app no longer reporting oil level / status from 2022. It sounds like for the B9 the accuracy of the oil level reported in the MyAudi app was hit or miss. Originally the MyAudi app would report oil level as a % then they changed it to a simple status (OK / Low I guess) and now it's just gone.

https://www.audiworld.com/forums/a4-b9-platform-discussion-212/app-cant-check-oil-3037827/

coreywillwhat commented 6 months ago

Thanks for providing logs and your investigation @heymoe ! I can confirm the Audi API is no longer reporting the oil level, neither percentage nor binary, for your vehicle based on the log data you provided. Sorry for your loss :(

heymoe commented 6 months ago

No problem. Thanks for confirming Audi removing the feature for my car and for keeping this integration working in general.