From 82f8af2fa2dca4ed656452e080c1e08421ff1fdb Mon Sep 17 00:00:00 2001 From: "Alan D. Tse" Date: Tue, 14 Jan 2020 19:25:14 -0800 Subject: [PATCH] perf: add break to for loops once item discovered --- custom_components/alexa_media/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom_components/alexa_media/__init__.py b/custom_components/alexa_media/__init__.py index a2ee01e9..8b6b0d1b 100644 --- a/custom_components/alexa_media/__init__.py +++ b/custom_components/alexa_media/__init__.py @@ -508,6 +508,7 @@ async def update_devices(login_obj): for b_state in bluetooth["bluetoothStates"]: if device["serialNumber"] == b_state["deviceSerialNumber"]: device["bluetooth_state"] = b_state + break if "devicePreferences" in preferences: for dev in preferences["devicePreferences"]: @@ -520,6 +521,7 @@ async def update_devices(login_obj): device["timeZoneId"], hide_serial(device["serialNumber"]), ) + break if "doNotDisturbDeviceStatusList" in dnd: for dev in dnd["doNotDisturbDeviceStatusList"]: @@ -530,6 +532,7 @@ async def update_devices(login_obj): device["dnd"], hide_serial(device["serialNumber"]), ) + break hass.data[DATA_ALEXAMEDIA]["accounts"][email]["auth_info"] = device[ "auth_info" ] = auth_info