StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
620 stars 111 forks source link

[BUG] Recurrent error log #551

Open welcoMattic opened 3 years ago

welcoMattic commented 3 years ago

Environment

Describe the bug

It find this error in HA logs, many times (33296):

Logger: pyShelly
Source: helpers/entity.py:474
First occurred: 6 mai 2021 à 10:43:17 (33296 occurrences)
Last logged: 15:25:26
Error receive CoAP

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pyShelly/coap.py", line 187, in _loop
    self._root.update_block(device_id, device_type,
  File "/usr/local/lib/python3.8/site-packages/pyShelly/__init__.py", line 307, in update_block
    block.update_coap(data, ipaddr)
  File "/usr/local/lib/python3.8/site-packages/pyShelly/block.py", line 101, in update_coap
    dev.raise_updated()
  File "/usr/local/lib/python3.8/site-packages/pyShelly/base.py", line 45, in raise_updated
    callback(self)
  File "/config/custom_components/shelly/device.py", line 58, in _updated
    self._update_ha_state()
  File "/config/custom_components/shelly/device.py", line 51, in _update_ha_state
    self.schedule_update_ha_state(True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in schedule_update_ha_state
    self.hass.add_job(self.async_update_ha_state(force_refresh))  # type: ignore
AttributeError: 'NoneType' object has no attribute 'add_job'

Steps to Reproduce

Install ShellyForHASS and get connected 1 or many Shelly 1PM and 1 or many Shelly 2.5 I guess.

Expected behavior

Fix the error, or handle it

gerard33 commented 3 years ago

I have the same issue with version 0.2.2 and HA 2021.7.4. Is a fix available for this?

gerard33 commented 3 years ago

Seems to be caused by the error below, as I see the self.hass.add_job(self.async_update_ha_state(force_refresh)) error directly starting after this:

Logger: homeassistant.components.switch
Source: helpers/entity_platform.py:567
Integration: Schakelaar (documentation, issues)
First occurred: 13:24:50 (1 occurrences)
Last logged: 13:24:50

Platform shelly does not generate unique IDs.
ID shelly_shplg_s_9dc9d3_firmware_update is already used by switch.shelly_shplg_s_9dc9d3_firmware_update -
ignoring switch.shelly_shplg_s_9dc9d3_firmware_update
Senbei123 commented 2 years ago

Just to add my 2 cent: I have the same issue with this "Platform shelly does not generate unique IDs. "

vdiogo commented 2 years ago

Same issue: core-2021.10.6 & ShellyForHass 0.2.2

Logger: pyShelly
Source: helpers/entity.py:577 
First occurred: 01:12:19 (1767 occurrences) 
Last logged: 08:55:07

Error receive CoAP
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pyShelly/coap.py", line 187, in _loop
    self._root.update_block(device_id, device_type,
  File "/usr/local/lib/python3.9/site-packages/pyShelly/__init__.py", line 307, in update_block
    block.update_coap(data, ipaddr)
  File "/usr/local/lib/python3.9/site-packages/pyShelly/block.py", line 110, in update_coap
    self.raise_updated()
  File "/usr/local/lib/python3.9/site-packages/pyShelly/base.py", line 45, in raise_updated
    callback(self)
  File "/config/custom_components/shelly/block.py", line 68, in _updated
    self._update_ha_state()
  File "/config/custom_components/shelly/block.py", line 60, in _update_ha_state
    self.schedule_update_ha_state(True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 577, in schedule_update_ha_state
    self.hass.add_job(self.async_update_ha_state(force_refresh))  # type: ignore
AttributeError: 'NoneType' object has no attribute 'add_job'