ShellyForHASS: [BUG] shelly for hass is flooding the log with errors

Environment

  • ShellyForHASS release with the issue: 1.0.0.beta.2
  • Last working ShellyForHASS release (if known): ?
  • Home Assistant Core release with the issue: 2022.5.5
  • Operating environment (Home Assistant/Supervised/Docker/venv): Supervisor 2022.05.3

Describe the bug

2022-05-28 21:57:42 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entities for domain binary_sensor with platform shelly
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 548, in _async_add_entity
    entity.add_to_platform_abort()
  File "/config/custom_components/shelly/block.py", line 49, in add_to_platform_abort
    super().add_to_platform_abort()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 800, in add_to_platform_abort
    self._call_on_remove_callbacks()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 793, in _call_on_remove_callbacks
    self._on_remove.pop()()
  File "/config/custom_components/shelly/block.py", line 59, in _remove_handler
    self._block.cb_updated.remove(self._updated)
ValueError: list.remove(x): x not in list
2022-05-28 21:57:42 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 548, in _async_add_entity
    entity.add_to_platform_abort()
  File "/config/custom_components/shelly/block.py", line 49, in add_to_platform_abort
    super().add_to_platform_abort()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 800, in add_to_platform_abort
    self._call_on_remove_callbacks()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 793, in _call_on_remove_callbacks
    self._on_remove.pop()()
  File "/config/custom_components/shelly/block.py", line 59, in _remove_handler
    self._block.cb_updated.remove(self._updated)
ValueError: list.remove(x): x not in list

Steps to Reproduce

not very sure where this error message is coming from. It is just flooding the logs

Expected behavior

no error msg.

Screenshots

Traceback/Error logs


Additional context

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 6
  • Comments: 54 (13 by maintainers)

Most upvoted comments

Definitely replace this plugin with the official Shelly integration. It takes some effort, but mostly you just need to copy all the ids and change the ids accordingly to the new ones. Spent 2 hours last week but finally my ram usage is fine without any leak.

does somebody know if i can install the official shelly integration and shelly4hass parallel? in my case i have one shelly4hass installed and when i am installing the official one it looks like it is installing shelly4hass a second time.

i would like to do a stepp by stepp transision to the official one.

I don’t think, having the same problem I had to completely remove shelly4hass before seeing the devices discovered from the official integration. Just make a backup, open a spreadsheet and copy all the relevant ids to keep in the new integration

+1 for following this process. I have 12 Shelly devices and managed to switch them all over following the process detailed above.

One point worth noting is if the Shelly device isn’t named (on the web interface of the Shelly) then it will show in Home Assistant using the MAC address as its name within the Shelly integration which is less than ideal when you want to find a particular one.

To resolve this, I had to ensure that the Device Name was completed on the Shellys. Although even then I had two Shellys that still showed a MAC (these are newer devices so I am guessing slightly different hardware/firmware versions). For these ones, I then tested filling in the Channel Name as well and, hey presto, all the names showed in HA fine.

TL;DR: Complete the Device Name and Channel Name on your Shelly devices via the web interface before adding them to HA.

image

image

I also moved to official Shelly integration. No problems since then.

This is a major issue. I was burning through 8gb of ram in about 6 hours. Couldn’t figure out what it was so I started deleting HACS plugins. removing this plugin fixed ALL of my issues in HA.

I just created a prerelease for 1.0.1 that should fix this issue.

You need to enable beta versions in HACS to see and install it.

Please let me know the result when testing so I can release it fully shortly.