Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump elmax-api to 0.0.6.3 #131876

Merged
2 changes: 1 addition & 1 deletion homeassistant/components/elmax/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, {})

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/elmax/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ async def _test_direct_and_create_entry(self):

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,
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/elmax/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ async def async_stop_cover(self, **kwargs: Any) -> None:
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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/elmax/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions tests/components/elmax/conftest.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -11,6 +12,7 @@
ENDPOINT_LOGIN,
)
from httpx import Response
import jwt
import pytest
import respx

Expand Down Expand Up @@ -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(
Expand Down
Loading