Skip to content

Commit

Permalink
Update sensor.py (home-assistant#25825)
Browse files Browse the repository at this point in the history
exclude "unknown" values from measurements
  • Loading branch information
MatsNl authored and balloob committed Aug 10, 2019
1 parent 68ee828 commit a6f1773
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion homeassistant/components/statistics/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
CONF_ENTITY_ID,
EVENT_HOMEASSISTANT_START,
STATE_UNKNOWN,
STATE_UNAVAILABLE,
ATTR_UNIT_OF_MEASUREMENT,
)
from homeassistant.core import callback
Expand Down Expand Up @@ -131,7 +132,7 @@ def async_stats_sensor_startup(event):

def _add_state_to_queue(self, new_state):
"""Add the state to the queue."""
if new_state.state == STATE_UNKNOWN:
if new_state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE]:
return

try:
Expand Down

0 comments on commit a6f1773

Please sign in to comment.