Giter Site home page Giter Site logo

Comments (7)

magico13 avatar magico13 commented on June 2, 2024 1

It might be as simple as me catching the exception since the library should always try to reauthenticate if the token isn't valid anymore. I think the exception is making home assistant not try to it update again. I also can probably add detection of intentional downtime to the library since I know how they tell the app about that. I think this is pretty fixable so I'll try to take care of it next time I make updates to this (which will probably be soonish since I added support for their smart outlets to the library and want to add them to home assistant as well)

from ha-emporia-vue.

skynet01 avatar skynet01 commented on June 2, 2024

I think what might be happening is the API goes down for a bit and then when plugin tries to reconnect it's no longer authorized to do so. Restarting Home Assistant fixes the issue. It always consistently happens at night and the first error i get is this

Logger: homeassistant.helpers.entity
Source: custom_components/emporia_vue/sensor.py:73
First occurred: October 3, 2020, 5:12:55 PM (3 occurrences)
Last logged: 2:17:57 AM

Update for sensor.power_hallway_ac_1 fails
Update for sensor.power_pelican_123 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/emporia_vue/sensor.py", line 73, in update
    channels = self._vue.get_recent_usage(scale=Scale.MINUTE.value)
  File "/usr/local/lib/python3.8/site-packages/pyemvue/pyemvue.py", line 98, in get_recent_usage
    response.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 504 Server Error: Gateway Time-out for url: https://api.emporiaenergy.com/usage/devices?start=2020-10-04T00:12:25.524821Z&end=2020-10-04T00:12:26.524821Z&scale=1MIN&unit=WATTS&customerGid=10640

When I try the above URL manually I no longer get time-out error but an Unauthorized error. Is there a way to maybe reauthenticate the connection after time out is detected?

from ha-emporia-vue.

skynet01 avatar skynet01 commented on June 2, 2024

Awesome! Yeah cause right now the sensors just get stuck on the last value so it throws off all the utility calculation data. Thank you so much for checking it out.

from ha-emporia-vue.

skynet01 avatar skynet01 commented on June 2, 2024

Here is more from my logs, today it was a 500 server error instead of 504.

Logger: homeassistant.helpers.entity
Source: custom_components/emporia_vue/sensor.py:73
First occurred: October 6, 2020, 11:00:15 AM (10 occurrences)
Last logged: October 7, 2020, 6:01:01 PM

Update for sensor.power_pelican_123 fails
Update for sensor.power_dryer_4 fails
Update for sensor.power_lounge_patio_2 fails
Update for sensor.power_hallway_ac_1 fails
Update for sensor.power_fridge_5 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/emporia_vue/sensor.py", line 73, in update
    channels = self._vue.get_recent_usage(scale=Scale.MINUTE.value)
  File "/usr/local/lib/python3.8/site-packages/pyemvue/pyemvue.py", line 98, in get_recent_usage
    response.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://api.emporiaenergy.com/usage/devices?start=2020-10-06T18:00:14.809893Z&end=2020-10-06T18:00:15.809893Z&scale=1MIN&unit=WATTS&customerGid=10640

from ha-emporia-vue.

magico13 avatar magico13 commented on June 2, 2024

I'm curious if my changes in v0.2.0 might avert this problem. If anyone sees this still with that update let me know. If we don't have any reports in about a month I'll consider this fixed.

from ha-emporia-vue.

skynet01 avatar skynet01 commented on June 2, 2024

ill be on the watch out for it, thanks for the fix! I think their service is more stable now as well as i haven't had the timeout for a few weeks now.

from ha-emporia-vue.

magico13 avatar magico13 commented on June 2, 2024

I'm doing some cleanup and am going to close this issue. Please open another if any new issues come up!

from ha-emporia-vue.

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.