Git Product home page Git Product logo

Comments (24)

gndean avatar gndean commented on September 23, 2024 3

Thanks for all the info @RedNo7, it is helpful. It looks like the session is expiring and for some reason, the integration is unable to re-login when needed.
There may be a better way for the long term though and that's to natively support the OAuth2 authorization method that Hypervolt support. This should allow the session to be refreshed before it expires. I'm currently talking to HV (@benjumanji) about this and we might also need help from Nabu Casa to support it too. So don't know when that will be but I'll try and keep this issue updated with any progress.

from home-assistant-hypervolt-charger.

gndean avatar gndean commented on September 23, 2024 1

Are the times in these logs UTC?

No, Home Assistant uses local time for the log timestamps.

from home-assistant-hypervolt-charger.

RedNo7 avatar RedNo7 commented on September 23, 2024 1

Cheers. Let me know if you need some testing done.

from home-assistant-hypervolt-charger.

gndean avatar gndean commented on September 23, 2024 1

Just a placeholder to say this is still in progress.

from home-assistant-hypervolt-charger.

gndean avatar gndean commented on September 23, 2024 1

Sorry, no. I'm awaiting help from Hypervolt and had expected that by now.

For now, I suggest something like @RedNo7 has done - some periodic or triggered reload of the integration.

If no progress is made on the OAuth2 solution by another month or so, I'll see if I can code some workaround into the integration to do a similar kind of refresh.

from home-assistant-hypervolt-charger.

benjumanji avatar benjumanji commented on September 23, 2024 1

We had an opportunity to migrate some code recently which enabled us have some better insights into why auth was failing more frequently than it should (10%) for HA. That's been fixed ~ 10 days. The only auth failures we see now are from our upstream provider which I can't do much about but, the frequency is now not worth worrying about (less than 1 in 10000 calls).

from home-assistant-hypervolt-charger.

gndean avatar gndean commented on September 23, 2024 1

The auth is now done differently in V2.0.2 of the extension using Hypervolt's new authentication infrastructure. I hope this should resolve these issues.
I'm going to close this but please do comment if you see the same issue again and I can reopen.

from home-assistant-hypervolt-charger.

gndean avatar gndean commented on September 23, 2024

In short, no, sorry. I'm not seeing this myself since 2023.8.3 and now on 2023.8.4.

The status code of 400 is coming directly from the Hypervolt server API so I'm not sure why you wouldn't see similar issues with the app.

Is this still happening?

from home-assistant-hypervolt-charger.

RedNo7 avatar RedNo7 commented on September 23, 2024

Hi,

yes. It’s unavailable in HA right now but fully functional in the Hypervolt app

logs, just in case - status 500 this time as well:

2023-09-05 17:14:08.865 ERROR (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] Error: unable to get charger, status: 500, {"errors":"Unexpected internal error occured"}
2023-09-05 17:14:08.880 ERROR (MainThread) [custom_components.hypervolt_charger.hypervolt_update_coordinator] Error fetching hypervolt_charger data:
2023-09-05 17:24:12.654 ERROR (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] Error: unable to get charger, status: 500, {"errors":"Unexpected internal error occured"}
2023-09-05 17:24:12.660 ERROR (MainThread) [custom_components.hypervolt_charger.hypervolt_update_coordinator] Error fetching hypervolt_charger data:
2023-09-05 17:29:14.857 ERROR (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] Authentication error when trying to log in, status code: 400

As before, a restart fixed it.

from home-assistant-hypervolt-charger.

lankthedank avatar lankthedank commented on September 23, 2024

I'm having similar issues, but noticing that this only occurs with my Home 3.0 charger. There are no connectivity issues with my Home 2.0 charger. Restarting the integration fixes it temporarily.

from home-assistant-hypervolt-charger.

RedNo7 avatar RedNo7 commented on September 23, 2024

I believe mine is a v2.0
What I don't get is that my phone app is always connected when it's unavailable in HA.

from home-assistant-hypervolt-charger.

benjumanji avatar benjumanji commented on September 23, 2024

Are the times in these logs UTC?

from home-assistant-hypervolt-charger.

benjumanji avatar benjumanji commented on September 23, 2024

@RedNo7 can I assume you are in the uk? I'm having a hard time correlating this with anything in auth0 (hypervolts authentication is hosted with them). I had a quick look at the client code and it looks like we are just trying to hit the login form hosted by auth0, and the request that is failing is coming from hitting that. So I would expect to see failed logins at that time. I don't. 🤔

from home-assistant-hypervolt-charger.

RedNo7 avatar RedNo7 commented on September 23, 2024

Yes, UK.

from home-assistant-hypervolt-charger.

benjumanji avatar benjumanji commented on September 23, 2024

I guess it's worth saying that the 500s on the 5th were probably due to a deployment that was happening at that moment.

