Closed exceldatei closed 8 months ago
This is an issue in a custom component thus I am going to close this.
Apparently the port passed into this transformation function is "local" which isn't a port, thus it raises an error.
Ok, thanks for the reply. The developer answered this to me:
"Report this to Home Assistant github issues. This is not this integration issue, HA helper function is failing to retrieve URL for your HA instance."
The problem lies in ValueError: Port could not be cast to integer value as ‘local’
.
@joostlek I am the custom integration developer. It is passing the hass
object (provided by HA) into the HA helper function (see screenshots) or here. How is this a custom integration issue? Integration is not touching internal HA link set by the user in any way.
HA needs to handle this case internally because it looks like it can be misconfigured in a way this exception is not caught, disregarding the origin of the error.
Maybe I closed this too fast, but let's try to figure out what might cause this.
We need to figure out what hass.config.internal_url
says. Are you able to maybe add a log Line to the custom component to check what's in it?
To me this sounds like a configuration issue but I'm willing to help figure out.
@joostlek thank you!
@exceldatei please download this branch manually: https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/tree/debug_isUsingHTTPS, mainly the custom_components/tapo_control/utils.py - you can copy the content of the file from the link, replace it in your HA and restart. I added the logs required there.
You should then see something like this in your logs, probably "None" logs will be something else on your machine.
Oh thanks for creating the branch :)
@JurajNyiri Thank you! I tried it out and copied it into utils.py but after restart its the same. I see the logs as you said but the integration is still not working.
2023-08-20 21:11:49.789 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Fire Tablet' for fully_kiosk integration not ready yet: Cannot connect to host 192.168.1.103:2323 ssl:False [Connect call failed ('192.168.1.103', 2323)]; Retrying in background 2023-08-20 21:11:50.118 CRITICAL (MainThread) [custom_components.tapo_control] isUsingHTTPS 2023-08-20 21:11:50.122 CRITICAL (MainThread) [custom_components.tapo_control] http://192.168.1.120:local 2023-08-20 21:11:50.124 CRITICAL (MainThread) [custom_components.tapo_control] None 2023-08-20 21:11:50.125 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.1.150 for tapo_control
@exceldatei do you see http://192.168.1.120:local under Settings - System - Network - Home Assistant URL? What do you see there? Could you tell us more about your ENV setup, how are you running HA, have you added this URL there manually etc?
I am really wondering how he ended up in this situation
HA is set up on a RP4. Yes, I see http://192.168.1.120:local
Indeed I wrote it manually once. Just tried to set it to automatically and it works now. I am not that familiar with the deeper coding stuff as I just started into home assistant. But it seems that it was just because the manual setting of the local IP
Right, I will check in a moment if we actually validate this address before storing it to avoid stuff like this in the future
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
The problem
Cant integrate Tado Camera Controller. Always throws back an integration error.
2023-08-20 12:36:09.457 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.1.150 for tapo_control Traceback (most recent call last): File “/usr/local/lib/python3.11/site-packages/yarl/_url.py”, line 191, in new port = val.port ^^^^^^^^ File “/usr/local/lib/python3.11/urllib/parse.py”, line 182, in port raise ValueError(f"Port could not be cast to integer value as {port!r}") ValueError: Port could not be cast to integer value as ‘local’
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 388, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/config/custom_components/tapo_control/init.py”, line 186, in async_setup_entry if isUsingHTTPS(hass): ^^^^^^^^^^^^^^^^^^ File “/config/custom_components/tapo_control/utils.py”, line 46, in isUsingHTTPS base_url = get_url(hass, prefer_external=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/helpers/network.py”, line 145, in get_url return _get_internal_url( ^^^^^^^^^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/helpers/network.py”, line 221, in _get_internal_url internal_url = yarl.URL(hass.config.internal_url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/usr/local/lib/python3.11/site-packages/yarl/_url.py”, line 193, in new raise ValueError(
What version of Home Assistant Core has the issue?
2023.8.3
What was the last working version of Home Assistant Core?
2023.8.3
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Tapo: Cameras Control
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response