diff --git a/custom_components/bedste_lectio/__init__.py b/custom_components/bedste_lectio/__init__.py index 30c3704..db65973 100644 --- a/custom_components/bedste_lectio/__init__.py +++ b/custom_components/bedste_lectio/__init__.py @@ -14,9 +14,7 @@ from .const import CONF_SCHOOL, DOMAIN from .coordinator import BedsteLectioDataUpdateCoordinator -PLATFORMS: list[Platform] = [ - Platform.SENSOR -] +PLATFORMS: list[Platform] = [Platform.SENSOR] # https://developers.home-assistant.io/docs/config_entries_index/#setting-up-an-entry diff --git a/custom_components/bedste_lectio/api.py b/custom_components/bedste_lectio/api.py index e771733..e6b9ef1 100644 --- a/custom_components/bedste_lectio/api.py +++ b/custom_components/bedste_lectio/api.py @@ -14,15 +14,11 @@ class BedsteLectioApiClientError(Exception): """Exception to indicate a general API error.""" -class BedsteLectioApiClientCommunicationError( - BedsteLectioApiClientError -): +class BedsteLectioApiClientCommunicationError(BedsteLectioApiClientError): """Exception to indicate a communication error.""" -class BedsteLectioApiClientAuthenticationError( - BedsteLectioApiClientError -): +class BedsteLectioApiClientAuthenticationError(BedsteLectioApiClientError): """Exception to indicate an authentication error.""" @@ -45,11 +41,13 @@ def __init__( async def async_get_next_room(self) -> any: """Get next room from the API.""" return await self._api_wrapper( - method="get", url=f"{BEDSTELECTIO_API_URL}/ha/frontpage", headers={ + method="get", + url=f"{BEDSTELECTIO_API_URL}/ha/frontpage", + headers={ "username": self._username, "password": self._password, "school": self._school, - } + }, ) async def async_get_schools(self) -> list[str]: diff --git a/custom_components/bedste_lectio/config_flow.py b/custom_components/bedste_lectio/config_flow.py index 641c91c..07a88d8 100644 --- a/custom_components/bedste_lectio/config_flow.py +++ b/custom_components/bedste_lectio/config_flow.py @@ -86,7 +86,9 @@ async def async_step_user( errors=_errors, ) - async def _test_credentials(self, username: str, password: str, school: str) -> None: + async def _test_credentials( + self, username: str, password: str, school: str + ) -> None: """Validate credentials.""" client = BedsteLectioApiClient( username=username, diff --git a/custom_components/bedste_lectio/sensor.py b/custom_components/bedste_lectio/sensor.py index a9d8d2b..3e8be44 100644 --- a/custom_components/bedste_lectio/sensor.py +++ b/custom_components/bedste_lectio/sensor.py @@ -45,21 +45,27 @@ def get_next_room(entries: list[dict[str, str]]) -> dict[str, str]: rooms = [] for entry in entries: - dt_str =re.sub(r"(? dict[str, any]: """Return the state attributes of the entity.""" entries = self.coordinator.data.get("skema") data = get_next_room(entries) - data.update({ - "last_update": datetime.now().astimezone(ZoneInfo("Europe/Copenhagen")), - }) + data.update( + { + "last_update": datetime.now().astimezone(ZoneInfo("Europe/Copenhagen")), + } + ) return data