Honeywell away temps (#54704)

This commit is contained in:
RDFurman 2022-03-24 19:17:36 -06:00 committed by GitHub
parent c5c34bc0d7
commit 34ace2e1cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 188 additions and 7 deletions

View file

@ -3,9 +3,16 @@ import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
from . import get_somecomfort_client
from .const import DOMAIN
from .const import (
CONF_COOL_AWAY_TEMPERATURE,
CONF_HEAT_AWAY_TEMPERATURE,
DEFAULT_COOL_AWAY_TEMPERATURE,
DEFAULT_HEAT_AWAY_TEMPERATURE,
DOMAIN,
)
class HoneywellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
@ -42,3 +49,42 @@ class HoneywellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
)
return client is not None
@staticmethod
@callback
def async_get_options_flow(config_entry):
"""Options callback for Honeywell."""
return HoneywellOptionsFlowHandler(config_entry)
class HoneywellOptionsFlowHandler(config_entries.OptionsFlow):
"""Config flow options for Honeywell."""
def __init__(self, entry: config_entries.ConfigEntry) -> None:
"""Initialize Honeywell options flow."""
self.config_entry = entry
async def async_step_init(self, user_input=None):
"""Manage the options."""
if user_input is not None:
return self.async_create_entry(title=DOMAIN, data=user_input)
return self.async_show_form(
step_id="init",
data_schema=vol.Schema(
{
vol.Required(
CONF_COOL_AWAY_TEMPERATURE,
default=self.config_entry.options.get(
CONF_COOL_AWAY_TEMPERATURE, DEFAULT_COOL_AWAY_TEMPERATURE
),
): int,
vol.Required(
CONF_HEAT_AWAY_TEMPERATURE,
default=self.config_entry.options.get(
CONF_HEAT_AWAY_TEMPERATURE, DEFAULT_HEAT_AWAY_TEMPERATURE
),
): int,
}
),
)