DALY Modbus BMS: linting

This commit is contained in:
patagona 2024-10-02 02:50:00 +02:00
parent a93a48879a
commit a9343d35f1
2 changed files with 11 additions and 5 deletions

View file

@ -19,9 +19,15 @@ CONFIG_SCHEMA = cv.All(
cv.Schema( cv.Schema(
{ {
cv.GenerateID(CONF_DALY_HKMS_BMS_ID): cv.use_id(DalyHkmsBmsComponent), cv.GenerateID(CONF_DALY_HKMS_BMS_ID): cv.use_id(DalyHkmsBmsComponent),
cv.Optional(CONF_CHARGING_MOS_ENABLED): binary_sensor.binary_sensor_schema(), cv.Optional(
cv.Optional(CONF_DISCHARGING_MOS_ENABLED): binary_sensor.binary_sensor_schema(), CONF_CHARGING_MOS_ENABLED
cv.Optional(CONF_PRECHARGING_MOS_ENABLED): binary_sensor.binary_sensor_schema(), ): 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(), cv.Optional(CONF_BALANCING_ACTIVE): binary_sensor.binary_sensor_schema(),
} }
).extend(cv.COMPONENT_SCHEMA) ).extend(cv.COMPONENT_SCHEMA)

View file

@ -30,10 +30,10 @@ class DalyHkmsBmsComponent : public PollingComponent, public modbus::ModbusDevic
void set_daly_address(uint8_t address); void set_daly_address(uint8_t address);
#ifdef USE_SENSOR #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_) if (cell > this->cell_voltage_sensors_max_)
this->cell_voltage_sensors_max_ = cell; this->cell_voltage_sensors_max_ = cell;
this->cell_voltage_sensors_[cell - 1] = sensor; this->cell_voltage_sensors_[cell - 1] = sensor;
}; };
SUB_SENSOR(voltage) SUB_SENSOR(voltage)