From 09f45660cff850e36e7c9c56f66face5580fb750 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 1 Sep 2023 14:10:47 -0400 Subject: [PATCH] Avoid linear search of MQTT SUPPORTED_COMPONENTS (#99459) By making this a set we avoid the linear search in async_discovery_message_received --- homeassistant/components/mqtt/discovery.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/mqtt/discovery.py b/homeassistant/components/mqtt/discovery.py index 37885b628d2..0002a1866a4 100644 --- a/homeassistant/components/mqtt/discovery.py +++ b/homeassistant/components/mqtt/discovery.py @@ -48,7 +48,7 @@ TOPIC_MATCHER = re.compile( r"?(?P[a-zA-Z0-9_-]+)/config" ) -SUPPORTED_COMPONENTS = [ +SUPPORTED_COMPONENTS = { "alarm_control_panel", "binary_sensor", "button", @@ -75,7 +75,7 @@ SUPPORTED_COMPONENTS = [ "update", "vacuum", "water_heater", -] +} MQTT_DISCOVERY_UPDATED = "mqtt_discovery_updated_{}" MQTT_DISCOVERY_NEW = "mqtt_discovery_new_{}_{}"