Throttle ebusd sensors instead of the whole component (#40610)
This commit is contained in:
1 parent
9cd8f66e14
commit
6ddc6a44a2
2 files changed
+4
-6
No files matched your search
@@ -3,6 +3,7 @@ import datetime
|
||||
import logging
|
||||
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import DOMAIN
|
||||
@@ -13,6 +14,7 @@ TIME_FRAME2_BEGIN = "time_frame2_begin"
|
||||
TIME_FRAME2_END = "time_frame2_end"
|
||||
TIME_FRAME3_BEGIN = "time_frame3_begin"
|
||||
TIME_FRAME3_END = "time_frame3_end"
|
||||
MIN_TIME_BETWEEN_UPDATES = datetime.timedelta(seconds=15)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -85,6 +87,7 @@ class EbusdSensor(Entity):
|
||||
"""Return the unit of measurement."""
|
||||
return self._unit_of_measurement
|
||||
|
||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
def update(self):
|
||||
"""Fetch new state data for the sensor."""
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user