Closed lines27 closed 9 months ago
Hello planbnet,
thanks for the fast reaction. I added your changes manually in the two areas of the file livisi_device.py.
After a reboot the error disapeared. But as I listed above in the log, the warnings are still available, due to a problem in:
File "/config/custom_components/livisi/livisi_connector.py", line 151, in _async_request if "errorcode" in response: ^^^^^^^^^^^^^^^^^^^^^^^ TypeError: argument of type 'NoneType' is not iterable
I've updated the code with better error handling. Can you please copy the current livisi_connector.py (https://github.com/planbnet/livisi_unofficial/blob/main/custom_components/livisi/livisi_connector.py) and see if you get a more useful error message so I can see what's causing this problem?
After overriding the code for livisi_connetor.py and a restart I get several warnings in the log:
2024-01-10 10:53:33.783 WARNING (MainThread) [custom_components.livisi] Error getting device state Traceback (most recent call last): File "/config/custom_components/livisi/livisi_connector.py", line 280, in async_get_device_state response = await self.async_send_authorized_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/livisi/livisi_connector.py", line 100, in async_send_authorized_request return await self._async_request(method, url, payload, auth_headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/livisi/livisi_connector.py", line 146, in _async_request response = await self._async_send_request(method, url, payload, headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/livisi/livisi_connector.py", line 172, in _async_send_request raise LivisiException( custom_components.livisi.livisi_errors.LivisiException: No data received from SHC, response code 200 (OK)
Here is the debug-log:
Thanks, but this change was a bit too chatty :) Getting empty responses from the classic SHC seems to be completely normal in some cases. The current version should only report unexpected empty responses.
No problem, I updated the file and here is the debug-log:
Thank you. The issue should be fixed now. If you can confirm this, I will create a new release.
Hello planbnet, no error or waring anymore! Thank you very much for the fast fixing! You should work for livisi. ;-)
Hello planbnet, sorry, but I get additional warings after a restart today. Maybe it is a result after activation of additional devices WDS (contact sensors).
2024-01-11 13:39:08.890 WARNING (MainThread) [custom_components.livisi] Error getting device state Traceback (most recent call last): File "/config/custom_components/livisi/livisi_connector.py", line 285, in async_get_device_state return response.get(key, {}).get("value") ^^^^^^^^^^^^ AttributeError: 'list' object has no attribute 'get'
Now this seems to be the problem I was looking for initially. Getting an empty response was just creating lots of unneccessary warnings, but here it seems like the SHC is returning an unexpected data structure. I've added code to find out what's happening there - if you update livisi_connector.py to the current version you'll get more information in the logs... I'm curious what's being sent there.
Here is the relevant debug-log after update:
home-assistant_livisi_2024-01-11T14-00-52.083Z.log
(Don't know why the time of the log-name is an hour back although the time in HA and of the log entries is correct)
Hi, I have the same problem after installing the latest update.
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.livisi Source: helpers/update_coordinator.py:300 Integration: Livisi Unofficial (documentation, issues) First occurred: 19:59:14 (1 occurrences) Last logged: 19:59:14
Unexpected error fetching Livisi devices data: 'str' object has no attribute 'get' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/livisi/coordinator.py", line 83, in _async_update_data return await self.async_get_devices() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/livisi/coordinator.py", line 103, in async_get_devices devices = await self.aiolivisi.async_get_devices() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/livisi/livisi_connector.py", line 232, in async_get_devices msgtype = message.get("type", "") ^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'get'
an here a warning message:
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.livisi Source: custom_components/livisi/livisi_connector.py:224 Integration: Livisi Unofficial (documentation, issues) First occurred: 19:59:14 (3 occurrences) Last logged: 19:59:14
Invalid capability: errorcode Invalid capability: description Invalid capability: messages
and this:
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.livisi Source: custom_components/livisi/livisi_connector.py:208 Integration: Livisi Unofficial (documentation, issues) First occurred: 19:59:14 (3 occurrences) Last logged: 19:59:14
Invalid room: errorcode Invalid room: description Invalid room: messages
There's just one code path that can lead to this error if I see that correctly: The token expires (errorcode 2007) and the subsequent request returns an errorcode. I'll correct that so the subsequent error will be reported correcectly. These log messages are just misleading.
Sorry, I can't do anything with these protocols. I wouldn't even know where to start the search. However, I am enthusiastic about your integration, it works fantastically, far better than the original Livisi integration. respect.
After updating livisi_connector.py with the newest version and a restart of HA without any error or warning messages, I close the isssue. Thnaks Felix!
I only had this error sporadically, but now every morning for a few days it has been recorded as an error. Interestingly, almost at the same time. Two warnings also appear with this error.
I have to mention that I installed the unofficial version over the official version. So that means the old one is still underneath. I have installed the current version, but I already had this message with the previous version of the unofficial version. I dont know what i can do for this problem
Hello olli711, you are right. I see the same error followed by two warnings at two days at the same time in the log too. Here the error-message: Logger: custom_components.livisi Source: helpers/update_coordinator.py:300 Integration: Livisi Unofficial (documentation, issues) First occurred: 31. Januar 2024 um 14:57:05 (2 occurrences) Last logged: 2. Februar 2024 um 14:57:11
Unexpected error fetching Livisi devices data: 'str' object has no attribute 'get' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/livisi/coordinator.py", line 83, in _async_update_data return await self.async_get_devices() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/livisi/coordinator.py", line 103, in async_get_devices devices = await self.aiolivisi.async_get_devices() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/livisi/livisi_connector.py", line 232, in async_get_devices msgtype = message.get("type", "") ^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'get'
Hello Lines27,
I don't know exactly when I've been getting these messages, but it's been for a while. At first I only had warnings, which I simply ignored, then the error messages came along, exactly the same messages as yours. The time is interesting because the errors and warnings come at exactly the same time every day.
The integration worked fine until a certain installation of Home Assistant. Unfortunately I didn't note this until which version everything was fine.
Now this issue is a mixup of at least 3 different problems. However, the latest one should not cause any issues besides the data not being reloaded just after the token is updated (once every 24h I guess): 4 requests are sent in parallel, and if the token has expired, all those 4 requests will try to rerequest the token, but only one will succees so the others fail (just in that one iteration). I've added a fix for it now (be sending one short request before the massive parallel update) but I've not yet created a release.
System Health details
System Information
Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4891 Installed Version | 1.33.0 Stage | running Available Repositories | 1371 Downloaded Repositories | 5Home Assistant Cloud
logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | okHome Assistant Supervisor
host_os | Home Assistant OS 11.3 -- | -- update_channel | stable supervisor_version | supervisor-2023.12.0 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 234.0 GB disk_used | 7.8 GB healthy | true supported | true board | generic-x86-64 supervisor_api | ok version_api | ok installed_addons | Terminal & SSH (9.8.1), Studio Code Server (5.14.2), Node-RED (17.0.0)Dashboards
dashboards | 3 -- | -- resources | 2 views | 5 mode | storageRecorder
oldest_recorder_run | 2. Januar 2024 um 12:04 -- | -- current_recorder_run | 9. Januar 2024 um 12:37 estimated_db_size | 127.09 MiB database_engine | sqlite database_version | 3.41.2Checklist
Describe the issue
With the official Livisi integration I am facing problems with a proper workin of the PSS switches. After deleting the official Livisi integration I downloaded the unofficial one (using HACS). Rebooted the HA-server and installed the unofficial Livisi Integration. In the state of the integration it displays “Fehler beim Einrichten” (error during setup) and in the log I found several warnings and errors.
File "/config/custom_components/livisi/livisi_device.py", line 37, in tag_category return self.tags.get("typeCategory") ^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get'
When I list the devices I see a lot of RST with only temperature and humidity and the SHC Classic but nothing of PSS and VRCC with the target temperature. All the devices which were displayed with the former official Livisi integration are gone. I tried a reboot of the HA-sever with the same result.
The Livisi SHC is on the newest version 1.914 - 3.1.1088.0.
Reproduction steps
...
Debug logs
Diagnostics dump
{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2024.1.2", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.6", "docker": true, "arch": "x86_64", "timezone": "Europe/Berlin", "os_name": "Linux", "os_version": "6.1.70-haos", "supervisor": "2023.12.0", "host_os": "Home Assistant OS 11.3", "docker_version": "24.0.7", "chassis": "embedded", "run_as_root": true }, "custom_components": { "senec": { "version": "3.0.6", "requirements": [] }, "easee": { "version": "0.9.55", "requirements": [ "pyeasee==0.7.54" ] }, "hacs": { "version": "1.33.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "livisi": { "version": "1.7.2", "requirements": [ "aiohttp", "websockets" ] } }, "integration_manifest": { "domain": "hacs", "name": "HACS", "codeowners": [ "@ludeeus" ], "config_flow": true, "dependencies": [ "http", "websocket_api", "frontend", "persistent_notification", "lovelace", "repairs" ], "documentation": "https://hacs.xyz/docs/configuration/start", "iot_class": "cloud_polling", "issue_tracker": "https://github.com/hacs/integration/issues", "requirements": [ "aiogithubapi>=22.10.1" ], "version": "1.33.0", "is_built_in": false }, "data": { "entry": { "entry_id": "90d8abd0a0f2e0fcec81cd5518554b40", "version": 1, "minor_version": 1, "domain": "hacs", "title": "", "data": { "token": "REDACTED" }, "options": { "sidepanel_title": "HACS", "sidepanel_icon": "hacs:hacs", "release_limit": 5, "country": "ALL", "appdaemon": false, "netdaemon": false, "debug": false, "experimental": false }, "pref_disable_new_entities": false, "pref_disable_polling": false, "source": "user", "unique_id": null, "disabled_by": null }, "hacs": { "stage": "running", "version": "1.33.0", "disabled_reason": null, "new": false, "startup": false, "categories": [ "plugin", "integration", "theme" ], "renamed_repositories": { "custom-components/alexa_media_player": "alandtse/alexa_media_player" }, "archived_repositories": [ "Tiemooowh/homeassistant-teletask", "rccoleman/lamarzocco", "ljmerza/ha-our-groceries", "briis/hass-weatherflow", "ThomasPrior/FlexpoolInfo", "tikismoke/home-assistant-nespressoble" ], "ignored_repositories": [], "lovelace_mode": "storage", "configuration": { "appdaemon": false, "country": "ALL", "debug": false, "dev": false, "experimental": false, "netdaemon": false, "python_script": false, "release_limit": 5, "theme": false } }, "custom_repositories": [ "planbnet/livisi_unofficial" ], "repositories": [ { "data": { "archived": false, "authors": [ "@planbnet" ], "category": "integration", "config_flow": true, "default_branch": "main", "description": "Unofficial fork of the home assistant livisi integration without dependencies on the abandoned aiolivisi lib", "domain": "livisi", "downloads": 167, "etag_repository": "W/\"7b7f8e5bd04ccc6e1fe96e052db6326f7120b4c93365279825b2beab9e36aab3\"", "etag_releases": null, "file_name": "", "first_install": false, "full_name": "planbnet/livisi_unofficial", "hide": false, "has_issues": true, "id": "652791451", "installed_commit": "29ad596", "installed_version": "1.7.2", "installed": true, "last_commit": "29ad596", "last_updated": "2024-01-08T14:14:45Z", "last_version": "1.7.2", "manifest_name": "Livisi Unofficial", "new": false, "open_issues": 2, "published_tags": [ "1.7.2", "1.7.1", "1.7.0", "1.6.0", "1.5.2" ], "releases": true, "selected_tag": null, "show_beta": false, "stargazers_count": 20, "topics": [] }, "integration_manifest": { "domain": "livisi", "name": "Livisi Unofficial", "codeowners": [ "@planbnet" ], "config_flow": true, "documentation": "https://github.com/planbnet/livisi_unofficial", "iot_class": "local_polling", "issue_tracker": "https://github.com/planbnet/livisi_unofficial/issues", "requirements": [ "aiohttp", "websockets" ], "version": "1.7.1" }, "repository_manifest": { "content_in_root": false, "country": [], "filename": "livisi_unofficial.zip", "hacs": null, "hide_default_branch": true, "homeassistant": "2023.9.0", "manifest": { "name": "Livisi Unofficial", "filename": "livisi_unofficial.zip", "hide_default_branch": true, "homeassistant": "2023.9.0", "render_readme": true, "zip_release": true }, "name": "Livisi Unofficial", "persistent_directory": null, "render_readme": true, "zip_release": true }, "ref": "1.7.2", "paths": { "localpath": "/config/custom_components/livisi", "local": "/config/custom_components/livisi", "remote": "custom_components/livisi" } }, { "data": { "archived": false, "authors": [ "@ludeeus" ], "category": "integration", "config_flow": true, "default_branch": "main", "description": "HACS gives you a powerful UI to handle downloads of all your custom needs.", "domain": "hacs", "downloads": 399787, "etag_repository": "W/\"b3b9290fb6a44140b385aad80706a23095d182c5d57c942fa9c4628912bb726b\"", "etag_releases": null, "file_name": "", "first_install": false, "full_name": "hacs/integration", "hide": false, "has_issues": true, "id": "172733314", "installed_commit": null, "installed_version": "1.33.0", "installed": true, "last_commit": "94e66ed", "last_updated": "2024-01-08T06:12:36Z", "last_version": "1.33.0", "manifest_name": "HACS", "new": false, "open_issues": 16, "published_tags": [ "1.33.0", "1.32.1", "1.32.0", "1.31.0", "1.30.1" ], "releases": true, "selected_tag": null, "show_beta": false, "stargazers_count": 4260, "topics": [ "community", "package-manager" ] }, "integration_manifest": { "domain": "hacs", "name": "HACS", "codeowners": [ "@ludeeus" ], "config_flow": true, "dependencies": [ "http", "websocket_api", "frontend", "persistent_notification", "lovelace", "repairs" ], "documentation": "https://hacs.xyz/docs/configuration/start", "iot_class": "cloud_polling", "issue_tracker": "https://github.com/hacs/integration/issues", "requirements": [ "aiogithubapi>=22.10.1" ], "version": "0.0.0" }, "repository_manifest": { "content_in_root": false, "country": [], "filename": "hacs.zip", "hacs": "0.19.0", "hide_default_branch": true, "homeassistant": "2023.6.0", "manifest": { "name": "HACS", "zip_release": true, "hide_default_branch": true, "homeassistant": "2023.6.0", "hacs": "0.19.0", "filename": "hacs.zip" }, "name": "HACS", "persistent_directory": null, "render_readme": false, "zip_release": true }, "ref": "1.33.0", "paths": { "localpath": "/config/custom_components/hacs", "local": "/config/custom_components/hacs", "remote": "custom_components/hacs" } }, { "data": { "archived": false, "authors": [], "category": "plugin", "config_flow": false, "default_branch": "main", "description": "A power distribution card inspired by the official Energy Distribution card for Home Assistant", "domain": null, "downloads": 32381, "etag_repository": "W/\"61c28d53fd86e5a9d765a5bef2906c867e25cb4c6de81227fa01f0f73b9f1efc\"", "etag_releases": null, "file_name": "power-flow-card-plus.js", "first_install": false, "full_name": "flixlix/power-flow-card-plus", "hide": false, "has_issues": true, "id": "618081815", "installed_commit": "5eee9d8", "installed_version": "v0.1.8.1", "installed": true, "last_commit": "5eee9d8", "last_updated": "2024-01-05T12:41:00Z", "last_version": "v0.1.8.1", "manifest_name": null, "new": false, "open_issues": 42, "published_tags": [ "v0.1.8.1", "v0.1.8", "v0.1.7", "v0.1.6.3", "v0.1.6.2.1" ], "releases": true, "selected_tag": null, "show_beta": false, "stargazers_count": 292, "topics": [ "animation", "card", "cards", "custom", "energy", "flow", "plus", "power" ] }, "integration_manifest": {}, "repository_manifest": { "content_in_root": false, "country": [], "filename": null, "hacs": null, "hide_default_branch": false, "homeassistant": "2021.8.0", "manifest": { "name": "Power Flow Card Plus", "render_readme": true, "homeassistant": "2021.8.0" }, "name": "Power Flow Card Plus", "persistent_directory": null, "render_readme": true, "zip_release": false }, "ref": "v0.1.8.1", "paths": { "localpath": "/config/www/community/power-flow-card-plus", "local": "/config/www/community/power-flow-card-plus", "remote": "release" } }, { "data": { "archived": false, "authors": [], "category": "plugin", "config_flow": false, "default_branch": "master", "description": "A lovelace card for electrical vehicle (EV) home chargers and charging robots.", "domain": null, "downloads": 2678, "etag_repository": "W/\"fa1a1114d498257623b906f5d9da9f16383687abefb409fd6bd9c792a89c5122\"", "etag_releases": null, "file_name": "charger-card.js", "first_install": false, "full_name": "tmjo/charger-card", "hide": false, "has_issues": true, "id": "308752409", "installed_commit": "ae2d644", "installed_version": "v0.2.7", "installed": true, "last_commit": "ae2d644", "last_updated": "2024-01-02T17:05:53Z", "last_version": "v0.2.7", "manifest_name": null, "new": false, "open_issues": 14, "published_tags": [ "v0.2.7", "v0.2.6", "v0.2.5", "v0.2.4", "v0.2.3" ], "releases": true, "selected_tag": null, "show_beta": false, "stargazers_count": 74, "topics": [ "charger", "charging-robot", "easee", "elbil", "electric-vehicle", "evcharger" ] }, "integration_manifest": {}, "repository_manifest": { "content_in_root": false, "country": [], "filename": "charger-card.js", "hacs": null, "hide_default_branch": false, "homeassistant": null, "manifest": { "name": "Charger Card", "render_readme": true, "filename": "charger-card.js" }, "name": "Charger Card", "persistent_directory": null, "render_readme": true, "zip_release": false }, "ref": "v0.2.7", "paths": { "localpath": "/config/www/community/charger-card", "local": "/config/www/community/charger-card", "remote": "release" } }, { "data": { "archived": false, "authors": [ "@tmjo", "@olalid", "@astrandb" ], "category": "integration", "config_flow": true, "default_branch": "master", "description": "Custom component for Easee EV charger integration with Home Assistant", "domain": "easee", "downloads": 3365, "etag_repository": "W/\"0f7c5eac4d67bb6fd4d7a0c8eac9acef0d8a7b65e84c128d051159a6f1677045\"", "etag_releases": null, "file_name": "", "first_install": false, "full_name": "nordicopen/easee_hass", "hide": false, "has_issues": true, "id": "276915021", "installed_commit": "25bb2cb", "installed_version": "v0.9.55", "installed": true, "last_commit": "e533a3a", "last_updated": "2024-01-02T17:43:57Z", "last_version": "v0.9.56", "manifest_name": "Easee EV charger", "new": false, "open_issues": 38, "published_tags": [ "v0.9.56", "v0.9.55", "v0.9.54", "v0.9.53", "v0.9.52" ], "releases": true, "selected_tag": null, "show_beta": false, "stargazers_count": 178, "topics": [ "easee", "ev-charging" ] }, "integration_manifest": { "domain": "easee", "name": "Easee EV charger", "codeowners": [ "@tmjo", "@olalid", "@astrandb" ], "config_flow": true, "documentation": "https://github.com/nordicopen/easee_hass", "integration_type": "hub", "iot_class": "cloud_push", "issue_tracker": "https://github.com/nordicopen/easee_hass/issues", "loggers": [ "pyeasee" ], "requirements": [ "pyeasee==0.7.55" ], "version": "0.9.55" }, "repository_manifest": { "content_in_root": false, "country": [], "filename": "easee.zip", "hacs": null, "hide_default_branch": false, "homeassistant": "2023.11.0", "manifest": { "name": "Easee EV Charger", "filename": "easee.zip", "homeassistant": "2023.11.0", "zip_release": true }, "name": "Easee EV Charger", "persistent_directory": null, "render_readme": false, "zip_release": true }, "ref": "v0.9.56", "paths": { "localpath": "/config/custom_components/easee", "local": "/config/custom_components/easee", "remote": "custom_components/easee" } } ], "rate_limit": { "resources": { "core": { "limit": 5000, "used": 151, "remaining": 4849, "reset": 1704803421 }, "search": { "limit": 30, "used": 0, "remaining": 30, "reset": 1704802935 }, "graphql": { "limit": 5000, "used": 0, "remaining": 5000, "reset": 1704806475 }, "integration_manifest": { "limit": 5000, "used": 0, "remaining": 5000, "reset": 1704806475 }, "source_import": { "limit": 100, "used": 0, "remaining": 100, "reset": 1704802935 }, "code_scanning_upload": { "limit": 1000, "used": 0, "remaining": 1000, "reset": 1704806475 }, "actions_runner_registration": { "limit": 10000, "used": 0, "remaining": 10000, "reset": 1704806475 }, "scim": { "limit": 15000, "used": 0, "remaining": 15000, "reset": 1704806475 } }, "rate": { "limit": 5000, "used": 151, "remaining": 4849, "reset": 1704803421 } } } }