Skip to content

Commit

Permalink
fix: scan every 30 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronr committed Jul 28, 2024
1 parent 0934cfb commit 81db203
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
4 changes: 3 additions & 1 deletion custom_components/doorking_1812ap/const.py
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 2 additions & 3 deletions custom_components/doorking_1812ap/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
3 changes: 0 additions & 3 deletions custom_components/doorking_1812ap/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions custom_components/doorking_1812ap/manifest.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 81db203

Please sign in to comment.