skagmo / ha_vwid

Volkswagen ID component for Home Assistant
71 stars 25 forks source link

Set up failed #21

Closed Tassel8062 closed 2 years ago

Tassel8062 commented 2 years ago

Im getting the same issue as #11 on a new set up. I have tried in uppercase as per user on #11

The car has been registered today and connected to the we connect ID app.

vwid: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 684, in async_device_update await task File "/config/custom_components/vwid/sensor.py", line 95, in async_update self._state = int(data['data']['batteryStatus']['currentSOC_pct']) KeyError: 'batteryStatus'

balcando commented 2 years ago

I get THE same error

skagmo commented 2 years ago

Hi. Can you go to sensor.py line 94 (just before the line where it accesses currentSOC_pct) add _LOGGER.exception("Data:", data['data']['batteryStatus']), and tell me what kind of output you get?

Tassel8062 commented 2 years ago

Ok added the code and the sensor.py now reads

async def async_update(self):
    data = await self.api.get_status()
    if (data):
        # Add state of charge as value
        _LOGGER.exception("Data:", data['data']['batteryStatus'])
        self._state = int(data['data']['batteryStatus']['currentSOC_pct'])
        # For now, just flatten tree structure and add two-level deep parameters as attributes

Rebooted and error reads

2022-02-06 08:32:56 ERROR (MainThread) [homeassistant.components.sensor] vwid: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 709, in async_device_update await task File "/config/custom_components/vwid/sensor.py", line 95, in async_update _LOGGER.exception("Data:", data['data']['batteryStatus']) KeyError: 'batteryStatus'

skagmo commented 2 years ago

Ok thanks, can you try the same thing with data['data'], and if that also fails try just data?

Tassel8062 commented 2 years ago

Updated line to read _LOGGER.exception(data['data']['batteryStatus'])

Rebooted and error

2022-02-06 09:22:18 ERROR (MainThread) [homeassistant.components.sensor] vwid: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 709, in async_device_update await task File "/config/custom_components/vwid/sensor.py", line 95, in async_update _LOGGER.exception(data['data']['batteryStatus']) KeyError: 'batteryStatus'

Tried with _LOGGER.exception(data['batteryStatus']) Rebooted and get the following error

2022-02-06 09:27:41 ERROR (MainThread) [homeassistant.components.sensor] vwid: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 709, in async_device_update await task File "/config/custom_components/vwid/sensor.py", line 95, in async_update _LOGGER.exception(data['batteryStatus']) KeyError: 'batteryStatus'

skagmo commented 2 years ago

Sorry, wasn't clear enough. Can you try: _LOGGER.exception(data, data['data'])

Tassel8062 commented 2 years ago

ok testing with _LOGGER.exception(data, data['data']) No error message occurs at boot up, still no sensor.state_of_charge found in Entities

skagmo commented 2 years ago

Ok, can you try to view the full log? _LOGGER.exception should cause a log entry...

Tassel8062 commented 2 years ago

Sure, where do I locate the full log ?

BugBasher28 commented 2 years ago

I have the same issue. Have used the integration successfully for many months. Did try the uppercase VIN as suggested in #11 . I added _LOGGER.exception(data, data['data']) at line 93, right before if (data):. This is the log:

2022-02-22 09:27:39 ERROR (MainThread) [custom_components.vwid.sensor] {'data': {'capabilityStatus': {'capabilities': [{'id': 'automation', 'status': [1001, 1005], 'userDisablingAllowed': True}, {'id': 'batteryChargingCare', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'batteryColdWarning', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'batterySupport', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'cdisDigitalKey', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'charging', 'status': [1001, 1005], 'userDisablingAllowed': True}, {'id': 'chargingStations', 'status': [1001, 1005], 'userDisablingAllowed': True}, {'id': 'climatisation', 'status': [1001, 1005], 'userDisablingAllowed': True}, {'id': 'dealerAppointment', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'destinations', 'status': [1001, 1005], 'userDisablingAllowed': True}, {'id': 'fuelStatus', 'status': [1001, 1005], 'userDisablingAllowed': False}, {'id': 'ignition', 'status': [1001, 1005], 'userDisablingAllowed': False}, {'id': 'mapUpdate', 'status': [1001, 1005], 'userDisablingAllowed': True}, {'id': 'measurements', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'onlineSpeech', 'status': [1001, 1005], 'userDisablingAllowed': True}, {'id': 'parkingBrake', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'parkingInformation', 'status': [1001, 1005], 'userDisablingAllowed': True}, {'id': 'parkingPosition', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'personalizationOnline', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'plugAndCharge', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'poiSearch', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'privateEmergencyCall', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'readiness', 'userDisablingAllowed': False}, {'id': 'roadExperienceManagementLocalization', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'roadExperienceManagementLocalizationUpload', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'roadsideAssistant', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'routing', 'status': [1001, 1005], 'userDisablingAllowed': True}, {'id': 'state', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'trafficInformation', 'status': [1001, 1005], 'userDisablingAllowed': True}, {'id': 'vehicleHealth', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'vehicleHealthInspection', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'vehicleHealthWarnings', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'vehicleLights', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'vehicleWakeUpTrigger', 'status': [1008], 'userDisablingAllowed': False}, {'id': 'webRadio', 'status': [1001, 1005], 'userDisablingAllowed': True}]}, 'readinessStatus': {'connectionState': {'isOnline': False, 'isActive': True, 'batteryPowerLevel': 'comfort', 'dailyPowerBudgetAvailable': True}, 'connectionWarning': {'insufficientBatteryLevelWarning': False, 'dailyPowerBudgetWarning': False}}}, 'error': {}} NoneType: None 2022-02-22 09:27:39 ERROR (MainThread) [homeassistant.components.sensor] vwid: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 718, in async_device_update await task File "/config/custom_components/vwid/sensor.py", line 96, in async_update self._state = int(data['data']['batteryStatus']['currentSOC_pct']) KeyError: 'batteryStatus'

BugBasher28 commented 2 years ago

The car was offline! Without my beloved HASS integration I opened the We Connect app and noticed that it reported the car as offline. Went to the car, turned it on and online and waited a few secs. When it showed in We Connect I restarted Home Assistant and the sensor came back. So I'm guessing the integration doesn't handle offline mode very pretty.

Tassel8062 commented 2 years ago

this is now working for me, after updating to Home Assistant Core 2022.5x