Allow UniFi control PoE passthrough properly (#92028)

pull/133630/head
Robert Svensson 2023-04-26 09:16:18 +02:00 committed by GitHub
parent 828aed73af
commit 09109d093e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -131,7 +131,9 @@ async def async_poe_port_control_fn(
"""Control poe state."""
mac, _, index = obj_id.partition("_")
device = api.devices[mac]
state = "auto" if target else "off"
port = api.ports[obj_id]
on_state = "auto" if port.raw["poe_caps"] != 8 else "passthrough"
state = on_state if target else "off"
await api.request(DeviceSetPoePortModeRequest.create(device, int(index), state))

View File

@ -138,6 +138,7 @@ DEVICE_1 = {
"media": "GE",
"name": "Port 1",
"port_idx": 1,
"poe_caps": 7,
"poe_class": "Class 4",
"poe_enable": True,
"poe_mode": "auto",
@ -151,6 +152,7 @@ DEVICE_1 = {
"media": "GE",
"name": "Port 2",
"port_idx": 2,
"poe_caps": 7,
"poe_class": "Class 4",
"poe_enable": True,
"poe_mode": "auto",
@ -164,6 +166,7 @@ DEVICE_1 = {
"media": "GE",
"name": "Port 3",
"port_idx": 3,
"poe_caps": 7,
"poe_class": "Unknown",
"poe_enable": False,
"poe_mode": "off",
@ -177,6 +180,7 @@ DEVICE_1 = {
"media": "GE",
"name": "Port 4",
"port_idx": 4,
"poe_caps": 7,
"poe_class": "Unknown",
"poe_enable": False,
"poe_mode": "auto",