robinostlund / homeassistant-volkswagencarnet

Volkswagen Carnet Component for home assistant
GNU General Public License v3.0
304 stars 60 forks source link

[BUG] No data for e-golf 4.5.1 #565

Closed MartinSchmidt closed 5 months ago

MartinSchmidt commented 5 months ago

Before you post a new issue - you must first check the following (and check the boxes with an "X" below)

Environment

Describe the bug

No data comes into home-assistant, a series of errors occur in the, attached below.

Steps to Reproduce

Upgrade existing plugin to 4.5.1

Expected behavior

To data to come in

Traceback/Error logs

2024-02-06 06:57:08.750 ERROR (MainThread) [homeassistant.components.switch] Error adding entities for domain switch with platform volkswagencarnet
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
    entity_category=entity.entity_category,
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/switch.py", line 98, in entity_category
    if self.instrument.entity_type == "diag":
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BatteryClimatisation' object has no attribute 'entity_type'
2024-02-06 06:57:08.757 ERROR (MainThread) [homeassistant.components.switch] Error while setting up volkswagencarnet platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
    entity_category=entity.entity_category,
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/switch.py", line 98, in entity_category
    if self.instrument.entity_type == "diag":
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BatteryClimatisation' object has no attribute 'entity_type'
2024-02-06 06:57:08.765 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform volkswagencarnet
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
    entity_category=entity.entity_category,
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/sensor.py", line 87, in entity_category
    if self.instrument.entity_type == "diag":
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Sensor' object has no attribute 'entity_type'
2024-02-06 06:57:08.768 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entities for domain binary_sensor with platform volkswagencarnet
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
    entity_category=entity.entity_category,
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/binary_sensor.py", line 62, in entity_category
    if self.instrument.entity_type == "diag":
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BinarySensor' object has no attribute 'entity_type'
2024-02-06 06:57:08.771 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up volkswagencarnet platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
    entity_category=entity.entity_category,
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/sensor.py", line 87, in entity_category
    if self.instrument.entity_type == "diag":
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Sensor' object has no attribute 'entity_type'
2024-02-06 06:57:08.774 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up volkswagencarnet platform for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
    entity_category=entity.entity_category,
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/binary_sensor.py", line 62, in entity_category
    if self.instrument.entity_type == "diag":
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BinarySensor' object has no attribute 'entity_type'

Debug information - all JSON responses from logfile

Additional context

I did some digging, and version 4.5.1 uses volkswagencarnet==4.4.65 where it seems like not all entities have the entity_type set. Maybe a check to validate if the field is set, and if not return none.

if not hasattr(self.instrument, 'entity_type'):
    return None
stickpin commented 5 months ago

@MartinSchmidt it seems to be something wrong with your local installation. __pycache__ is not renewed? Try to uninstall the integration completely, restart the Home Assistant, and try to install the integration again.

MartinSchmidt commented 4 months ago

@stickpin i just tried, removed the plugin, restarted the HA and installed it again, still same issue:

2024-02-13 09:52:08.546 ERROR (MainThread) [homeassistant.components.switch] Error adding entities for domain switch with platform volkswagencarnet
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
entity_category=entity.entity_category,
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/volkswagencarnet/switch.py", line 98, in entity_category
if self.instrument.entity_type == "diag":
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BatteryClimatisation' object has no attribute 'entity_type'
2024-02-13 09:52:08.553 ERROR (MainThread) [homeassistant.components.switch] Error while setting up volkswagencarnet platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
entity_category=entity.entity_category,
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/volkswagencarnet/switch.py", line 98, in entity_category
if self.instrument.entity_type == "diag":
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BatteryClimatisation' object has no attribute 'entity_type'
2024-02-13 09:52:08.563 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entities for domain binary_sensor with platform volkswagencarnet
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
entity_category=entity.entity_category,
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/volkswagencarnet/binary_sensor.py", line 62, in entity_category
if self.instrument.entity_type == "diag":
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BinarySensor' object has no attribute 'entity_type'
2024-02-13 09:52:08.567 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform volkswagencarnet
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
entity_category=entity.entity_category,
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/volkswagencarnet/sensor.py", line 87, in entity_category
if self.instrument.entity_type == "diag":
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Sensor' object has no attribute 'entity_type'
2024-02-13 09:52:08.573 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up volkswagencarnet platform for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
entity_category=entity.entity_category,
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/volkswagencarnet/binary_sensor.py", line 62, in entity_category
if self.instrument.entity_type == "diag":
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BinarySensor' object has no attribute 'entity_type'
2024-02-13 09:52:08.578 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up volkswagencarnet platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in _async_add_entity
entity_category=entity.entity_category,
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/volkswagencarnet/sensor.py", line 87, in entity_category
if self.instrument.entity_type == "diag":
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Sensor' object has no attribute 'entity_type'
MartinSchmidt commented 4 months ago

I just when through the files /deps/lib/python3.11/site-packages, apparently only the old ones was located there for some reason, cleaned them out together with the pycache again, and it now worked.