From 1c64a88309b0cfdf83873f9171983bb0965b872b Mon Sep 17 00:00:00 2001 From: G Johansson Date: Thu, 3 Jul 2025 19:13:16 +0000 Subject: [PATCH] Fix strings --- .../components/compensation/config_flow.py | 19 ------------------- .../components/compensation/strings.json | 12 +++++------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/homeassistant/components/compensation/config_flow.py b/homeassistant/components/compensation/config_flow.py index 2aa7206ad24..577d9f15540 100644 --- a/homeassistant/components/compensation/config_flow.py +++ b/homeassistant/components/compensation/config_flow.py @@ -86,22 +86,6 @@ async def get_options_schema(handler: SchemaCommonFlowHandler) -> vol.Schema: ) -def _is_valid_data_points(check_data_points: list[str]) -> bool: - """Validate data points.""" - result = False - for data_point in check_data_points: - if not data_point.find(",") > 0: - return False - values = data_point.split(",", maxsplit=1) - for value in values: - try: - float(value) - except ValueError: - return False - result = True - return result - - async def validate_options( handler: SchemaCommonFlowHandler, user_input: dict[str, Any] ) -> dict[str, Any]: @@ -110,9 +94,6 @@ async def validate_options( user_input[CONF_PRECISION] = int(user_input[CONF_PRECISION]) user_input[CONF_DEGREE] = int(user_input[CONF_DEGREE]) - if not _is_valid_data_points(user_input[CONF_DATAPOINTS]): - raise SchemaFlowError("incorrect_datapoints") - if len(user_input[CONF_DATAPOINTS]) <= user_input[CONF_DEGREE]: raise SchemaFlowError("not_enough_datapoints") diff --git a/homeassistant/components/compensation/strings.json b/homeassistant/components/compensation/strings.json index 08d9452e50b..06f3c3bd7a6 100644 --- a/homeassistant/components/compensation/strings.json +++ b/homeassistant/components/compensation/strings.json @@ -4,7 +4,6 @@ "already_configured": "[%key:common::config_flow::abort::already_configured_device%]" }, "error": { - "incorrect_datapoints": "Datapoints needs to be provided in the right format, ex. '1.0, 0.0'.", "not_enough_datapoints": "The number of datapoints needs to be more than the configured degree." }, "step": { @@ -20,7 +19,7 @@ } }, "options": { - "description": "Read the documention for further details on how to configure the statistics sensor using these options.", + "description": "Read the documentation for further details on how to configure the statistics sensor using these options.", "data": { "data_points": "Data points", "attribute": "Attribute", @@ -31,10 +30,10 @@ "unit_of_measurement": "Unit of measurement" }, "data_description": { - "data_points": "Add a collection of data point conversions with uncompensated value and the compensated value. The number of required data point sets is equal to the polynomial degree + 1.", + "data_points": "Add a collection of data point conversions with the uncompensated value and the compensated value. The number of required data point sets is equal to the polynomial degree + 1.", "attribute": "Attribute from the source to monitor/compensate.", - "upper_limit": "Enables an upper limit for the sensor. The upper limit is defined by the data collections (data_points) greatest uncompensated value.", - "lower_limit": "Enables a lower limit for the sensor. The lower limit is defined by the data collections (data_points) lowest uncompensated value.", + "upper_limit": "Enables an upper limit for the sensor. The upper limit is defined by the data collection's (data_points) greatest uncompensated value.", + "lower_limit": "Enables a lower limit for the sensor. The lower limit is defined by the data collection's (data_points) lowest uncompensated value.", "precision": "Defines the precision of the calculated values, through the argument of round().", "degree": "The degree of a polynomial.", "unit_of_measurement": "Defines the units of measurement of the sensor, if any." @@ -47,7 +46,6 @@ "already_configured": "[%key:common::config_flow::abort::already_configured_account%]" }, "error": { - "incorrect_datapoints": "[%key:component::compensation::config::error::incorrect_datapoints%]", "not_enough_datapoints": "[%key:component::compensation::config::error::not_enough_datapoints%]" }, "step": { @@ -84,7 +82,7 @@ }, "exceptions": { "setup_error": { - "message": "Setup of {title} could not be setup due to {error}" + "message": "Setup of {title} could not be completed due to {error}" } } }