    def _cached_ratelimit(self, statevalue: Any, interval: int | None = None):
        """A simple way to rate-limit sensor updates."""
        if interval is not None:
            self._cache_ratelimit_interval = interval
        nowstamp = MONOTONIC_TIME()

        if nowstamp > self._cache_ratelimit_stamp + self._cache_ratelimit_interval:
            self._cache_ratelimit_stamp = nowstamp
            self._cache_ratelimit_value = statevalue
            return statevalue
        else:
            return self._cache_ratelimit_value
A simple way to rate-limit sensor updates.
custom_components/bermuda/entity.py