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

P1Mon cannot be added #130074

Closed
BobPuts opened this issue Nov 7, 2024 · 14 comments · Fixed by #130084
Closed

P1Mon cannot be added #130074

BobPuts opened this issue Nov 7, 2024 · 14 comments · Fixed by #130084

Comments

@BobPuts
Copy link

BobPuts commented Nov 7, 2024

The problem

I had deleted the P1mon integration when it stopped working. With the new release I still cannot readd the intergration. I us eport 8081

What version of Home Assistant Core has the issue?

2024.11.0

What was the last working version of Home Assistant Core?

2024.9.3

What type of installation are you running?

Home Assistant Container

Integration causing the issue

P1mon

Link to integration documentation on our website

https://www.home-assistant.io/integrations/p1_monitor/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

File "/usr/src/homeassistant/homeassistant/components/p1_monitor/config_flow.py", line 43, in async_step_user

await client.smartmeter()
File "/usr/local/lib/python3.12/site-packages/p1monitor/p1monitor.py", line 116, in smartmeter

data = await self._request(

       ^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/p1monitor/p1monitor.py", line 59, in _request

url = URL.build(

      ^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 352, in build

raise TypeError("The port is required to be int.")
TypeError: The port is required to be int.

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Nov 7, 2024

Hey there @klaasnicolaas, mind taking a look at this issue as it has been labeled with an integration (p1_monitor) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of p1_monitor can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign p1_monitor Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


p1_monitor documentation
p1_monitor source
(message by IssueLinks)

@klaasnicolaas
Copy link
Member

klaasnicolaas commented Nov 7, 2024

What if you add the integration again? I've been going through the code but can't find anywhere where the port is suddenly a string value, it's rather forced to be an int value multiple times.

./Klaas

@BobPuts
Copy link
Author

BobPuts commented Nov 7, 2024

Hi Klaas,

I have added the integration again. That is the problem it won't work unfortunately. Can it be that if there are more than 2 digits in port number be a problem?

gr,
Bob

@robertobadjo
Copy link

robertobadjo commented Nov 7, 2024

I also get an error with the p1monitor integration from ztatz.

here is my log

Logger: homeassistant.components.p1_monitor
Bron: helpers/update_coordinator.py:382
integratie: P1 Monitor (documentatie, problemen)
Eerst voorgekomen: 20:45:48 (2 gebeurtenissen)
Laatst gelogd: 20:45:59

Unexpected error fetching p1_monitor data
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 382, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/p1_monitor/coordinator.py", line 70, in _async_update_data
SERVICE_SMARTMETER: await self.p1monitor.smartmeter(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/p1monitor/p1monitor.py", line 116, in smartmeter
data = await self._request(
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/p1monitor/p1monitor.py", line 59, in _request
url = URL.build(
^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 388, in build
_host = _encode_host(host, validate_host=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 1482, in _encode_host
raise ValueError(
ValueError: Host 'blurredhostnamel' cannot contain 'P' (at position 0)

when i remove the intergration i also cannot add it again

when i revert to version 2024.10.4 everything works as normal

@klaasnicolaas
Copy link
Member

@robertobadjo This is a different issue and I can't make much out of the error message either.

./Klaas

@robertobadjo
Copy link

@robertobadjo This is a different issue and I can't make much out of the error message either.

./Klaas

Its the same intergration. i think something breaks the intergration. I also get same error code when i want to readd it.

@epenet
Copy link
Contributor

epenet commented Nov 7, 2024

I'm not familiar with p1_monitor, but can someone check what is stored on the config entry data?
It should be available in the diagnostic information.

Is it stored as a string? is it stored as a float?

@klaasnicolaas
Copy link
Member

Its the same intergration.

Yes but the error message is different.... Hence the request to create a separate issue for this.

./Klaas

@klaasnicolaas
Copy link
Member

@epenet the port value is redacted 😅 My guess is that it is stored as a string.

./Klaas

@epenet
Copy link
Contributor

epenet commented Nov 7, 2024

What a strange idea to redact the port...
If you have access to the storage files (.storage/core.config_entries), you should be able to look it up manually.

@elmexdechileen
Copy link

ore.config_entries

I use a 2 digit port number and I have the same issue. Otherwise my case is exactly the same: HA Docker container and I removed the integration when it stopped working (for some reason I feel like this is important).

@epenet
Copy link
Contributor

epenet commented Nov 8, 2024

As mentionned, someone needs to take a look at their .storage/core.config_entries and confirm how exactly the port is stored in the registry.
I suspect a that it is NOT stored as an integer... maybe as string? or as float?

@elmexdechileen
Copy link

As mentionned, someone needs to take a look at their .storage/core.config_entries and confirm how exactly the port is stored in the registry. I suspect a that it is NOT stored as an integer... maybe as string? or as float?

I am trying to find the entry but when I look in core.config_entries I don't see anything regarding P1Mon. Could it be that it isn't store there at all because of the error?

@epenet epenet added this to the 2024.11.1 milestone Nov 8, 2024
@epenet
Copy link
Contributor

epenet commented Nov 8, 2024

Sorry - you are right. The PR from @klaasnicolaas threw me off...
I was under the impression that it could be added, but wouldn't start. Now I see that it cannot even be added...

I've just tested this in debug: TypeError: The port is required to be int, got <class 'float'>.

@frenck frenck removed this from the 2024.11.1 milestone Nov 8, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants