audiconnect / audi_connect_ha

Adds an audi connect integration to home assistant
MIT License
227 stars 98 forks source link

fix: "Secondary Engine Range" Unavailable when 0 #375

Closed coreywillwhat closed 5 months ago

coreywillwhat commented 5 months ago

"Secondary Engine Range" is reporting the sensor as Unavailable when value is 0. The sensor should still show as available, but display 0.

2024-04-11 06:00:02.276 DEBUG (MainThread) [custom_components.audiconnect.audi_models] Found and appended state with timestamp: name=secondaryEngineRange, tsoff=-2, loc=['fuelStatus', 'rangeStatus', 'value', 'carCapturedTimestamp'], val=0, ts=2024-04-11 04:17:04+00:00

321622546-df97d7bb-0c2b-4616-9c6f-9529d7ce741e

The issue is due to python considering "0" as Falsy. We need to specifically check if it is neither None or unsupported.

tested and working with this PR