From a9343d35f18f543db139fbb60448cc8559c3d3aa Mon Sep 17 00:00:00 2001 From: patagona Date: Wed, 2 Oct 2024 02:50:00 +0200 Subject: [PATCH] DALY Modbus BMS: linting --- esphome/components/daly_hkms_bms/binary_sensor.py | 12 +++++++++--- esphome/components/daly_hkms_bms/daly_hkms_bms.h | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/esphome/components/daly_hkms_bms/binary_sensor.py b/esphome/components/daly_hkms_bms/binary_sensor.py index f2bcd23f0b..3dda55e418 100644 --- a/esphome/components/daly_hkms_bms/binary_sensor.py +++ b/esphome/components/daly_hkms_bms/binary_sensor.py @@ -19,9 +19,15 @@ CONFIG_SCHEMA = cv.All( cv.Schema( { cv.GenerateID(CONF_DALY_HKMS_BMS_ID): cv.use_id(DalyHkmsBmsComponent), - cv.Optional(CONF_CHARGING_MOS_ENABLED): binary_sensor.binary_sensor_schema(), - cv.Optional(CONF_DISCHARGING_MOS_ENABLED): binary_sensor.binary_sensor_schema(), - cv.Optional(CONF_PRECHARGING_MOS_ENABLED): binary_sensor.binary_sensor_schema(), + cv.Optional( + CONF_CHARGING_MOS_ENABLED + ): binary_sensor.binary_sensor_schema(), + cv.Optional( + CONF_DISCHARGING_MOS_ENABLED + ): binary_sensor.binary_sensor_schema(), + cv.Optional( + CONF_PRECHARGING_MOS_ENABLED + ): binary_sensor.binary_sensor_schema(), cv.Optional(CONF_BALANCING_ACTIVE): binary_sensor.binary_sensor_schema(), } ).extend(cv.COMPONENT_SCHEMA) diff --git a/esphome/components/daly_hkms_bms/daly_hkms_bms.h b/esphome/components/daly_hkms_bms/daly_hkms_bms.h index aca121f488..8b6c151615 100644 --- a/esphome/components/daly_hkms_bms/daly_hkms_bms.h +++ b/esphome/components/daly_hkms_bms/daly_hkms_bms.h @@ -30,10 +30,10 @@ class DalyHkmsBmsComponent : public PollingComponent, public modbus::ModbusDevic void set_daly_address(uint8_t address); #ifdef USE_SENSOR - void set_cell_voltage_sensor(size_t cell, sensor::Sensor *sensor) { + void set_cell_voltage_sensor(size_t cell, sensor::Sensor *sensor) { if (cell > this->cell_voltage_sensors_max_) this->cell_voltage_sensors_max_ = cell; - this->cell_voltage_sensors_[cell - 1] = sensor; + this->cell_voltage_sensors_[cell - 1] = sensor; }; SUB_SENSOR(voltage)