From 0439b377f8346cba034aaf9cd4c43eb3a1a23ea4 Mon Sep 17 00:00:00 2001 From: myTselection Date: Fri, 29 Dec 2023 13:34:22 +0100 Subject: [PATCH] reload +- every 120min to limit slow reloads --- custom_components/carbu_com/manifest.json | 2 +- custom_components/carbu_com/sensor.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/carbu_com/manifest.json b/custom_components/carbu_com/manifest.json index 49ce6da..bbafe2b 100644 --- a/custom_components/carbu_com/manifest.json +++ b/custom_components/carbu_com/manifest.json @@ -9,5 +9,5 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/myTselection/carbu_com/issues", "requirements": ["bs4","requests","ratelimit"], - "version": "9.0.1" + "version": "9.0.3" } diff --git a/custom_components/carbu_com/sensor.py b/custom_components/carbu_com/sensor.py index 2c9b3ce..171887a 100644 --- a/custom_components/carbu_com/sensor.py +++ b/custom_components/carbu_com/sensor.py @@ -3,6 +3,7 @@ from datetime import date, datetime, timedelta import calendar from .utils import * +import random import homeassistant.helpers.config_validation as cv import voluptuous as vol @@ -41,7 +42,7 @@ } ) -MIN_TIME_BETWEEN_UPDATES = timedelta(hours=1) +MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=120 + random.uniform(10, 20)) # MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=10)