Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSCPKeyError #140

Open
4 tasks done
drizzd opened this issue Apr 22, 2024 · 0 comments
Open
4 tasks done

RSCPKeyError #140

drizzd opened this issue Apr 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@drizzd
Copy link

drizzd commented Apr 22, 2024

System Health details

System Information

version core-2023.7.3
installation_type Home Assistant Container
dev false
hassio false
docker true
user root
virtualenv false
python_version 3.11.4
os_name Linux
os_version 6.1.21-v7+
arch armv7l
timezone Europe/Berlin
config_dir /config
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Dashboards
dashboards 3
resources 2
views 6
mode storage
Recorder
oldest_recorder_run 11. April 2024 um 16:33
current_recorder_run 22. April 2024 um 22:38
estimated_db_size 238.18 MiB
database_engine sqlite
database_version 3.41.2

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

I started using hacs-e3dc in November 2023. I updated E3DC to latest firmware 2 weeks ago. Shortly after I updated hacs-e3dc from 3.4.2 to 3.6.2 for #118. Since then RSCPKeyError was raised twice: In e3dc.poll on April 18 and in get_manual_charge->sendRequest on April 22. In e3dc_proxy.py we raise ConfigEntryAuthFailed on RSCPKeyError. This causes Home Assistant to stop the integration until the user manually re-authenticates.

The issue does not appear to be related to authentication. I have not changed my passwords and I re-authenticate successfully with the same credentials. Removing the RSCPKeyError clause fixes the issue for me.

@@ -40,11 +41,6 @@ def e3dc_call(func):
         except AuthenticationError as ex:
             _LOGGER.exception("Failed to authenticate with E3DC: %s", ex)
             raise ConfigEntryAuthFailed("Failed to authenticate with E3DC") from ex
-        except RSCPKeyError as ex:
-            _LOGGER.exception("Encryption error with E3DC, key invalid: %s", ex)
-            raise ConfigEntryAuthFailed(
-                "Encryption Error with E3DC, key invalid"
-            ) from ex
         except (HomeAssistantError, ConfigEntryAuthFailed):
             raise
         except Exception as ex:

Reproduction steps

To reproduce I made the following change.

@@ -119,6 +120,9 @@ class E3DCProxy:
     def get_manual_charge(self) -> dict[str, Any]:
         """Poll manual charging state."""
         try:
+            if random.random() > 0.99:
+                self.e3dc.disconnect()
+                raise RSCPKeyError
             data = self.e3dc.sendRequest(
                 (RscpTag.EMS_REQ_GET_MANUAL_CHARGE, RscpType.NoneType, None), keepAlive=True
             )

Debug logs

It takes several days until the issue triggers. Please let me know if more information is required.

Diagnostics dump

No response

@drizzd drizzd added the bug Something isn't working label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant