Skip to content

Commit

Permalink
Update pyTibber to 0.30.1 (home-assistant#124407)
Browse files Browse the repository at this point in the history
Update to pyTibber==0.30.1
  • Loading branch information
functionpointer authored Aug 27, 2024
1 parent a45ba51 commit 48292be
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 17 deletions.
6 changes: 3 additions & 3 deletions homeassistant/components/tibber/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ async def _close(event: Event) -> None:
except (
TimeoutError,
aiohttp.ClientError,
tibber.RetryableHttpException,
tibber.RetryableHttpExceptionError,
) as 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)
return False
except tibber.FatalHttpException:
except tibber.FatalHttpExceptionError:
return False

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/tibber/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ async def async_step_user(
await tibber_connection.update_info()
except TimeoutError:
errors[CONF_ACCESS_TOKEN] = ERR_TIMEOUT
except tibber.InvalidLogin:
except tibber.InvalidLoginError:
errors[CONF_ACCESS_TOKEN] = ERR_TOKEN
except (
aiohttp.ClientError,
tibber.RetryableHttpException,
tibber.FatalHttpException,
tibber.RetryableHttpExceptionError,
tibber.FatalHttpExceptionError,
):
errors[CONF_ACCESS_TOKEN] = ERR_CLIENT

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/tibber/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ async def _async_update_data(self) -> None:
await self._tibber_connection.fetch_consumption_data_active_homes()
await self._tibber_connection.fetch_production_data_active_homes()
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
except tibber.FatalHttpException:
except tibber.FatalHttpExceptionError:
# Fatal error. Reload config entry to show correct error.
self.hass.async_create_task(
self.hass.config_entries.async_reload(self.config_entry.entry_id)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tibber/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "cloud_polling",
"loggers": ["tibber"],
"quality_scale": "silver",
"requirements": ["pyTibber==0.28.2"]
"requirements": ["pyTibber==0.30.1"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/tibber/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ async def async_update(self) -> None:
return

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

attrs = self._tibber_home.current_attributes()
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ pyRFXtrx==0.31.1
pySDCP==1

# homeassistant.components.tibber
pyTibber==0.28.2
pyTibber==0.30.1

# homeassistant.components.dlink
pyW215==0.7.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ pyElectra==1.2.4
pyRFXtrx==0.31.1

# homeassistant.components.tibber
pyTibber==0.28.2
pyTibber==0.30.1

# homeassistant.components.dlink
pyW215==0.7.0
Expand Down
1 change: 0 additions & 1 deletion script/licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def from_dict(cls, data: dict[str, str]) -> PackageDefinition:
"nsw-fuel-api-client", # https://github.com/nickw444/nsw-fuel-api-client/pull/14
"pigpio", # https://github.com/joan2937/pigpio/pull/608
"pymitv", # MIT
"pyTibber", # https://github.com/Danielhiversen/pyTibber/pull/294
"pybbox", # https://github.com/HydrelioxGitHub/pybbox/pull/5
"pyeconet", # https://github.com/w1ll1am23/pyeconet/pull/41
"pysabnzbd", # https://github.com/jeradM/pysabnzbd/pull/6
Expand Down
12 changes: 8 additions & 4 deletions tests/components/tibber/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

from aiohttp import ClientError
import pytest
from tibber import FatalHttpException, InvalidLogin, RetryableHttpException
from tibber import (
FatalHttpExceptionError,
InvalidLoginError,
RetryableHttpExceptionError,
)

from homeassistant import config_entries
from homeassistant.components.recorder import Recorder
Expand Down Expand Up @@ -66,9 +70,9 @@ async def test_create_entry(recorder_mock: Recorder, hass: HomeAssistant) -> Non
[
(TimeoutError, ERR_TIMEOUT),
(ClientError, ERR_CLIENT),
(InvalidLogin(401), ERR_TOKEN),
(RetryableHttpException(503), ERR_CLIENT),
(FatalHttpException(404), ERR_CLIENT),
(InvalidLoginError(401), ERR_TOKEN),
(RetryableHttpExceptionError(503), ERR_CLIENT),
(FatalHttpExceptionError(404), ERR_CLIENT),
],
)
async def test_create_entry_exceptions(
Expand Down

0 comments on commit 48292be

Please sign in to comment.