added option to set polling interval

This commit is contained in:
Patrick762 committed 2023-08-26 14:44:03 +02:00
1 parent 6361e661c0
commit ed10127a90
6 files changed
+26 -7

No files matched your search

+13 -1
View File
@@ -17,7 +17,7 @@ from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import selector
from . import get_type_by_bt_name
from .const import DOMAIN, CONF_USE_CONTROLS
from .const import CONF_PERSISTANT_CONN, CONF_POLLING_INTERVAL, DOMAIN, CONF_USE_CONTROLS
_LOGGER = logging.getLogger(__name__)
@@ -114,6 +114,8 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
**self.config_entry.data,
**{
CONF_USE_CONTROLS: user_input[CONF_USE_CONTROLS],
CONF_PERSISTANT_CONN: user_input[CONF_PERSISTANT_CONN],
CONF_POLLING_INTERVAL: user_input[CONF_POLLING_INTERVAL],
},
},
)
@@ -126,6 +128,8 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
title="",
data={
CONF_USE_CONTROLS: user_input[CONF_USE_CONTROLS],
CONF_PERSISTANT_CONN: user_input[CONF_PERSISTANT_CONN],
CONF_POLLING_INTERVAL: user_input[CONF_POLLING_INTERVAL],
},
)
@@ -137,6 +141,14 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
CONF_USE_CONTROLS,
default=self.config_entry.data.get(CONF_USE_CONTROLS, False),
): selector.BooleanSelector(),
vol.Required(
CONF_PERSISTANT_CONN,
default=self.config_entry.data.get(CONF_PERSISTANT_CONN, False),
): selector.BooleanSelector(),
vol.Required(
CONF_POLLING_INTERVAL,
default=self.config_entry.data.get(CONF_POLLING_INTERVAL, 20),
): int,
}
),
)