Update pyTibber to 0.30.1 (#124407)

Update to pyTibber==0.30.1
This commit is contained in:
functionpointer 2024-08-27 13:19:15 +02:00 committed by GitHub
parent a45ba51f89
commit 48292beec8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 20 additions and 17 deletions

View File

@ -61,13 +61,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
except ( except (
TimeoutError, TimeoutError,
aiohttp.ClientError, aiohttp.ClientError,
tibber.RetryableHttpException, tibber.RetryableHttpExceptionError,
) as err: ) as err:
raise ConfigEntryNotReady("Unable to connect") from err raise ConfigEntryNotReady("Unable to connect") from err
except tibber.InvalidLogin as exp: except tibber.InvalidLoginError as exp:
_LOGGER.error("Failed to login. %s", exp) _LOGGER.error("Failed to login. %s", exp)
return False return False
except tibber.FatalHttpException: except tibber.FatalHttpExceptionError:
return False return False
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

View File

@ -47,12 +47,12 @@ class TibberConfigFlow(ConfigFlow, domain=DOMAIN):
await tibber_connection.update_info() await tibber_connection.update_info()
except TimeoutError: except TimeoutError:
errors[CONF_ACCESS_TOKEN] = ERR_TIMEOUT errors[CONF_ACCESS_TOKEN] = ERR_TIMEOUT
except tibber.InvalidLogin: except tibber.InvalidLoginError:
errors[CONF_ACCESS_TOKEN] = ERR_TOKEN errors[CONF_ACCESS_TOKEN] = ERR_TOKEN
except ( except (
aiohttp.ClientError, aiohttp.ClientError,
tibber.RetryableHttpException, tibber.RetryableHttpExceptionError,
tibber.FatalHttpException, tibber.FatalHttpExceptionError,
): ):
errors[CONF_ACCESS_TOKEN] = ERR_CLIENT errors[CONF_ACCESS_TOKEN] = ERR_CLIENT

View File

@ -49,9 +49,9 @@ class TibberDataCoordinator(DataUpdateCoordinator[None]):
await self._tibber_connection.fetch_consumption_data_active_homes() await self._tibber_connection.fetch_consumption_data_active_homes()
await self._tibber_connection.fetch_production_data_active_homes() await self._tibber_connection.fetch_production_data_active_homes()
await self._insert_statistics() await self._insert_statistics()
except tibber.RetryableHttpException as err: except tibber.RetryableHttpExceptionError as err:
raise UpdateFailed(f"Error communicating with API ({err.status})") from err raise UpdateFailed(f"Error communicating with API ({err.status})") from err
except tibber.FatalHttpException: except tibber.FatalHttpExceptionError:
# Fatal error. Reload config entry to show correct error. # Fatal error. Reload config entry to show correct error.
self.hass.async_create_task( self.hass.async_create_task(
self.hass.config_entries.async_reload(self.config_entry.entry_id) self.hass.config_entries.async_reload(self.config_entry.entry_id)

View File

@ -8,5 +8,5 @@
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["tibber"], "loggers": ["tibber"],
"quality_scale": "silver", "quality_scale": "silver",
"requirements": ["pyTibber==0.28.2"] "requirements": ["pyTibber==0.30.1"]
} }

View File

@ -411,7 +411,7 @@ class TibberSensorElPrice(TibberSensor):
return return
res = self._tibber_home.current_price_data() res = self._tibber_home.current_price_data()
self._attr_native_value, price_level, self._last_updated = res self._attr_native_value, price_level, self._last_updated, _ = res
self._attr_extra_state_attributes["price_level"] = price_level self._attr_extra_state_attributes["price_level"] = price_level
attrs = self._tibber_home.current_attributes() attrs = self._tibber_home.current_attributes()

View File

@ -1707,7 +1707,7 @@ pyRFXtrx==0.31.1
pySDCP==1 pySDCP==1
# homeassistant.components.tibber # homeassistant.components.tibber
pyTibber==0.28.2 pyTibber==0.30.1
# homeassistant.components.dlink # homeassistant.components.dlink
pyW215==0.7.0 pyW215==0.7.0

View File

@ -1381,7 +1381,7 @@ pyElectra==1.2.4
pyRFXtrx==0.31.1 pyRFXtrx==0.31.1
# homeassistant.components.tibber # homeassistant.components.tibber
pyTibber==0.28.2 pyTibber==0.30.1
# homeassistant.components.dlink # homeassistant.components.dlink
pyW215==0.7.0 pyW215==0.7.0

View File

@ -154,7 +154,6 @@ EXCEPTIONS = {
"nsw-fuel-api-client", # https://github.com/nickw444/nsw-fuel-api-client/pull/14 "nsw-fuel-api-client", # https://github.com/nickw444/nsw-fuel-api-client/pull/14
"pigpio", # https://github.com/joan2937/pigpio/pull/608 "pigpio", # https://github.com/joan2937/pigpio/pull/608
"pymitv", # MIT "pymitv", # MIT
"pyTibber", # https://github.com/Danielhiversen/pyTibber/pull/294
"pybbox", # https://github.com/HydrelioxGitHub/pybbox/pull/5 "pybbox", # https://github.com/HydrelioxGitHub/pybbox/pull/5
"pyeconet", # https://github.com/w1ll1am23/pyeconet/pull/41 "pyeconet", # https://github.com/w1ll1am23/pyeconet/pull/41
"pysabnzbd", # https://github.com/jeradM/pysabnzbd/pull/6 "pysabnzbd", # https://github.com/jeradM/pysabnzbd/pull/6

View File

@ -5,7 +5,11 @@ from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
from aiohttp import ClientError from aiohttp import ClientError
import pytest import pytest
from tibber import FatalHttpException, InvalidLogin, RetryableHttpException from tibber import (
FatalHttpExceptionError,
InvalidLoginError,
RetryableHttpExceptionError,
)
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.components.recorder import Recorder from homeassistant.components.recorder import Recorder
@ -66,9 +70,9 @@ async def test_create_entry(recorder_mock: Recorder, hass: HomeAssistant) -> Non
[ [
(TimeoutError, ERR_TIMEOUT), (TimeoutError, ERR_TIMEOUT),
(ClientError, ERR_CLIENT), (ClientError, ERR_CLIENT),
(InvalidLogin(401), ERR_TOKEN), (InvalidLoginError(401), ERR_TOKEN),
(RetryableHttpException(503), ERR_CLIENT), (RetryableHttpExceptionError(503), ERR_CLIENT),
(FatalHttpException(404), ERR_CLIENT), (FatalHttpExceptionError(404), ERR_CLIENT),
], ],
) )
async def test_create_entry_exceptions( async def test_create_entry_exceptions(