Danielhiversen / home_assistant_tibber_data

Display Tibber data sensors.
MIT License
42 stars 13 forks source link

Error fetching Tibber data #30

Closed SVH-Powel closed 2 years ago

SVH-Powel commented 2 years ago

I got an unexpected restart of Home Assistant. I dont know if it is related, but the latest log entry in home-assistant.log.1 is shown below. The log time match the unexpected restart.

`2022-10-04 13:16:11.307 ERROR (MainThread) [tibber] Timed out when connecting to Tibber 2022-10-04 13:16:11.311 ERROR (MainThread) [custom_components.tibber_data.data_coordinator] Error fetching Tibber data Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/tibber/init.py", line 125, in _execute if resp.status != 200: File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request await resp.start(conn) File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 898, in start message, payload = await protocol.read() # type: ignore[union-attr] File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, in read await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/config/custom_components/tibber_data/data_coordinator.py", line 75, in _async_update_data self._update_functions[func] = await func(data, now) File "/config/custom_components/tibber_data/data_coordinator.py", line 284, in _get_data await self.tibber_home.update_price_info() File "/usr/local/lib/python3.10/site-packages/tibber/init.py", line 671, in update_price_info File "/usr/local/lib/python3.10/site-packages/tibber/init.py", line 102, in execute return None File "/usr/local/lib/python3.10/site-packages/tibber/init.py", line 124, in _execute resp = await self.websession.post(API_ENDPOINT, **post_args) File "/usr/local/lib/python3.10/site-packages/async_timeout/init.py", line 129, in aexit self._do_exit(exc_type) File "/usr/local/lib/python3.10/site-packages/async_timeout/init.py", line 212, in _do_exit raise asyncio.TimeoutError asyncio.exceptions.TimeoutError 2022-10-04 13:18:18.216 ERROR (MainThread) [tibber] Received non-compatible response [{'message': 'http://internal-prod-alb-internal-1339522581.eu-west-1.elb.amazonaws.com:3006/subscriptions/2150f978-57da-4800-bd49-8ef6a05047ec/price-info/hourly?historyDays=0 Response code 502 (Bad Gateway)', 'locations': [{'line': 7, 'column': 19}], 'path': ['viewer', 'home', 'currentSubscription', 'priceInfo', 'current'], 'extensions': {'code': 'INTERNAL_SERVER_ERROR', 'exception': {'statusCode': 502, 'innerError': {'name': 'HTTPError', 'code': 'ERR_NON_2XX_3XX_RESPONSE', 'timings': {'start': 1664882297126, 'socket': 1664882297126, 'lookup': 1664882297126, 'connect': 1664882297126, 'upload': 1664882297126, 'response': 1664882297127, 'end': 1664882297127, 'phases': {'wait': 0, 'dns': 0, 'tcp': 0, 'request': 0, 'firstByte': 1, 'download': 0, 'total': 1}}}}}}, {'message': 'http://internal-prod-alb-internal-1339522581.eu-west-1.elb.amazonaws.com:3006/subscriptions/2150f978-57da-4800-bd49-8ef6a05047ec/price-info/hourly?historyDays=0 Response code 502 (Bad Gateway)', 'locations': [{'line': 14, 'column': 19}], 'path': ['viewer', 'home', 'currentSubscription', 'priceInfo', 'today'], 'extensions': {'code': 'INTERNAL_SERVER_ERROR', 'exception': {'statusCode': 502, 'innerError': {'name': 'HTTPError', 'code': 'ERR_NON_2XX_3XX_RESPONSE', 'timings': {'start': 1664882297126, 'socket': 1664882297126, 'lookup': 1664882297126, 'connect': 1664882297126, 'upload': 1664882297126, 'response': 1664882297127, 'end': 1664882297127, 'phases': {'wait': 0, 'dns': 0, 'tcp': 0, 'request': 0, 'firstByte': 1, 'download': 0, 'total': 1}}}}}}] 2022-10-04 13:18:18.287 ERROR (MainThread) [tibber] Could not find price info for current. 2022-10-04 13:18:18.289 ERROR (MainThread) [tibber] Could not find price info for today. 2022-10-04 13:18:18.291 ERROR (MainThread) [tibber] Could not find price info for tomorrow. 2022-10-04 13:18:18.296 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners update_callback() File "/config/custom_components/tibber_data/sensor.py", line 92, in _handle_coordinator_update native_value = price - self.coordinator.data["est_subsidy"] TypeError: unsupported operand type(s) for -: 'NoneType' and 'float' `

Danielhiversen commented 2 years ago

Response code 502

Sound like an issue at Tibber

phellarv commented 2 years ago

Yes, but I think there could be more error handling in tibber_data. I often experience problems when it takes a while to load the tibber integration. Then all the tibber_data sensors ends up in an unavailable state. Even when I reload the tibber integration, the tibber_data sensors never recovers from the unavailable state. I then end up restarting core a couple of times before the tibber_data sensors are ok again.

dajomu1 commented 2 years ago

I agree. Several days with the sensors unavailable.

dajomu1 commented 2 years ago

I just redownloaded the integration, restarted HA and now it works again. Hope it stays like this.

Danielhiversen commented 2 years ago

Have you had the issue with the latest version of the integration?

dajomu1 commented 2 years ago

No I have not. My only issue now is with the price, but that bug is alteady reported and being fixed in 2022.10.6 or 7 I believe