Comments (7)
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.
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.
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.
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.
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.
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.
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)
- Unable to Login HOT 4
- Changing EVSE charge current turns off charging HOT 6
- Unexpected error upon installation HOT 4
- Midnight happened recently for id 130639-1,2,3-1D! Timestamp is 2023-04-26 00:00:01-04:00, midnight is 2023-04-26 00:00:00-04:00, previous reset was 2023-04-25 00:00:00-04:00 HOT 2
- Vue Gen 2 support ? HOT 3
- Maintogrid 1D doesn't work HOT 3
- Just stopped working HOT 10
- 1D sensor reset at 01:00, not at midnight HOT 8
- Sensor Questions HOT 3
- Reporting negative values HOT 2
- https://github.com/magico13/ha-emporia-vue
- More Options
- Unable to authenticate HOT 1
- Only 10-14 rolling days are kept on HomeAssistant, can't look at historic data HOT 1
- "Platform emporia_vue does not generate unique IDs" HOT 2
- Unable to parse services.yaml for the emporia_vue integration HOT 2
- Cannot get the charger to show any control interfaces. HOT 26
- Restore Deleted Entity HOT 2
- HA Core 2023.6 and Python 3.11 Compatibility HOT 2
- energy returned to grid error in Energy Day Graph HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ha-emporia-vue.