From 4840ff36b29139d4ddec047dcd70fa959f1247cb Mon Sep 17 00:00:00 2001 From: BottlecapDave Date: Sun, 2 Oct 2022 07:23:38 +0100 Subject: [PATCH] fix(binary-sensor): Fixed text of rolling_target to reflect behaviour --- README.md | 4 ++-- custom_components/octopus_energy/binary_sensor.py | 1 + custom_components/octopus_energy/config_flow.py | 1 + custom_components/octopus_energy/translations/en.json | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2b57593a..ec64a451 100644 --- a/README.md +++ b/README.md @@ -60,9 +60,9 @@ You may want your target rate sensors to turn on a period of time before the opt Depending on how you're going to use the sensor, you might want the best period to be found throughout the day so it's always applicable. For example, you might be using the sensor to turn on a washing machine which you might want to come on at the best time regardless of when you use the washing machine. -However, you might only want the target time to occur once a day so once the best time for that day has passed it won't turn on again. For example, you might be using the sensor to turn on something that isn't time critical and could wait till the next day like a charger. +However, you might also only want the target time to occur once a day so once the best time for that day has passed it won't turn on again. For example, you might be using the sensor to turn on something that isn't time critical and could wait till the next day like a charger. -This feature is toggled on/off by the `Limit to once a day` checkbox. +This feature is toggled on by the `Re-evaluate multiple times a day` checkbox. ### Gas Meters diff --git a/custom_components/octopus_energy/binary_sensor.py b/custom_components/octopus_energy/binary_sensor.py index 43f5062c..a5d4c60e 100644 --- a/custom_components/octopus_energy/binary_sensor.py +++ b/custom_components/octopus_energy/binary_sensor.py @@ -130,6 +130,7 @@ def is_on(self): if CONFIG_TARGET_END_TIME in self._config: end_time = self._config[CONFIG_TARGET_END_TIME] + # True by default for backwards compatibility is_rolling_target = True if CONFIG_TARGET_ROLLING_TARGET in self._config: is_rolling_target = self._config[CONFIG_TARGET_ROLLING_TARGET] diff --git a/custom_components/octopus_energy/config_flow.py b/custom_components/octopus_energy/config_flow.py index 23d34501..a45971dc 100644 --- a/custom_components/octopus_energy/config_flow.py +++ b/custom_components/octopus_energy/config_flow.py @@ -201,6 +201,7 @@ async def __async_setup_target_rate_schema(self, config, errors): if (CONFIG_TARGET_OFFSET in config): offset = config[CONFIG_TARGET_OFFSET] + # True by default for backwards compatibility is_rolling_target = True if (CONFIG_TARGET_ROLLING_TARGET in config): is_rolling_target = config[CONFIG_TARGET_ROLLING_TARGET] diff --git a/custom_components/octopus_energy/translations/en.json b/custom_components/octopus_energy/translations/en.json index e924cc36..61d473a7 100644 --- a/custom_components/octopus_energy/translations/en.json +++ b/custom_components/octopus_energy/translations/en.json @@ -20,7 +20,7 @@ "Start time": "The minimum time to start the device", "End time": "The maximum time to stop the device", "offset": "The offset to apply to the scheduled block to be considered active", - "rolling_target": "Limit to once a day" + "rolling_target": "Re-evaluate multiple times a day" } } }, @@ -54,7 +54,7 @@ "Start time": "The minimum time to start the device", "End time": "The maximum time to stop the device", "offset": "The offset to apply to the scheduled block to be considered active", - "rolling_target": "Limit to once a day" + "rolling_target": "Re-evaluate multiple times a day" } } },