Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions homeassistant/components/decora_wifi/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from datetime import timedelta
import logging
from typing import Any

Expand All @@ -25,6 +26,7 @@
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.util import Throttle

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -167,6 +169,7 @@ def turn_off(self, **kwargs: Any) -> None:
except ValueError:
_LOGGER.error("Failed to turn off myLeviton switch")

@Throttle(timedelta(seconds=30))
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider defining the throttle interval as a module-level constant for better maintainability and consistency with other integrations. This makes the interval easier to find and adjust if needed.

MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)

# Then use it in the decorator:
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self) -> None:

This pattern is used by most other integrations using the @Throttle decorator (e.g., arest, bbox, dovado, etc.).

Copilot uses AI. Check for mistakes.
def update(self) -> None:
"""Fetch new state data for this switch."""
try:
Expand Down
Loading