bimmerconnected / bimmer_connected

🚘 Library to query the status of your BMW or Mini from the ConnectedDrive portal
Apache License 2.0
364 stars 79 forks source link

lights_parking sensor no longer available #296

Closed lolouk44 closed 3 years ago

lolouk44 commented 3 years ago

Describe the issue

One of the sensors (binary_sensor.lights_parking) is always showing unavailable since the past 2 HA releases and my logs get flooded with this:

2021-07-28 18:03:50 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 406, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 456, in _async_write_ha_state
extra_state_attributes = self.extra_state_attributes
File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/binary_sensor.py", line 127, in extra_state_attributes
result["lights_parking"] = vehicle_state.parking_lights.value
AttributeError: 'NoneType' object has no attribute 'value'

Expected behavior

The sensor is available is accurate

Which Home Assistant version are you using?

core-2021.7.4

What was the last working version of Home Assistant Core?

core-2021.5.4

What is your region?

Rest of world

ConnectedDrive website

Number of cars

Output of bimmer_connected fingerprint

DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:getting new oauth token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): customer.bmwgroup.com:443
DEBUG:urllib3.connectionpool:https://customer.bmwgroup.com:443 "POST /gcdm/oauth/token HTTP/1.1" 200 None
DEBUG:bimmer_connected.account:got new token [redacted] with expiration date 2021-07-28 21:59:07.231850
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.com:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.com:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.com:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.com:443 "GET /webapi/v1/user/vehicles/[redacted]/status?deviceTime=2021-07-28T20%3A59%3A07&dlat=0.0&dlon=0.0 HTTP/1.1" 200 None
DEBUG:bimmer_connected.state:{'STATUS': {'vin': '[redacted]', 'mileage': 46555, 'updateReason': 'VEHICLE_SHUTDOWN_SECURED', 'updateTime': '2021-07-28T08:44:35+0000', 'doorDriverFront': 'CLOSED', 'doorDriverRear': 'CLOSED', 'doorPassengerFront': 'CLOSED', 'doorPassengerRear': 'CLOSED', 'windowDriverFront': 'CLOSED', 'windowDriverRear': 'CLOSED', 'windowPassengerFront': 'CLOSED', 'windowPassengerRear': 'CLOSED', 'trunk': 'CLOSED', 'rearWindow': 'INVALID', 'hood': 'CLOSED', 'doorLockState': 'SECURED', 'remainingFuel': 22, 'remainingRangeFuel': 340, 'remainingRangeFuelMls': 211, 'position': {'lat': [redacted], 'lon': [redacted], 'heading': 80, 'status': 'OK'}, 'internalDataTimeUTC': '2021-07-28T08:44:35', 'singleImmediateCharging': False, 'vehicleCountry': 'GB', 'checkControlMessages': [], 'cbsData': [{'cbsType': 'OIL', 'cbsState': 'OK', 'cbsRemainingMileage': 7000, 'cbsDueDate': '2021-10', 'cbsDescription': 'Next service due when the stated distance has been covered or by the specified date.'}, {'cbsType': 'VEHICLE_CHECK', 'cbsState': 'OK', 'cbsRemainingMileage': 7000, 'cbsDueDate': '2021-10', 'cbsDescription': 'Next visual inspection due when the stated distance has been covered or by the stated date.'}, {'cbsType': 'VEHICLE_TUV', 'cbsState': 'OK', 'cbsDueDate': '2022-01', 'cbsDescription': 'Next statutory vehicle inspection due by the stated date.'}, {'cbsType': 'BRAKE_FLUID', 'cbsState': 'OK', 'cbsDueDate': '2023-01', 'cbsDescription': 'Next change due at the latest by the stated date.'}], 'DCS_CCH_Activation': 'NA', 'DCS_CCH_Ongoing': False}, 'LAST_TRIP': {}, 'ALL_TRIPS': {}, 'CHARGING_PROFILE': {}, 'DESTINATIONS': {}, 'RANGEMAP': {}, 'EFFICIENCY': {}, 'NAVIGATION': {}}
DEBUG:bimmer_connected.state:received new data from connected drive
fingerprint of the vehicles written to /root/vehicle_fingerprint/2021-07-28_20-59-06

Anything in the logs that might be useful for us?

2021-07-28 18:03:50 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 406, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 456, in _async_write_ha_state
extra_state_attributes = self.extra_state_attributes
File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/binary_sensor.py", line 127, in extra_state_attributes
result["lights_parking"] = vehicle_state.parking_lights.value
AttributeError: 'NoneType' object has no attribute 'value'

Additional information

No response

gerard33 commented 3 years ago

The parking light data is not available anymore, at least for some cars, in the BMW ConnectedDrive API. I had the same with my car. Fix is on the way -> #295

github-actions[bot] commented 2 years ago

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.