Closed dennidoubles closed 9 months ago
Hi @dennidoubles ,
This is really odd, I didn't add any support for discovery. Which version of HA are you using? Maybe there is an issue on the backlog of HA which is related. For now, I do not know how to fix this.
Running 2024.1 Will check the log if I can find anything. Strange, right?
Well, I reconfigured and it is working again. Still strange it got discovered again and needed a re-config, I've heard it also from others. Thanks anyway!
This is really odd, since I do not do anything other than following the guides from HA I do not think it's the integration, but HA that does this strange behaviour. I will close this issue for now, but if it happens again then I will re-open it.
Well, another discovered notification came in today Arjen:
Normally I could just ignore it, but the result is that my card isn't working anymore:
I work with version 1.2.0 and the following:
Well, another discovered notification came in today Arjen:
Normally I could just ignore it, but the result is that my card isn't working anymore:
I work with version 1.2.0 and the following:
Same for me
Maybe this is helpful.
Error fetching PostNL data: Cannot connect to host login.postnl.nl:443 ssl:default [Try again]
Error fetching PostNL data: Expecting value: line 1 column 1 (char 0)
Error fetching PostNL data: 500, message='Internal Server Error', url=URL('https://login.postnl.nl/xxxxxx/login/token')
This certainly helps; I will try to see if I can reproduce it.
I tested a couple of things. I am not a experienced Python developer, for me this is a hobby. I may have some strange things in my code that are against the principles of Python. So, if people see some strange code in my upcoming changes, please create a PR 😄 .
It's a combination of things that's happening:
500 Internal Server Error
. This indicates that their API is broken. That's something I would like to solve, but can't 😅 .UpdateFailed
exception. Due to this exception, the entity is unavailable.cannot convert undefined or null to object
in the lovelace. This error is raised in Javascript/Typescript.Discovery
part. The integration doesn't support this at all and I do not know where to start.I made some changes and I am kindly asking you if you can test it.
jouw.postnl.nl
anymore. This will reduce the number of calls with a lot. For me this went down from 40 to 1. And, 0 if I do not an incoming package.The changes can be inspected in the linked PR. I will merge PR into the main branch. Please checkout this branch via HACS.
It's not really a discovery. I have the same thing, but it happens if a restore a backup. It says two things, " Discovered "and " Reconfigure " So I have this with your PostNL integration but also with my FritzBox smarthome integration, Then it loses a repeater, says, Discovered, and the same reconfigure, I only must put in the password of that repeater, and all is fine again. Maybe it helps you to find what is happening.
One week later, I experienced it again today.
If I can help you with more info, just let me know. I don't see anything in my logs, which is even more strange ...
One week later, I experienced it again today.
If I can help you with more info, just let me know. I don't see anything in my logs, which is even more strange ...
Could you please check if you have multiple credentials (/config/application_credentials
) for the PostNL integrations?
I'm pretty sure that it's not really discovering the integration, but that it's failing to connect to the API causing someone to have to reconfigure the integration before it works again. I think that it's caused by the authentication token being expired causing the integration to fail to connect to the post nl servers.
For me it seems that I have to reconfigure weekly, which would somewhat match with an expiration date for these kind of tokens. @arjenbos I'm not sure about the post nl api, but normally if the API returns a refresh token, that token should be used to create a new authentication token.
Regarding your question for the application_credentials. This is what's stored for me:
{
"id": "postnl",
"domain": "postnl",
"client_id": "-",
"client_secret": "-",
"name": "HomeAssistant PostNL"
}
I'm pretty sure that it's not really discovering the integration, but that it's failing to connect to the API causing someone to have to reconfigure the integration before it works again. I think that it's caused by the authentication token being expired causing the integration to fail to connect to the post nl servers.
For me it seems that I have to reconfigure weekly, which would somewhat match with an expiration date for these kind of tokens. @arjenbos I'm not sure about the post nl api, but normally if the API returns a refresh token, that token should be used to create a new authentication token.
Regarding your question for the application_credentials. This is what's stored for me:
{ "id": "postnl", "domain": "postnl", "client_id": "-", "client_secret": "-", "name": "HomeAssistant PostNL" }
Yup, it's not a discovery, but it gives an error and then HomeAssistants decides it should be reconfigured.
I'm pretty sure that it's not really discovering the integration, but that it's failing to connect to the API causing someone to have to reconfigure the integration before it works again. I think that it's caused by the authentication token being expired causing the integration to fail to connect to the post nl servers.
For me it seems that I have to reconfigure weekly, which would somewhat match with an expiration date for these kind of tokens. @arjenbos I'm not sure about the post nl api, but normally if the API returns a refresh token, that token should be used to create a new authentication token.
Regarding your question for the application_credentials. This is what's stored for me:
{ "id": "postnl", "domain": "postnl", "client_id": "-", "client_secret": "-", "name": "HomeAssistant PostNL" }
That's indeed default oAuth2 behaviour which is developed and controlled by Home Assistant core. I will have another look and see if something goes wrong in combination with the access_token and refresh_token.
I think I found it. This behaviour is initiated due to a ConfigEntryAuthFailed
exception. I cannot reproduce why you guys hit this exception.
The exception was thrown when the API returned an HTTP response status code between 400 and 500. I changed the code in the main
branch to throw a HomeAssistantError exception instead and I added some debug logging. Hopefully we can figure out why the PostNL API returns an error code between the 400 and 500.
@stijnb1234 @FeikoJoosten could you please pull the latest version of the main branch and enable debug logging?
I think I found it. This behaviour is initiated due to a
ConfigEntryAuthFailed
exception. I cannot reproduce why you guys hit this exception.The exception was thrown when the API returned an HTTP response status code between 400 and 500. I changed the code in the
main
branch to throw a HomeAssistantError exception instead and I added some debug logging. Hopefully we can figure out why the PostNL API returns an error code between the 400 and 500.@stijnb1234 @FeikoJoosten could you please pull the latest version of the main branch and enable debug logging?
Installed the main branch version again, will let you know when I have anything.
Same here!
Don't understand what to do next, so I guess I'll wait for your feedback
No feedback received, so I assume it's fixed?
So far no issues on my end. Seems to work like a charm
Is the new version a fix for this issue? That would great work!
No feedback received, so I assume it's fixed?
Same for me, no issues.
Nice, the latest release includes the fixes.
I received a discovered device in HA:
Are you aware of this and why is this, Inhad it already installed and working?