Merge of nested IF-IF cases - A-C (#48365)

This commit is contained in:
Franck Nijhof 2021-03-27 10:58:38 +01:00 committed by GitHub
parent 8d5ce53098
commit db355f9b23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 32 deletions

View file

@ -349,12 +349,18 @@ def _device_already_added(current_entries, user_input, protocol):
entry_path = entry.data.get(CONF_DEVICE_PATH)
entry_baud = entry.data.get(CONF_DEVICE_BAUD)
if protocol == PROTOCOL_SOCKET:
if user_host == entry_host and user_port == entry_port:
return True
if (
protocol == PROTOCOL_SOCKET
and user_host == entry_host
and user_port == entry_port
):
return True
if protocol == PROTOCOL_SERIAL:
if user_baud == entry_baud and user_path == entry_path:
return True
if (
protocol == PROTOCOL_SERIAL
and user_baud == entry_baud
and user_path == entry_path
):
return True
return False