Use DEFAULT_SCAN_INTERVAL as update interval for glances (#93535)
Use default scan interval constant
This commit is contained in:
parent
6c66af4e41
commit
eb617e85f3
2 changed files with 4 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
"""Constants for Glances component."""
|
"""Constants for Glances component."""
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
DOMAIN = "glances"
|
DOMAIN = "glances"
|
||||||
|
@ -8,7 +9,7 @@ CONF_VERSION = "version"
|
||||||
DEFAULT_HOST = "localhost"
|
DEFAULT_HOST = "localhost"
|
||||||
DEFAULT_PORT = 61208
|
DEFAULT_PORT = 61208
|
||||||
DEFAULT_VERSION = 3
|
DEFAULT_VERSION = 3
|
||||||
DEFAULT_SCAN_INTERVAL = 60
|
DEFAULT_SCAN_INTERVAL = timedelta(seconds=60)
|
||||||
|
|
||||||
SUPPORTED_VERSIONS = [2, 3]
|
SUPPORTED_VERSIONS = [2, 3]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Coordinator for Glances integration."""
|
"""Coordinator for Glances integration."""
|
||||||
from datetime import timedelta
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -10,7 +9,7 @@ from homeassistant.const import CONF_HOST
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DEFAULT_SCAN_INTERVAL, DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ class GlancesDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
name=f"{DOMAIN} - {self.host}",
|
name=f"{DOMAIN} - {self.host}",
|
||||||
update_interval=timedelta(seconds=60),
|
update_interval=DEFAULT_SCAN_INTERVAL,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _async_update_data(self) -> dict[str, Any]:
|
async def _async_update_data(self) -> dict[str, Any]:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue