Avoid linear search of MQTT SUPPORTED_COMPONENTS (#99459)

By making this a set we avoid the linear search in async_discovery_message_received
This commit is contained in:
J. Nick Koston 2023-09-01 14:10:47 -04:00 committed by GitHub
parent cf59ea3c47
commit 09f45660cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ TOPIC_MATCHER = re.compile(
r"?(?P<object_id>[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_{}_{}"