unknown state
Hello,
Thank you for this component, its useful!
I often have connectivity issues, where the state changes to unknown, I was wondering if its possible to fine tune the duration prior to changing state to unknown (as it spams my logs / state)
I often see in the logs
2021-05-23 11:00:35 ERROR (MainThread) [custom_components.wallbox.lock] Error requesting wallbox data: HTTPSConnectionPool(host='api.wall-box.com', port=443): Max retries exceeded with url: /chargers/status/XXXXX (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x9ec6bce8>: Failed to establish a new connection: [Errno -3] Try again'))
while looking at it, I was also seeing a very high rate of DNS requests (but I assume that's a failure on wallbox dns records).

Hi, the component works as follows:
HomeAssistant Component -> Python Wallbox Integration -> Wallbox API -> Your Wallbox at Home
If I look at your issue, it seems that the Wallbox API cannot communicate with you Wallbox at Home. That is something out of my control. I could of course reduce the amount of polling (no of requests to the API) but that will be bad for other users, and I'm not sure if it would fix your problem. Have you considered using a template sensor for this issue?
I wonder, the mobile application uses websockets for notifications, can we reuse the same mechanism vs continuously poll? also, if we poll and get unknown state, can we expose a configuration to set the timeout that we update ha with that state? (e.g. from looking at the image above, its nearly almost resolved under a minute.
I'll try opening a service call with wallbox to try and understand why the api return the unknown state, do you happen to know which end point is being queried so I could try to reproduce it?
thanks!
We cannot easily change the method, I use the following library to get the data: https://pypi.org/project/wallbox/, which determines the method downstream. If you log in on the wallbox webportal, do you also see the unknown status?
If you're handy you can prototype a bit (with the above library) and see what happens. The status of the charger comes from the following URL: "https://api.wall-box.com/chargers/status/(station_serial_here)" (if you look at the code of the above library you can find additional endpoints if necessary).