Reset imap email content state if no email (#35123)

* no-message: If there is no message at all, replace internal state

* Apply proposed change

* apply black
This commit is contained in:
isk0001y 2020-05-07 00:41:56 +02:00 committed by GitHub
parent 5218b23fce
commit 541b666a86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -230,6 +230,8 @@ class EmailContentSensor(Entity):
email_message = self._email_reader.read_next()
if email_message is None:
self._message = None
self._state_attributes = {}
return
if self.sender_allowed(email_message):