Update sensor.py (#25825)

exclude "unknown" values from measurements
pull/25859/head
MatsNl 2019-08-10 23:45:47 +02:00 committed by Paulus Schoutsen
parent 68ee828674
commit a6f1773492
1 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@ from homeassistant.const import (
CONF_ENTITY_ID,
EVENT_HOMEASSISTANT_START,
STATE_UNKNOWN,
STATE_UNAVAILABLE,
ATTR_UNIT_OF_MEASUREMENT,
)
from homeassistant.core import callback
@ -131,7 +132,7 @@ class StatisticsSensor(Entity):
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: