bimmerconnected/ha_custom_component

can't login issue

DanivosYoun opened this issue · 2 comments

Hi there,

i use home assistant core 2022.6.6 & home assistant OS 8.2

when i try to logged in, unknow error occured,

can you check my attached logs? i tried H/A Included integration & HACS Beta integrations both same error occured

Regards

Logger: aiohttp.server
Source: custom_components/bmw_connected_drive/config_flow.py:42
Integration: BMW Connected Drive
First occurred: 22:23:28 (1 occurrences)
Last logged: 22:23:28

Error handling request
ValueError: 'VEHICLE DATA OFF' is not a valid LockState

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 220, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 205, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in async_configure
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 335, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/bmw_connected_drive/config_flow.py", line 68, in async_step_user
info = await validate_input(self.hass, user_input)
File "/config/custom_components/bmw_connected_drive/config_flow.py", line 42, in validate_input
await account.get_vehicles()
File "/usr/local/lib/python3.9/site-packages/bimmer_connected/account.py", line 86, in get_vehicles
self.vehicles.append(MyBMWVehicle(self, vehicle_dict))
File "/usr/local/lib/python3.9/site-packages/bimmer_connected/vehicle/vehicle.py", line 90, in init
self.update_state(vehicle_data)
File "/usr/local/lib/python3.9/site-packages/bimmer_connected/vehicle/vehicle.py", line 109, in update_state
curr_attr.update_from_vehicle_data(vehicle_data)
File "/usr/local/lib/python3.9/site-packages/bimmer_connected/models.py", line 36, in update_from_vehicle_data
parsed = self._parse_vehicle_data(vehicle_data) or {}
File "/usr/local/lib/python3.9/site-packages/bimmer_connected/vehicle/doors_windows.py", line 95, in _parse_vehicle_data
retval["door_lock_state"] = LockState(vehicle_data["status"]["doorsGeneralState"].upper())
File "/usr/local/lib/python3.9/enum.py", line 384, in call
return cls.new(cls, value)
File "/usr/local/lib/python3.9/enum.py", line 709, in new
raise exc
File "/usr/local/lib/python3.9/enum.py", line 692, in new
result = cls.missing(value)
File "/usr/local/lib/python3.9/site-packages/bimmer_connected/models.py", line 19, in missing
raise ValueError(f"'{value}' is not a valid {cls.name}")
ValueError: 'VEHICLE DATA OFF' is not a valid LockState

VEHICLE DATA OFF looks like you're vehicle has been set not to provide any data (at least for LockState).
I'll have a look on how to best integrate this (so that it doesn't break everything).

Since 2022.7.0 at least you should be able to login. You probably still get warnings about something not being a valid LockState (or other state) but all sensors that are not relying on these attributes should work.