From 4ba73f931570f8946b2c5955275721a37dba85d9 Mon Sep 17 00:00:00 2001 From: bullshit Date: Wed, 6 Aug 2025 20:43:38 +0200 Subject: [PATCH] chore: python whitespace linting issues Signed-off-by: bullshit --- components/nut_ups/binary_sensor.py | 7 +++---- components/nut_ups/sensor.py | 13 ++++++------- components/nut_ups/text_sensor.py | 3 +-- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/components/nut_ups/binary_sensor.py b/components/nut_ups/binary_sensor.py index dcb89ab..879c8f0 100644 --- a/components/nut_ups/binary_sensor.py +++ b/components/nut_ups/binary_sensor.py @@ -37,7 +37,6 @@ BINARY_SENSOR_TYPES = { }, } -CONF_NUT_UPS_ID = "nut_ups_id" CONFIG_SCHEMA = binary_sensor.binary_sensor_schema(NutUpsBinarySensor).extend( { @@ -51,15 +50,15 @@ async def to_code(config): parent = await cg.get_variable(config[CONF_NUT_UPS_ID]) var = await binary_sensor.new_binary_sensor(config) await cg.register_component(var, config) - + sensor_type = config[CONF_TYPE] cg.add(var.set_sensor_type(sensor_type)) cg.add(parent.register_binary_sensor(var, sensor_type)) - + # Apply sensor type specific configuration if sensor_type in BINARY_SENSOR_TYPES: sensor_config = BINARY_SENSOR_TYPES[sensor_type] - + # Override config with sensor type defaults if not specified if "device_class" not in config and "device_class" in sensor_config: cg.add(var.set_device_class(sensor_config["device_class"])) \ No newline at end of file diff --git a/components/nut_ups/sensor.py b/components/nut_ups/sensor.py index 7ed7a48..a4b0ca8 100644 --- a/components/nut_ups/sensor.py +++ b/components/nut_ups/sensor.py @@ -59,7 +59,6 @@ SENSOR_TYPES = { }, } -CONF_NUT_UPS_ID = "nut_ups_id" CONFIG_SCHEMA = sensor.sensor_schema( NutUpsSensor, @@ -76,24 +75,24 @@ async def to_code(config): parent = await cg.get_variable(config[CONF_NUT_UPS_ID]) var = await sensor.new_sensor(config) await cg.register_component(var, config) - + sensor_type = config[CONF_TYPE] cg.add(var.set_sensor_type(sensor_type)) cg.add(parent.register_sensor(var, sensor_type)) - + # Apply sensor type specific configuration if sensor_type in SENSOR_TYPES: sensor_config = SENSOR_TYPES[sensor_type] - + # Override config with sensor type defaults if not specified if "unit_of_measurement" not in config and "unit" in sensor_config: cg.add(var.set_unit_of_measurement(sensor_config["unit"])) - + if "device_class" not in config and "device_class" in sensor_config: cg.add(var.set_device_class(sensor_config["device_class"])) - + if "state_class" not in config and "state_class" in sensor_config: cg.add(var.set_state_class(sensor_config["state_class"])) - + if "accuracy_decimals" not in config and "accuracy_decimals" in sensor_config: cg.add(var.set_accuracy_decimals(sensor_config["accuracy_decimals"])) \ No newline at end of file diff --git a/components/nut_ups/text_sensor.py b/components/nut_ups/text_sensor.py index e08973f..3168d16 100644 --- a/components/nut_ups/text_sensor.py +++ b/components/nut_ups/text_sensor.py @@ -21,7 +21,6 @@ TEXT_SENSOR_TYPES = [ "firmware_version", ] -CONF_NUT_UPS_ID = "nut_ups_id" CONFIG_SCHEMA = text_sensor.text_sensor_schema(NutUpsTextSensor).extend( { @@ -35,7 +34,7 @@ async def to_code(config): parent = await cg.get_variable(config[CONF_NUT_UPS_ID]) var = await text_sensor.new_text_sensor(config) await cg.register_component(var, config) - + sensor_type = config[CONF_TYPE] cg.add(var.set_sensor_type(sensor_type)) cg.add(parent.register_text_sensor(var, sensor_type)) \ No newline at end of file