from home-assistant-hypervolt-charger.

RedNo7 avatar RedNo7 commented on September 23, 2024

got the following this morning - no clue if it is relevant/related:

This error originated from a custom integration.

Logger: custom_components.hypervolt_charger.hypervolt_api_client
Source: custom_components/hypervolt_charger/hypervolt_api_client.py:421 
Integration: Hypervolt Charger (documentation, issues) 
First occurred: 08:37:12 (1 occurrences) 
Last logged: 08:37:12

notify_on_websocket session/in-progress, Task-255663, ConnectionClosedError, code: 1006, reason:

The Hypervolt is currently online though.

from home-assistant-hypervolt-charger.

RedNo7 avatar RedNo7 commented on September 23, 2024

again, not sure if this is related (or helps) - status 502:

2023-09-20 16:23:36.662 WARNING (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] notify_on_websocket sync, Task-39979, ConnectionClosedError, code: 1006, reason:
2023-09-21 02:27:01.836 ERROR (MainThread) [custom_components.hypervolt_charger.hypervolt_update_coordinator] Timeout fetching hypervolt_charger data
2023-09-21 02:37:06.485 ERROR (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] Update_state_from_schedule, error from API, status: 502
2023-09-21 03:50:22.282 WARNING (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] notify_on_websocket sync, Task-56289, iterator exited. Socket closed, code: 1000, reason: Bye
2023-09-21 03:56:35.346 WARNING (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] notify_on_websocket session/in-progress, Task-56435, iterator exited. Socket closed, code: 1000, reason: Bye
2023-09-21 04:03:12.126 WARNING (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] notify_on_websocket sync, Task-56562, iterator exited. Socket closed, code: 1000, reason: Bye
2023-09-21 04:04:01.633 WARNING (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] notify_on_websocket sync, Task-56562, iterator exited. Socket closed, code: 1000, reason: Bye
2023-09-21 04:21:28.403 WARNING (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] notify_on_websocket sync, Task-56869, iterator exited. Socket closed, code: 1000, reason: Bye
2023-09-21 04:21:50.570 WARNING (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] notify_on_websocket session/in-progress, Task-56870, iterator exited. Socket closed, code: 1000, reason: Bye

from home-assistant-hypervolt-charger.

RedNo7 avatar RedNo7 commented on September 23, 2024

workaround thought: Given that the problem is always resolved after a restart, is there a service to 'reload' the integration (thus avoiding a full restart) that I could have as an action in an automation that triggers when it becomes unavailable?


Edit:
I think I got it. The service is homeassistant.reload_config_entry
I will try this and report back.


Edit:
Yep, an immediate reload brought all the entities back. For anyone else interested, this is the script I used (that I will now turn into an automation triggered by it becoming unavailable)":

script: 
  hypervolt_reload_integration:
    alias: "Hypervolt: Reload integration"
    sequence:
      - service: homeassistant.reload_config_entry
        target:
          device_id: e1295bf52be1cdce4481e6c1e5b497ca
    icon: mdi:reload
    mode: single

You get device_id from the url after navigating to : Integrations ➜ Hypervolt ➜ Device
The url will look something like:
http://homeassistant:8123/config/devices/device/e1295bf52be1cdce4481e6c1e5b497ca

from home-assistant-hypervolt-charger.

RedNo7 avatar RedNo7 commented on September 23, 2024

...some more errors which may or may not be related (code: 1000):

2023-09-28 14:07:47.905 WARNING (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] notify_on_websocket sync, Task-17531, iterator exited. Socket closed, code: 1000, reason: Bye
2023-09-28 14:07:47.919 WARNING (MainThread) [custom_components.hypervolt_charger.hypervolt_api_client] notify_on_websocket session/in-progress, Task-17532, iterator exited. Socket closed, code: 1000, reason: Bye

from home-assistant-hypervolt-charger.

liquidv avatar liquidv commented on September 23, 2024

I seem to be having the same issue, are there any updates on this?
Any automations I have with Hypervolt just breaks

from home-assistant-hypervolt-charger.

RedNo7 avatar RedNo7 commented on September 23, 2024

It’s a shame that Hypervolt won’t give local control.

from home-assistant-hypervolt-charger.

liquidv avatar liquidv commented on September 23, 2024

I have a reload automation to reboot HA every 6am morning, but strange thing happened was that I lost HA Hypervolt control and it was only 12 hours since the reload, had to reload again.

from home-assistant-hypervolt-charger.

liquidv avatar liquidv commented on September 23, 2024

It seems to be more stable recently, has something changed?

from home-assistant-hypervolt-charger.

gndean avatar gndean commented on September 23, 2024

Thanks Ben!

I'm still keen to explore the OAuth2 option too, especially if that opens up signing in via Google and Apple. Are you able to open this up to the HA integration please?

from home-assistant-hypervolt-charger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.