tolwi / hassio-ecoflow-cloud

EcoFlow Cloud Integration for Home Assistant
379 stars 64 forks source link

KeyError: 'type' #362

Open magma1447 opened 6 days ago

magma1447 commented 6 days ago

Today I updated my custom component from v0.13.2 to v.1.20. After that I restarted Home assistant and started seeing this error:

2024-10-09 16:22:06.048 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Home_internal for ecoflow_cloud
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ecoflow_cloud/__init__.py", line 84, in async_setup_entry
    client = EcoflowMQTTClient(hass, entry, auth)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ecoflow_cloud/mqtt/ecoflow_mqtt.py", line 173, in __init__
    self.device_type = entry.data[CONF_DEVICE_TYPE]
                       ~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'type'

I am running Home assistant 2024.8.3. I have tried downgrading the custom component again, but still the same error. I am not 100% the custom component upgrade was the trigger, or the restart itself. But to my knowledge I haven't changed anything else.

Any clue how I can get past this?

magma1447 commented 6 days ago

I "solved" it by removing the custom component. Restarting Home assistant. Home Assistant now asked me if I wanted to remove the orphaned entities and related stuff, which I said yes to. Added the custom component again (v0.13.4), restarted, added my Ecoflows. Things are now working again.

This topic can be closed. But I am leaving it as an FYI to the author (maybe he knows the reason). He should feel free to close it without further comments, I don't need the feedback.