Skip to content

Commit

Permalink
Set the minimum connection lifetime to the integration update interva…
Browse files Browse the repository at this point in the history
…l of 15 seconds
  • Loading branch information
mill1000 committed Jan 27, 2025
1 parent 01ea9d8 commit 9db9600
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions custom_components/midea_ac/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
CONF_ENERGY_FORMAT, CONF_FAN_SPEED_STEP, CONF_KEY,
CONF_MAX_CONNECTION_LIFETIME, CONF_SHOW_ALL_PRESETS,
CONF_TEMP_STEP, CONF_USE_FAN_ONLY_WORKAROUND, DOMAIN,
EnergyFormat)
UPDATE_INTERVAL, EnergyFormat)

_DEFAULT_OPTIONS = {
CONF_BEEP: True,
Expand Down Expand Up @@ -283,7 +283,7 @@ async def async_step_init(self, user_input=None) -> FlowResult:
vol.Optional(CONF_ADDITIONAL_OPERATION_MODES,
description={"suggested_value": options.get(CONF_ADDITIONAL_OPERATION_MODES, None)}): cv.string,
vol.Optional(CONF_MAX_CONNECTION_LIFETIME,
description={"suggested_value": options.get(CONF_MAX_CONNECTION_LIFETIME, None)}): vol.All(vol.Coerce(int), vol.Range(min=30)),
description={"suggested_value": options.get(CONF_MAX_CONNECTION_LIFETIME, None)}): vol.All(vol.Coerce(int), vol.Range(min=UPDATE_INTERVAL)),
vol.Optional(CONF_ENERGY_FORMAT,
default=options.get(
CONF_ENERGY_FORMAT, EnergyFormat.DEFAULT)
Expand Down
1 change: 1 addition & 0 deletions custom_components/midea_ac/const.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from enum import StrEnum, auto

DOMAIN = "midea_ac"
UPDATE_INTERVAL = 15

CONF_KEY = "k1"
CONF_BEEP = "prompt_tone"
Expand Down
4 changes: 2 additions & 2 deletions custom_components/midea_ac/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
DataUpdateCoordinator)
from msmart.device import AirConditioner as AC

from .const import DOMAIN
from .const import DOMAIN, UPDATE_INTERVAL

_LOGGER = logging.getLogger(__name__)

Expand All @@ -22,7 +22,7 @@ def __init__(self, hass: HomeAssistant, device: AC) -> None:
hass,
_LOGGER,
name=DOMAIN,
update_interval=datetime.timedelta(seconds=15),
update_interval=datetime.timedelta(seconds=UPDATE_INTERVAL),
request_refresh_debouncer=Debouncer(
hass,
_LOGGER,
Expand Down

0 comments on commit 9db9600

Please sign in to comment.