Fix connection validation during import for dsmr integration (#40548)

* Close transport when equipment identifier is received

* Minor fix
This commit is contained in:
Rob Bierbooms 2020-09-24 22:50:30 +02:00 committed by GitHub
parent 6afa197586
commit 0856c7292c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,9 +48,9 @@ class DSMRConnection:
"""Test if we can validate connection with the device."""
def update_telegram(telegram):
self._telegram = telegram
transport.close()
if obis_ref.EQUIPMENT_IDENTIFIER in telegram:
self._telegram = telegram
transport.close()
if self._host is None:
reader_factory = partial(