From 81db20344d9c565744f2681b20cda16175675461 Mon Sep 17 00:00:00 2001 From: Cameron Ring Date: Sun, 28 Jul 2024 16:33:31 -0700 Subject: [PATCH] fix: scan every 30 seconds --- custom_components/doorking_1812ap/const.py | 4 +++- custom_components/doorking_1812ap/coordinator.py | 5 ++--- custom_components/doorking_1812ap/entity.py | 3 --- custom_components/doorking_1812ap/manifest.json | 3 +-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/custom_components/doorking_1812ap/const.py b/custom_components/doorking_1812ap/const.py index a04e6a6..90366cd 100644 --- a/custom_components/doorking_1812ap/const.py +++ b/custom_components/doorking_1812ap/const.py @@ -1,8 +1,10 @@ """Constants for doorking_1812ap.""" +from datetime import timedelta from logging import Logger, getLogger LOGGER: Logger = getLogger(__package__) DOMAIN = "doorking_1812ap" -ATTRIBUTION = "Data provided by http://jsonplaceholder.typicode.com/" + +SCAN_INTERVAL = timedelta(seconds=30) diff --git a/custom_components/doorking_1812ap/coordinator.py b/custom_components/doorking_1812ap/coordinator.py index dff1167..19dd27a 100644 --- a/custom_components/doorking_1812ap/coordinator.py +++ b/custom_components/doorking_1812ap/coordinator.py @@ -2,13 +2,12 @@ from __future__ import annotations -from datetime import timedelta from typing import TYPE_CHECKING, Any from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from .api import Doorking1812APApiClientError -from .const import DOMAIN, LOGGER +from .const import DOMAIN, LOGGER, SCAN_INTERVAL if TYPE_CHECKING: from homeassistant.core import HomeAssistant @@ -31,7 +30,7 @@ def __init__( hass=hass, logger=LOGGER, name=DOMAIN, - update_interval=timedelta(hours=1), + update_interval=SCAN_INTERVAL, ) async def _async_update_data(self) -> Any: diff --git a/custom_components/doorking_1812ap/entity.py b/custom_components/doorking_1812ap/entity.py index 0f8a119..d54487a 100644 --- a/custom_components/doorking_1812ap/entity.py +++ b/custom_components/doorking_1812ap/entity.py @@ -5,15 +5,12 @@ from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity -from .const import ATTRIBUTION from .coordinator import Doorking1812APDataUpdateCoordinator class Doorking1812APEntity(CoordinatorEntity[Doorking1812APDataUpdateCoordinator]): """BlueprintEntity class.""" - _attr_attribution = ATTRIBUTION - def __init__(self, coordinator: Doorking1812APDataUpdateCoordinator) -> None: """Initialize.""" super().__init__(coordinator) diff --git a/custom_components/doorking_1812ap/manifest.json b/custom_components/doorking_1812ap/manifest.json index c3b61ab..34eb9af 100644 --- a/custom_components/doorking_1812ap/manifest.json +++ b/custom_components/doorking_1812ap/manifest.json @@ -1,12 +1,11 @@ { "domain": "doorking_1812ap", "name": "Doorking 1812AP", - "integration_type": "device", "codeowners": ["@cameronr"], "config_flow": true, "documentation": "https://github.com/cameronr/doorking-ha", "iot_class": "local_polling", + "integration_type": "device", "issue_tracker": "https://github.com/cameronr/doorking-ha/issues", "version": "0.0.0" } -