Don't care about DPI entries when looking for clients to be restored from UniFi (#48579)

* DPI switches shouldnt be restored, they're not part of clients to be restored

* Only care about Block and POE switch entries
pull/48782/head
Robert Svensson 2021-04-01 18:02:28 +02:00 committed by Paulus Schoutsen
parent 3982849275
commit f08e7dccdf
1 changed files with 5 additions and 1 deletions

View File

@ -29,6 +29,7 @@ import async_timeout
from homeassistant.components.device_tracker import DOMAIN as TRACKER_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.components.unifi.switch import BLOCK_SWITCH, POE_SWITCH
from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.const import (
CONF_HOST,
@ -347,7 +348,10 @@ class UniFiController:
):
if entry.domain == TRACKER_DOMAIN:
mac = entry.unique_id.split("-", 1)[0]
elif entry.domain == SWITCH_DOMAIN:
elif entry.domain == SWITCH_DOMAIN and (
entry.unique_id.startswith(BLOCK_SWITCH)
or entry.unique_id.startswith(POE_SWITCH)
):
mac = entry.unique_id.split("-", 1)[1]
else:
continue