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 pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "tplink_omada_client"
version = "1.5.1"
version = "1.5.2"
authors = [
{ name="Mark Godwin", email="10632972+MarkGodwin@users.noreply.github.com" },
]
Expand Down
4 changes: 2 additions & 2 deletions src/tplink_omada_client/cli/command_switch_ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def command_switch_ports(args) -> int:
print(f" Profile: {p.profile_name} - {get_checkbox_char(p.has_profile_override)}")
print(f" Enabled: {get_checkbox_char(not p.is_disabled)}")
print(f" Status: {get_link_status_char(p.port_status.link_status)} ")
if switch.device_capabilities.supports_poe and p.type != PortType.SFP:
if switch.device_capabilities.supports_poe and p.supports_poe and p.type != PortType.SFP:
print(f" PoE: {get_checkbox_char(p.poe_mode == PoEMode.ENABLED)} ", end="")
print(f"{get_power_char(p.port_status.poe_active)} {p.port_status.poe_power}W ")
else:
Expand All @@ -66,7 +66,7 @@ def _print_port_table(switch: OmadaSwitch, ports: list[OmadaSwitchPortDetails]):
else:
print(" --- ", end="")

if switch.device_capabilities.supports_poe and p.type != PortType.SFP:
if switch.device_capabilities.supports_poe and p.supports_poe and p.type != PortType.SFP:
print(f" {get_checkbox_char(p.poe_mode == PoEMode.ENABLED)}", end="")
print(f"{get_power_char(p.port_status.poe_active)} {p.port_status.poe_power:>4}W ", end="")
else:
Expand Down
10 changes: 8 additions & 2 deletions src/tplink_omada_client/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def poe_enable(self) -> bool:

WARNING: Do not enable PoE for EAPs powered from another EAP
"""
return self._data["poeOutEnable"]
return self._data.get("poeOutEnable", False)


class OmadaAccessPoint(OmadaDetailedDevice):
Expand Down Expand Up @@ -478,10 +478,16 @@ def has_profile_override(self) -> bool:
"""True if the port's config profile has been overridden."""
return self._data["profileOverrideEnable"]

@property
def supports_poe(self) -> bool:
"""True if the port supports PoE."""
return self._data.get("supportPoe", True) # default to true, some older versions don't report this

@property
def poe_mode(self) -> PoEMode:
"""PoE config for this port."""
return PoEMode(self._data.get("poe", PoEMode.NONE))
# For reasons, Omada may claim Enabled on non-poe ports - probably due to port profiles
return PoEMode(self._data.get("poe", PoEMode.NONE)) if self.supports_poe else PoEMode.NONE

@property
def bandwidth_limit_mode(self) -> BandwidthControl:
Expand Down