Public Access
chore: python whitespace linting issues
Signed-off-by: bullshit <coding@ow-software.pl>
This commit is contained in:
3 files changed
+10
-13
No files matched your search
@@ -37,7 +37,6 @@ BINARY_SENSOR_TYPES = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
CONF_NUT_UPS_ID = "nut_ups_id"
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = binary_sensor.binary_sensor_schema(NutUpsBinarySensor).extend(
|
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])
|
parent = await cg.get_variable(config[CONF_NUT_UPS_ID])
|
||||||
var = await binary_sensor.new_binary_sensor(config)
|
var = await binary_sensor.new_binary_sensor(config)
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
sensor_type = config[CONF_TYPE]
|
sensor_type = config[CONF_TYPE]
|
||||||
cg.add(var.set_sensor_type(sensor_type))
|
cg.add(var.set_sensor_type(sensor_type))
|
||||||
cg.add(parent.register_binary_sensor(var, sensor_type))
|
cg.add(parent.register_binary_sensor(var, sensor_type))
|
||||||
|
|
||||||
# Apply sensor type specific configuration
|
# Apply sensor type specific configuration
|
||||||
if sensor_type in BINARY_SENSOR_TYPES:
|
if sensor_type in BINARY_SENSOR_TYPES:
|
||||||
sensor_config = BINARY_SENSOR_TYPES[sensor_type]
|
sensor_config = BINARY_SENSOR_TYPES[sensor_type]
|
||||||
|
|
||||||
# Override config with sensor type defaults if not specified
|
# Override config with sensor type defaults if not specified
|
||||||
if "device_class" not in config and "device_class" in sensor_config:
|
if "device_class" not in config and "device_class" in sensor_config:
|
||||||
cg.add(var.set_device_class(sensor_config["device_class"]))
|
cg.add(var.set_device_class(sensor_config["device_class"]))
|
||||||
@@ -59,7 +59,6 @@ SENSOR_TYPES = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
CONF_NUT_UPS_ID = "nut_ups_id"
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = sensor.sensor_schema(
|
CONFIG_SCHEMA = sensor.sensor_schema(
|
||||||
NutUpsSensor,
|
NutUpsSensor,
|
||||||
@@ -76,24 +75,24 @@ async def to_code(config):
|
|||||||
parent = await cg.get_variable(config[CONF_NUT_UPS_ID])
|
parent = await cg.get_variable(config[CONF_NUT_UPS_ID])
|
||||||
var = await sensor.new_sensor(config)
|
var = await sensor.new_sensor(config)
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
sensor_type = config[CONF_TYPE]
|
sensor_type = config[CONF_TYPE]
|
||||||
cg.add(var.set_sensor_type(sensor_type))
|
cg.add(var.set_sensor_type(sensor_type))
|
||||||
cg.add(parent.register_sensor(var, sensor_type))
|
cg.add(parent.register_sensor(var, sensor_type))
|
||||||
|
|
||||||
# Apply sensor type specific configuration
|
# Apply sensor type specific configuration
|
||||||
if sensor_type in SENSOR_TYPES:
|
if sensor_type in SENSOR_TYPES:
|
||||||
sensor_config = SENSOR_TYPES[sensor_type]
|
sensor_config = SENSOR_TYPES[sensor_type]
|
||||||
|
|
||||||
# Override config with sensor type defaults if not specified
|
# Override config with sensor type defaults if not specified
|
||||||
if "unit_of_measurement" not in config and "unit" in sensor_config:
|
if "unit_of_measurement" not in config and "unit" in sensor_config:
|
||||||
cg.add(var.set_unit_of_measurement(sensor_config["unit"]))
|
cg.add(var.set_unit_of_measurement(sensor_config["unit"]))
|
||||||
|
|
||||||
if "device_class" not in config and "device_class" in sensor_config:
|
if "device_class" not in config and "device_class" in sensor_config:
|
||||||
cg.add(var.set_device_class(sensor_config["device_class"]))
|
cg.add(var.set_device_class(sensor_config["device_class"]))
|
||||||
|
|
||||||
if "state_class" not in config and "state_class" in sensor_config:
|
if "state_class" not in config and "state_class" in sensor_config:
|
||||||
cg.add(var.set_state_class(sensor_config["state_class"]))
|
cg.add(var.set_state_class(sensor_config["state_class"]))
|
||||||
|
|
||||||
if "accuracy_decimals" not in config and "accuracy_decimals" in sensor_config:
|
if "accuracy_decimals" not in config and "accuracy_decimals" in sensor_config:
|
||||||
cg.add(var.set_accuracy_decimals(sensor_config["accuracy_decimals"]))
|
cg.add(var.set_accuracy_decimals(sensor_config["accuracy_decimals"]))
|
||||||
@@ -21,7 +21,6 @@ TEXT_SENSOR_TYPES = [
|
|||||||
"firmware_version",
|
"firmware_version",
|
||||||
]
|
]
|
||||||
|
|
||||||
CONF_NUT_UPS_ID = "nut_ups_id"
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = text_sensor.text_sensor_schema(NutUpsTextSensor).extend(
|
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])
|
parent = await cg.get_variable(config[CONF_NUT_UPS_ID])
|
||||||
var = await text_sensor.new_text_sensor(config)
|
var = await text_sensor.new_text_sensor(config)
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
sensor_type = config[CONF_TYPE]
|
sensor_type = config[CONF_TYPE]
|
||||||
cg.add(var.set_sensor_type(sensor_type))
|
cg.add(var.set_sensor_type(sensor_type))
|
||||||
cg.add(parent.register_text_sensor(var, sensor_type))
|
cg.add(parent.register_text_sensor(var, sensor_type))
|
||||||
Reference in new issue
Block a user