Bump elmax-api to 0.0.6.3 (#131876)

pull/132328/head
Alberto Geniola 2024-12-04 23:59:40 +01:00 committed by GitHub
parent 94b16da90f
commit 84e6c0b9ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 22 additions and 9 deletions

View File

@ -35,7 +35,7 @@ def check_local_version_supported(api_version: str | None) -> bool:
class DirectPanel(PanelEntry):
"""Helper class for wrapping a directly accessed Elmax Panel."""
def __init__(self, panel_uri):
def __init__(self, panel_uri) -> None:
"""Construct the object."""
super().__init__(panel_uri, True, {})

View File

@ -203,7 +203,7 @@ class ElmaxConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_direct(self, user_input: dict[str, Any]) -> ConfigFlowResult:
"""Handle the direct setup step."""
self._selected_mode = CONF_ELMAX_MODE_CLOUD
self._selected_mode = CONF_ELMAX_MODE_DIRECT
if user_input is None:
return self.async_show_form(
step_id=CONF_ELMAX_MODE_DIRECT,

View File

@ -121,13 +121,13 @@ class ElmaxCover(ElmaxEntity, CoverEntity):
else:
_LOGGER.debug("Ignoring stop request as the cover is IDLE")
async def async_open_cover(self, **kwargs):
async def async_open_cover(self, **kwargs: Any) -> None:
"""Open the cover."""
await self.coordinator.http_client.execute_command(
endpoint_id=self._device.endpoint_id, command=CoverCommand.UP
)
async def async_close_cover(self, **kwargs):
async def async_close_cover(self, **kwargs: Any) -> None:
"""Close the cover."""
await self.coordinator.http_client.execute_command(
endpoint_id=self._device.endpoint_id, command=CoverCommand.DOWN

View File

@ -6,7 +6,7 @@
"documentation": "https://www.home-assistant.io/integrations/elmax",
"iot_class": "cloud_polling",
"loggers": ["elmax_api"],
"requirements": ["elmax-api==0.0.6.1"],
"requirements": ["elmax-api==0.0.6.3"],
"zeroconf": [
{
"type": "_elmax-ssl._tcp.local."

View File

@ -821,7 +821,7 @@ eliqonline==1.2.2
elkm1-lib==2.2.10
# homeassistant.components.elmax
elmax-api==0.0.6.1
elmax-api==0.0.6.3
# homeassistant.components.elvia
elvia==0.1.0

View File

@ -696,7 +696,7 @@ elgato==5.1.2
elkm1-lib==2.2.10
# homeassistant.components.elmax
elmax-api==0.0.6.1
elmax-api==0.0.6.3
# homeassistant.components.elvia
elvia==0.1.0

View File

@ -1,6 +1,7 @@
"""Configuration for Elmax tests."""
from collections.abc import Generator
from datetime import datetime, timedelta
import json
from unittest.mock import AsyncMock, patch
@ -11,6 +12,7 @@ from elmax_api.constants import (
ENDPOINT_LOGIN,
)
from httpx import Response
import jwt
import pytest
import respx
@ -64,9 +66,20 @@ def httpx_mock_direct_fixture() -> Generator[respx.MockRouter]:
) as respx_mock:
# Mock Login POST.
login_route = respx_mock.post(f"/api/v2/{ENDPOINT_LOGIN}", name="login")
login_route.return_value = Response(
200, json=json.loads(load_fixture("direct/login.json", "elmax"))
login_json = json.loads(load_fixture("direct/login.json", "elmax"))
decoded_jwt = jwt.decode_complete(
login_json["token"].split(" ")[1],
algorithms="HS256",
options={"verify_signature": False},
)
expiration = datetime.now() + timedelta(hours=1)
decoded_jwt["payload"]["exp"] = int(expiration.timestamp())
jws_string = jwt.encode(
payload=decoded_jwt["payload"], algorithm="HS256", key=""
)
login_json["token"] = f"JWT {jws_string}"
login_route.return_value = Response(200, json=login_json)
# Mock Device list GET.
list_devices_route = respx_mock.get(