Skip to content

Commit

Permalink
Moved MailCheck to EmailData
Browse files Browse the repository at this point in the history
Moved the MailCheck time update to the EmailData. Brings it in sync with how the other entities are updated.
  • Loading branch information
moralmunky committed Mar 22, 2020
1 parent e7bbe29 commit 7cfec01
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions custom_components/mail_and_packages/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def update(self):

else:
_LOGGER.debug("Host was left blank not attempting connection")

self._scan_time = update_time()
_LOGGER.debug("Updated scan time: %s", self._scan_time)


class MailCheck(Entity):
Expand Down Expand Up @@ -198,13 +201,13 @@ def icon(self):

return "mdi:update"

@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Fetch new state data for the sensor.
This is the only method that should fetch new data for Home Assistant.
"""

self._state = update_time()
self.data.update()
self._state = self.data._scan_time


class Amazon_Packages(Entity):
Expand Down

0 comments on commit 7cfec01

Please sign in to comment.