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

No data #14

Closed
incarvr6 opened this issue Aug 31, 2021 · 13 comments · Fixed by #46
Closed

No data #14

incarvr6 opened this issue Aug 31, 2021 · 13 comments · Fixed by #46
Labels
bug Something isn't working

Comments

@incarvr6
Copy link

As of 29/08/21 12:00 Home assistant is not getting any data, status unavailable.
Removing and readding integration dose not help.

@incarvr6 incarvr6 added the bug Something isn't working label Aug 31, 2021
@danmed
Copy link

danmed commented Aug 31, 2021

I'm also seeing this.. I've removed and re-added and i'm getting the below in the logs :

2021-08-31 10:55:07 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up hildebrandglow_dcc platform for sensor Traceback (most recent call last): File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 33, in async_setup_entry resources = await hass.async_add_executor_job(glow.retrieve_resources) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/hildebrandglow_dcc/glow.py", line 78, in retrieve_resources raise InvalidAuth custom_components.hildebrandglow_dcc.glow.InvalidAuth During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/hildebrandglow_dcc/sensor.py", line 36, in async_setup_entry await Glow.handle_failed_auth(config, hass) TypeError: handle_failed_auth() missing 1 required positional argument: 'hass'

@danmed
Copy link

danmed commented Aug 31, 2021

Interestingly, mine has just started working again...

I removed the integration and re-added it and after abotu 5 minutes it seems to be working again.

@incarvr6
Copy link
Author

Mine has just started working again as well, but it did take about an hour after re adding integration.

@HandyHat
Copy link
Owner

@ColinRobbins
Copy link
Contributor

I'm seeing this issue too. It seems after a while the authentication times out.
Removing and re-installing the integration seems to fix it.

@googanhiem
Copy link

googanhiem commented Sep 23, 2021

I've been looking at the code and @ColinRobbins is right, its an issue with handle_failed_auth, it looks like its having an issue getting or updating the config_entries information.

This error will happen to everyone using this weekly, as the token has a 7 day expiry on it.

Waiting a bit, deleting the integration and re-adding it is the current workaround (showing the current auth system isn't at fault, its just the reauth calls that aren't working).

@ColinRobbins
Copy link
Contributor

ColinRobbins commented Sep 24, 2021

@googanhiem, @HandyHat I think I have implemented a fix.
In custom_components/hildebrandglow_dcc/glow.py I changed

     async def handle_failed_auth(self, config: ConfigEntry, hass: HomeAssistant) -> None: 

to

      @classmethod
      async def handle_failed_auth(cls, config: ConfigEntry, hass: HomeAssistant) -> None:

and restarted home assistant.
Seems to be working.

Need to wait a week, for it to time out again, and see if it automatically reconnects.
If all goes well, I’ll make a pull request on the github repro in a week or two.
(ColinRobbins@1c22d55#diff-44afaf6cb9c1f06d1df29362986d19bdf271a91551603ddf8ee3fda4781f1f9b)

@googanhiem
Copy link

Looks good. You could test it by changing the token expiry in the configentries file (it's in .storage).
I'll try it tonight.

ColinRobbins added a commit to ColinRobbins/ha-hildebrandglow-dcc that referenced this issue Sep 25, 2021
@googanhiem
Copy link

Unfortunately mine didn't refresh the token correctly after a week. Same error.

@ColinRobbins
Copy link
Contributor

Same here, but a slightly different error (getting a 404 error, not a 401).
With a simple restart of hass it re authenticated OK.
I’ve made another modification to handle the 404 error.
See you here same time next week to see if that works!

@ColinRobbins
Copy link
Contributor

Looking at the code, I think there is an issue with updating the "glow" instance in the running sensor.
I've tried a fix...
main...ColinRobbins:main
Will see what happens next time fails.
Some the logging will need removing in time.

@ColinRobbins
Copy link
Contributor

I now have the reconnection working both on restart and “in flight”.
The pull request above (#39)

@chesterflaps
Copy link

I have had this integration for a few weeks and not once has it given the correct data. Always saying I have used around 0.50kwh per day. I wish!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants