Olen / homeassistant-plant

Alternative Plant component of home assistant
367 stars 25 forks source link

Integration error after replace_sensor #44

Closed syphernl closed 1 year ago

syphernl commented 2 years ago

After running replace_sensor on one of my plants the integration started failing:

Logger: homeassistant.config_entries
Source: helpers/entity_component.py:157
First occurred: 19:23:18 (18 occurrences)
Last logged: 19:23:18

Error setting up entry Dieffenbachia for sensor
Error setting up entry Dracaena marginata for sensor
Error setting up entry Office sansevieria mikado for sensor
Error setting up entry Tabaksplant for sensor
Error setting up entry Dracaena for sensor
Traceback (most recent call last):
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/config_entries.py", line 357, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/components/number/__init__.py", line 119, in async_setup_entry
    return await component.async_setup_entry(entry)
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/helpers/entity_component.py", line 157, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
Logger: custom_components.plant
Source: helpers/entity_platform.py:520
Integration: Plant monitor ([documentation](https://github.com/Olen/homeassistant-plant/), [issues](https://github.com/Olen/homeassistant-plant/issues))
First occurred: 19:21:43 (18 occurrences)
Last logged: 19:23:18

Platform plant does not generate unique IDs. ID xxxxxxxxxxxxxx is already used by plant.dieffenbachia - ignoring plant.dieffenbachia
Platform plant does not generate unique IDs. ID xxxxxxxxxxxxxxis already used by plant.dracaena_marginata - ignoring plant.dracaena_marginata
Platform plant does not generate unique IDs. ID xxxxxxxxxxxxxxis already used by plant.office_sansevieria_mikado - ignoring plant.office_sansevieria_mikado
Platform plant does not generate unique IDs. ID xxxxxxxxxxxxxxis already used by plant.tabaksplant - ignoring plant.tabaksplant
Platform plant does not generate unique IDs. ID xxxxxxxxxxxxxxis already used by plant.dracaena - ignoring plant.dracaena
Logger: homeassistant.config_entries
Source: custom_components/plant/__init__.py:255
Integration: Plant monitor ([documentation](https://github.com/Olen/homeassistant-plant/), [issues](https://github.com/Olen/homeassistant-plant/issues))
First occurred: 19:21:43 (18 occurrences)
Last logged: 19:23:18

Error setting up entry Dieffenbachia for plant
Error setting up entry Dracaena marginata for plant
Error setting up entry Office sansevieria mikado for plant
Error setting up entry Tabaksplant for plant
Error setting up entry Dracaena for plant
Traceback (most recent call last):
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/config_entries.py", line 357, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/home/hass/.homeassistant/custom_components/plant/__init__.py", line 154, in async_setup_entry
    await _plant_add_to_device_registry(hass, plant_entities, device_id)
  File "/home/hass/.homeassistant/custom_components/plant/__init__.py", line 255, in _plant_add_to_device_registry
    erreg.async_update_entity(entity.registry_entry.entity_id, device_id=device_id)
AttributeError: 'NoneType' object has no attribute 'entity_id'

After a reboot everything was fine again.

syphernl commented 2 years ago

This might be related to / a duplicate of #39