Bump pyloadapi to v1.2.0 (#120218)

This commit is contained in:
Mr. Bubbles 2024-06-23 04:22:13 +02:00 committed by GitHub
parent bc45dcbad3
commit f0d5640f5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 10 deletions

View File

@ -6,5 +6,5 @@
"integration_type": "service", "integration_type": "service",
"iot_class": "local_polling", "iot_class": "local_polling",
"loggers": ["pyloadapi"], "loggers": ["pyloadapi"],
"requirements": ["PyLoadAPI==1.1.0"] "requirements": ["PyLoadAPI==1.2.0"]
} }

View File

@ -6,11 +6,15 @@ from datetime import timedelta
from enum import StrEnum from enum import StrEnum
import logging import logging
from time import monotonic from time import monotonic
from typing import Any
from aiohttp import CookieJar from aiohttp import CookieJar
from pyloadapi.api import PyLoadAPI from pyloadapi import (
from pyloadapi.exceptions import CannotConnect, InvalidAuth, ParserError CannotConnect,
InvalidAuth,
ParserError,
PyLoadAPI,
StatusServerResponse,
)
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
@ -132,7 +136,7 @@ class PyLoadSensor(SensorEntity):
self.api = api self.api = api
self.entity_description = entity_description self.entity_description = entity_description
self._attr_available = False self._attr_available = False
self.data: dict[str, Any] = {} self.data: StatusServerResponse
async def async_update(self) -> None: async def async_update(self) -> None:
"""Update state of sensor.""" """Update state of sensor."""
@ -167,7 +171,7 @@ class PyLoadSensor(SensorEntity):
self._attr_available = False self._attr_available = False
return return
else: else:
self.data = status.to_dict() self.data = status
_LOGGER.debug( _LOGGER.debug(
"Finished fetching pyload data in %.3f seconds", "Finished fetching pyload data in %.3f seconds",
monotonic() - start, monotonic() - start,

View File

@ -60,7 +60,7 @@ PyFlume==0.6.5
PyFronius==0.7.3 PyFronius==0.7.3
# homeassistant.components.pyload # homeassistant.components.pyload
PyLoadAPI==1.1.0 PyLoadAPI==1.2.0
# homeassistant.components.mvglive # homeassistant.components.mvglive
PyMVGLive==1.1.4 PyMVGLive==1.1.4

View File

@ -51,7 +51,7 @@ PyFlume==0.6.5
PyFronius==0.7.3 PyFronius==0.7.3
# homeassistant.components.pyload # homeassistant.components.pyload
PyLoadAPI==1.1.0 PyLoadAPI==1.2.0
# homeassistant.components.met_eireann # homeassistant.components.met_eireann
PyMetEireann==2021.8.0 PyMetEireann==2021.8.0

View File

@ -47,7 +47,7 @@ def mock_pyloadapi() -> Generator[AsyncMock, None, None]:
): ):
client = mock_client.return_value client = mock_client.return_value
client.username = "username" client.username = "username"
client.login.return_value = LoginResponse.from_dict( client.login.return_value = LoginResponse(
{ {
"_permanent": True, "_permanent": True,
"authenticated": True, "authenticated": True,
@ -59,7 +59,8 @@ def mock_pyloadapi() -> Generator[AsyncMock, None, None]:
"_flashes": [["message", "Logged in successfully"]], "_flashes": [["message", "Logged in successfully"]],
} }
) )
client.get_status.return_value = StatusServerResponse.from_dict(
client.get_status.return_value = StatusServerResponse(
{ {
"pause": False, "pause": False,
"active": 1, "active": 1,
@ -71,5 +72,6 @@ def mock_pyloadapi() -> Generator[AsyncMock, None, None]:
"captcha": False, "captcha": False,
} }
) )
client.free_space.return_value = 99999999999 client.free_space.return_value = 99999999999
yield client yield client