Update usage of async_entries to use _async_current_entries (#50187)

This commit is contained in:
J. Nick Koston 2021-05-12 05:47:06 -05:00 committed by GitHub
parent c3eee9800a
commit a4ea9b3cd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 40 additions and 67 deletions

View file

@ -218,7 +218,7 @@ class MySensorsConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
return self.async_show_form(step_id="gw_tcp", data_schema=schema, errors=errors)
def _check_topic_exists(self, topic: str) -> bool:
for other_config in self.hass.config_entries.async_entries(DOMAIN):
for other_config in self._async_current_entries():
if topic == other_config.data.get(
CONF_TOPIC_IN_PREFIX
) or topic == other_config.data.get(CONF_TOPIC_OUT_PREFIX):
@ -329,7 +329,7 @@ class MySensorsConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
] = self._normalize_persistence_file(
user_input[CONF_PERSISTENCE_FILE]
)
for other_entry in self.hass.config_entries.async_entries(DOMAIN):
for other_entry in self._async_current_entries():
if CONF_PERSISTENCE_FILE not in other_entry.data:
continue
if real_persistence_path == self._normalize_persistence_file(
@ -338,7 +338,7 @@ class MySensorsConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
errors[CONF_PERSISTENCE_FILE] = "duplicate_persistence_file"
break
for other_entry in self.hass.config_entries.async_entries(DOMAIN):
for other_entry in self._async_current_entries():
if _is_same_device(gw_type, user_input, other_entry):
errors["base"] = "already_configured"
break