Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/tplink_omada/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/tplink_omada",
"integration_type": "hub",
"iot_class": "local_polling",
"requirements": ["tplink-omada-client==1.4.4"]
"requirements": ["tplink-omada-client==1.5.3"]
}
15 changes: 12 additions & 3 deletions homeassistant/components/tplink_omada/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
from functools import partial
from typing import Any, Generic, TypeVar

from tplink_omada_client import OmadaSiteClient, SwitchPortOverrides
from tplink_omada_client import (
GatewayPortSettings,
OmadaSiteClient,
PortProfileOverrides,
SwitchPortSettings,
)
from tplink_omada_client.definitions import GatewayPortMode, PoEMode, PortType
from tplink_omada_client.devices import (
OmadaDevice,
Expand All @@ -17,7 +22,6 @@
OmadaSwitch,
OmadaSwitchPortDetails,
)
from tplink_omada_client.omadasiteclient import GatewayPortSettings

from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
from homeassistant.const import EntityCategory
Expand Down Expand Up @@ -184,7 +188,12 @@ async def _wan_connect_disconnect(
),
set_func=(
lambda client, device, port, enable: client.update_switch_port(
device, port, overrides=SwitchPortOverrides(enable_poe=enable)
device,
port,
settings=SwitchPortSettings(
profile_override_enabled=True,
profile_overrides=PortProfileOverrides(enable_poe=enable),
),
)
),
update_func=lambda p: p.poe_mode != PoEMode.DISABLED,
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions tests/components/tplink_omada/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from unittest.mock import AsyncMock, MagicMock

from syrupy.assertion import SnapshotAssertion
from tplink_omada_client import SwitchPortOverrides
from tplink_omada_client import SwitchPortSettings
from tplink_omada_client.definitions import PoEMode
from tplink_omada_client.devices import (
OmadaGateway,
Expand Down Expand Up @@ -249,14 +249,16 @@ def assert_update_switch_port(
device: OmadaSwitch,
switch_port_details: OmadaSwitchPortDetails,
poe_enabled: bool,
overrides: SwitchPortOverrides = None,
settings: SwitchPortSettings,
) -> None:
assert device
assert device.mac == network_switch_mac
assert switch_port_details
assert switch_port_details.port == port_num
assert overrides
assert overrides.enable_poe == poe_enabled
assert settings
assert settings.profile_override_enabled
assert settings.profile_overrides
assert settings.profile_overrides.enable_poe == poe_enabled

entity = hass.states.get(entity_id)
assert entity == snapshot
Expand Down
Loading