Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] Avoid errors in the log for cars that are not supported #96

Closed
gerard33 opened this issue Oct 19, 2018 · 3 comments
Closed

Comments

@gerard33
Copy link
Member

@m1n3rva
Would be good to have another look at the "lscType": "NOT_SUPPORTED" solution we have discussed earlier here and here.

As is shown here the HA log is showing a lot of errors when the car has no relevant data to show.

We should be able to avoid that and show a neat message in the log stating that it is an unsupported car.

@m1n3rva
Copy link
Contributor

m1n3rva commented Oct 20, 2018

@gerard33 I'm already checking the lscType in Vehicle.available_attributes. This function will give you all the attributes that are available for this vehicle. So if you use only show attributes listed there, you should be safe.

What would you like the API to look like? What should the library do when "lscType": "NOT_SUPPORTED"?

@gerard33
Copy link
Member Author

gerard33 commented Oct 22, 2018

The relevant HA code for the binary sensors as an example is as follows.

So I don't check if the attributes are available in Vehicle.available_attributes. The same approach goes for the sensors in HA as shown here.

But to my understanding these checks should be enough. Because if the car is not supported then only the available sensors should be added.

But in #95 the logs shows a.o. the following error:

 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/binary_sensor/bmw_connected_drive.py", line 117, in device_state_attributes
    result['lights_parking'] = vehicle_state.parking_lights.value
AttributeError: 'NoneType' object has no attribute 'value'

I would not suspect the parking_lights binary sensor to be added due to the current checks.
What's your opinion on this?

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants