Skip to content

Commit

Permalink
Temp comment code
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioisidoro committed Mar 27, 2021
1 parent 0f639a3 commit 3e187d6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions custom_components/ruuvi/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ def set_state(self, state):
_LOGGER.debug(f"Updated {self.update_time} {self.name}: {self.state}")

self.schedule_update_ha_state()
call_later(self.hass, EXPIRE_AFTER, self.expire_state_if_old)

def expire_state_if_old(self, delay):
state_age_seconds = (dt.utcnow() - self.update_time) / datetime.timedelta(seconds=1)
if state_age_seconds >= EXPIRE_AFTER:
_LOGGER.debug(f"{self.name}: Expire state due to age")
self._state = STATE_UNKNOWN
self.schedule_update_ha_state()
# call_later(self.hass, EXPIRE_AFTER, self.expire_state_if_old)

# def expire_state_if_old(self, delay):
# state_age_seconds = (dt.utcnow() - self.update_time) / datetime.timedelta(seconds=1)
# if state_age_seconds >= EXPIRE_AFTER:
# _LOGGER.debug(f"{self.name}: Expire state due to age")
# self._state = STATE_UNKNOWN
# self.schedule_update_ha_state()

0 comments on commit 3e187d6

Please sign in to comment.