Skip to content

Commit

Permalink
Bump pyloadapi to v1.2.0 (#120218)
Browse files Browse the repository at this point in the history
  • Loading branch information
tr4nt0r authored Jun 23, 2024
1 parent bc45dcb commit f0d5640
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/pyload/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"integration_type": "service",
"iot_class": "local_polling",
"loggers": ["pyloadapi"],
"requirements": ["PyLoadAPI==1.1.0"]
"requirements": ["PyLoadAPI==1.2.0"]
}
14 changes: 9 additions & 5 deletions homeassistant/components/pyload/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
from enum import StrEnum
import logging
from time import monotonic
from typing import Any

from aiohttp import CookieJar
from pyloadapi.api import PyLoadAPI
from pyloadapi.exceptions import CannotConnect, InvalidAuth, ParserError
from pyloadapi import (
CannotConnect,
InvalidAuth,
ParserError,
PyLoadAPI,
StatusServerResponse,
)
import voluptuous as vol

from homeassistant.components.sensor import (
Expand Down Expand Up @@ -132,7 +136,7 @@ def __init__(
self.api = api
self.entity_description = entity_description
self._attr_available = False
self.data: dict[str, Any] = {}
self.data: StatusServerResponse

async def async_update(self) -> None:
"""Update state of sensor."""
Expand Down Expand Up @@ -167,7 +171,7 @@ async def async_update(self) -> None:
self._attr_available = False
return
else:
self.data = status.to_dict()
self.data = status
_LOGGER.debug(
"Finished fetching pyload data in %.3f seconds",
monotonic() - start,
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PyFlume==0.6.5
PyFronius==0.7.3

# homeassistant.components.pyload
PyLoadAPI==1.1.0
PyLoadAPI==1.2.0

# homeassistant.components.mvglive
PyMVGLive==1.1.4
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ PyFlume==0.6.5
PyFronius==0.7.3

# homeassistant.components.pyload
PyLoadAPI==1.1.0
PyLoadAPI==1.2.0

# homeassistant.components.met_eireann
PyMetEireann==2021.8.0
Expand Down
6 changes: 4 additions & 2 deletions tests/components/pyload/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def mock_pyloadapi() -> Generator[AsyncMock, None, None]:
):
client = mock_client.return_value
client.username = "username"
client.login.return_value = LoginResponse.from_dict(
client.login.return_value = LoginResponse(
{
"_permanent": True,
"authenticated": True,
Expand All @@ -59,7 +59,8 @@ def mock_pyloadapi() -> Generator[AsyncMock, None, None]:
"_flashes": [["message", "Logged in successfully"]],
}
)
client.get_status.return_value = StatusServerResponse.from_dict(

client.get_status.return_value = StatusServerResponse(
{
"pause": False,
"active": 1,
Expand All @@ -71,5 +72,6 @@ def mock_pyloadapi() -> Generator[AsyncMock, None, None]:
"captcha": False,
}
)

client.free_space.return_value = 99999999999
yield client

0 comments on commit f0d5640

Please sign in to comment.