diff --git a/custom_components/octopus_energy/config_flow.py b/custom_components/octopus_energy/config_flow.py index a45971dc..8a31f15e 100644 --- a/custom_components/octopus_energy/config_flow.py +++ b/custom_components/octopus_energy/config_flow.py @@ -205,6 +205,14 @@ async def __async_setup_target_rate_schema(self, config, errors): is_rolling_target = True if (CONFIG_TARGET_ROLLING_TARGET in config): is_rolling_target = config[CONFIG_TARGET_ROLLING_TARGET] + + start_time = None + if (CONFIG_TARGET_START_TIME in config): + start_time = config[CONFIG_TARGET_START_TIME] + + end_time = None + if (CONFIG_TARGET_END_TIME in config): + end_time = config[CONFIG_TARGET_END_TIME] return self.async_show_form( step_id="target_rate", @@ -213,8 +221,8 @@ async def __async_setup_target_rate_schema(self, config, errors): vol.Required(CONFIG_TARGET_MPAN, default=config[CONFIG_TARGET_MPAN]): vol.In( meters ), - vol.Optional(CONFIG_TARGET_START_TIME, default=config[CONFIG_TARGET_START_TIME]): str, - vol.Optional(CONFIG_TARGET_END_TIME, default=config[CONFIG_TARGET_END_TIME]): str, + vol.Optional(CONFIG_TARGET_START_TIME, default=start_time): str, + vol.Optional(CONFIG_TARGET_END_TIME, default=end_time): str, vol.Optional(CONFIG_TARGET_OFFSET, default=offset): str, vol.Optional(CONFIG_TARGET_ROLLING_TARGET, default=is_rolling_target): bool, }),