audiconnect / audi_connect_ha

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

Missing entity binary_sensor.audi_windows if no sun_roof is available for vehicle #370

Closed Kolbi closed 5 months ago

Kolbi commented 5 months ago

Describe the bug Introduced with https://github.com/audiconnect/audi_connect_ha/pull/367 - My entity binary_sensor.audi_windows is not available anymore.

Because I don't have an entity sun_roof at all: https://github.com/audiconnect/audi_connect_ha/blob/d4470877d4e4481df0326da564c797ea46610469/custom_components/audiconnect/audi_models.py#L398

So we need to modify: https://github.com/audiconnect/audi_connect_ha/blob/06d588d9512a36fca37b04f9bd9a24dc3b343d6c/custom_components/audiconnect/audi_connect_account.py#L1076 and https://github.com/audiconnect/audi_connect_ha/blob/06d588d9512a36fca37b04f9bd9a24dc3b343d6c/custom_components/audiconnect/audi_connect_account.py#L1093

Logfile 2024-04-12 08:27:17.252 DEBUG (MainThread) [custom_components.audiconnect.audi_models] Data that will be used for _tryAppendStateWithTs: [...] 'windows': [{'name': 'frontLeft', 'status': ['closed']}, {'name': 'frontRight', 'status': ['closed']}, {'name': 'rearLeft', 'status': ['closed']}, {'name': 'rearRight', 'status': ['closed']}, {'name': 'roofCover', 'status': ['unsupported']}, {'name': 'sunRoof', 'status': ['unsupported']}], [...]