AlexxIT / SonoffLAN

Control Sonoff Devices with eWeLink (original) firmware over LAN and/or Cloud from Home Assistant
https://github.com/AlexxIT/Blog
MIT License
2.75k stars 418 forks source link

Hass 2024.1 error: RecursionError #1285

Closed mesut3000 closed 11 months ago

mesut3000 commented 11 months ago

I have 24 Sonoff devices in my system. I have been using them for years. But I am not sure why, my system is crashing and devices can not respond from Home Assistant. Everything is OK by the Ewelink app.

I removed HACS addon, integration many times and installed again. I can see all my devices but they do not respond.

For switches there is also a strange thing. When I turn on one, it turns but on Home Assistants it is still off. It cant read its state.

This is what I see this error in my logs:

Log details (ERROR)
Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:507
Integration: Sensor ([documentation](https://rc.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 08:40:44 (1 occurrences)
Last logged: 08:40:44

Error adding entities for domain sensor with platform sonoff
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 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1278, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1062, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 999, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 947, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 529, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/backports/functools.py", line 70, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 449, in native_value
    return self._attr_native_value
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 338, in _getter
    return getattr(o, private_attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 338, in _getter
    return getattr(o, private_attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 338, in _getter
    return getattr(o, private_attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 976 more times]
RecursionError: maximum recursion depth exceeded
mattomu22 commented 11 months ago

Hallo. Exactly same problem for me. Always perfect and now stopped. Ewlink app is working fine. I think it is coincident with latest HA update. Following...

lloydcferguson commented 11 months ago

Same problem

dCypherNx commented 11 months ago

Same here, just updated HA core to 2024.1.0b2, was working fine until 2023 stable and beta versions

lloydcferguson commented 11 months ago

Strangely enough, it is working now!

I could not access my Sonoff device through the eWeLink app on Android either. tried reinstalling with no luck. A;so noticed that my phone would not connect to the "guest" WiFi net work with an error like "could not get IP address". Rebooted my AT&T fiber gateway and also had to restart the 2.4 GHz WiFi, and everything now works. I've seen the IP Address problem on the gateway before. haven't had a chance to dig into it.

This is what I suspect happened:

mesut3000 commented 11 months ago

Strangely enough, it is working now!

I could not access my Sonoff device through the eWeLink app on Android either. tried reinstalling with no luck. A;so noticed that my phone would not connect to the "guest" WiFi net work with an error like "could not get IP address". Rebooted my AT&T fiber gateway and also had to restart the 2.4 GHz WiFi, and everything now works. I've seen the IP Address problem on the gateway before. haven't had a chance to dig into it.

This is what I suspect happened:

  • The Sonoff device got an IP address while the DHCP service on the gateway was working. I seem to remember that once a device has an address it will keep it even if a subsequent lease renewal fails so, it just kept it even though the DHCP service stopped at some point.
  • I did unplug the Sonoff device yesterday and when I reconnected it it could not get an address so it went off-line in both Home Assistant and the Sonoff app.

eWelink app works for me. There is nothing wrong there. I think there is something wrong between Home Assistant and eWelink app. I can turn on a light on Home Assistant which has Sonoff integration, but its state remains off.

lloydcferguson commented 11 months ago

Both the App and Home Assistant are working for me...


From: mesut3000 @.> Sent: Sunday, December 31, 2023 2:43:52 PM To: AlexxIT/SonoffLAN @.> Cc: lloydcferguson @.>; Comment @.> Subject: Re: [AlexxIT/SonoffLAN] Integration not working (Issue #1285)

Strangely enough, it is working now!

I could not access my Sonoff device through the eWeLink app on Android either. tried reinstalling with no luck. A;so noticed that my phone would not connect to the "guest" WiFi net work with an error like "could not get IP address". Rebooted my AT&T fiber gateway and also had to restart the 2.4 GHz WiFi, and everything now works. I've seen the IP Address problem on the gateway before. haven't had a chance to dig into it.

This is what I suspect happened:

eWelink app works for me. There is nothing wrong there. I think there is something wrong between Home Assistant and eWelink app. I can turn on a light on Home Assistant which has Sonoff integration, but its state remains off.

— Reply to this email directly, view it on GitHubhttps://github.com/AlexxIT/SonoffLAN/issues/1285#issuecomment-1873049263, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZY265ASIDWD3IW7UFARSIDYMHTCRAVCNFSM6AAAAABBIAYJ2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGA2DSMRWGM. You are receiving this because you commented.Message ID: @.***>

mesut3000 commented 11 months ago

Both the App and Home Assistant are working for me...


From: mesut3000 @.> Sent: Sunday, December 31, 2023 2:43:52 PM To: AlexxIT/SonoffLAN @.> Cc: lloydcferguson @.>; Comment @.> Subject: Re: [AlexxIT/SonoffLAN] Integration not working (Issue #1285)

Strangely enough, it is working now!

I could not access my Sonoff device through the eWeLink app on Android either. tried reinstalling with no luck. A;so noticed that my phone would not connect to the "guest" WiFi net work with an error like "could not get IP address". Rebooted my AT&T fiber gateway and also had to restart the 2.4 GHz WiFi, and everything now works. I've seen the IP Address problem on the gateway before. haven't had a chance to dig into it.

This is what I suspect happened:

  • The Sonoff device got an IP address while the DHCP service on the gateway was working. I seem to remember that once a device has an address it will keep it even if a subsequent lease renewal fails so, it just kept it even though the DHCP service stopped at some point.
  • I did unplug the Sonoff device yesterday and when I reconnected it it could not get an address so it went off-line in both Home Assistant and the Sonoff app.

eWelink app works for me. There is nothing wrong there. I think there is something wrong between Home Assistant and eWelink app. I can turn on a light on Home Assistant which has Sonoff integration, but its state remains off.

— Reply to this email directly, view it on GitHubhttps://github.com/AlexxIT/SonoffLAN/issues/1285#issuecomment-1873049263, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZY265ASIDWD3IW7UFARSIDYMHTCRAVCNFSM6AAAAABBIAYJ2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGA2DSMRWGM. You are receiving this because you commented.Message ID: @.***>

Which Home Assistant release do you have. I think 2024.1 beta has this issue.

gcarneiro commented 11 months ago

Same problem here, my automations started failing and device status it is not working. Problem began after ha core 2024 update

SpartanTech commented 11 months ago

Same problem here after a 2024 core update. Works fine in the app. Integration fails to retrieve states. Can send commands just fine.

Screenshot_20240104_034458_Solid Explorer Screenshot_20240104_034518_Solid Explorer

SpartanTech commented 11 months ago

Running 2024.1.0 stable

hmmbob commented 11 months ago

There's a fix for that available in #1288

SpartanTech commented 11 months ago

Much love. So many hours today working on it

AlexxIT commented 11 months ago

https://github.com/AlexxIT/SonoffLAN/releases/tag/v3.5.4