Mark user-configurable classes as final (part 9/21)

Add the C++ `final` specifier to leaf, user-configurable component classes and
automation action/trigger/condition primitives so that classes meant to be
terminal cannot be subclassed by external components. Only classes never used as
a base anywhere in the tree are marked. Part 9 of 21, split alphabetically by
component (internal_temperature .. m5stack_8angle).
This commit is contained in:
Jesse Hills
2026-06-15 13:20:17 +12:00
parent a25ac28ae5
commit 00a41e2093
78 changed files with 117 additions and 117 deletions

View File

@@ -11,7 +11,7 @@
namespace esphome::internal_temperature {
class InternalTemperatureSensor : public sensor::Sensor, public PollingComponent {
class InternalTemperatureSensor final : public sensor::Sensor, public PollingComponent {
public:
#if defined(USE_ESP32) || (defined(USE_ZEPHYR) && defined(USE_NRF52))
void setup() override;

View File

@@ -6,7 +6,7 @@
namespace esphome::interval {
class IntervalTrigger : public Trigger<>, public PollingComponent {
class IntervalTrigger final : public Trigger<>, public PollingComponent {
public:
void update() override { this->trigger(); }

View File

@@ -18,7 +18,7 @@ namespace esphome::ir_rf_proxy {
#ifdef USE_IR_RF
/// IrRfProxy - Infrared platform implementation using remote_transmitter/receiver as backend
class IrRfProxy : public infrared::Infrared {
class IrRfProxy final : public infrared::Infrared {
public:
IrRfProxy() = default;
@@ -47,7 +47,7 @@ class IrRfProxy : public infrared::Infrared {
/// Driver-agnostic: integration with specific RF front-end chips (CC1101, RFM69, etc.) is done
/// in YAML by wiring their actions to `remote_transmitter`'s on_transmit/on_complete triggers and
/// to this entity's on_control trigger (see radio_frequency component docs).
class RfProxy : public radio_frequency::RadioFrequency {
class RfProxy final : public radio_frequency::RadioFrequency {
public:
RfProxy() = default;

View File

@@ -13,7 +13,7 @@ enum Model {
AJ_SR04M,
};
class Jsnsr04tComponent : public sensor::Sensor, public PollingComponent, public uart::UARTDevice {
class Jsnsr04tComponent final : public sensor::Sensor, public PollingComponent, public uart::UARTDevice {
public:
void set_model(Model model) { this->model_ = model; }

View File

@@ -73,7 +73,7 @@ static const char *const UNITS[] = {
"mm:dd", "", "bar", "RTC", "ASCII", "m3 x 10", "ton x 10", "GJ x 10", "minutes", "Bitfield",
"s", "ms", "days", "RTC-Q", "Datetime"};
class KamstrupKMPComponent : public PollingComponent, public uart::UARTDevice {
class KamstrupKMPComponent final : public PollingComponent, public uart::UARTDevice {
public:
void set_heat_energy_sensor(sensor::Sensor *sensor) { this->heat_energy_sensor_ = sensor; }
void set_power_sensor(sensor::Sensor *sensor) { this->power_sensor_ = sensor; }

View File

@@ -7,7 +7,7 @@
namespace esphome::key_collector {
class KeyCollector : public Component {
class KeyCollector final : public Component {
public:
void loop() override;
void dump_config() override;
@@ -54,11 +54,11 @@ class KeyCollector : public Component {
bool enabled_{};
};
template<typename... Ts> class EnableAction : public Action<Ts...>, public Parented<KeyCollector> {
template<typename... Ts> class EnableAction final : public Action<Ts...>, public Parented<KeyCollector> {
void play(const Ts &...x) override { this->parent_->set_enabled(true); }
};
template<typename... Ts> class DisableAction : public Action<Ts...>, public Parented<KeyCollector> {
template<typename... Ts> class DisableAction final : public Action<Ts...>, public Parented<KeyCollector> {
void play(const Ts &...x) override { this->parent_->set_enabled(false); }
};

View File

@@ -8,7 +8,7 @@
namespace esphome::kmeteriso {
/// This class implements support for the KMeterISO thermocouple sensor.
class KMeterISOComponent : public PollingComponent, public i2c::I2CDevice {
class KMeterISOComponent final : public PollingComponent, public i2c::I2CDevice {
public:
void set_temperature_sensor(sensor::Sensor *t) { this->temperature_sensor_ = t; }
void set_internal_temperature_sensor(sensor::Sensor *t) { this->internal_temperature_sensor_ = t; }

View File

@@ -6,7 +6,7 @@
namespace esphome::kuntze {
class Kuntze : public PollingComponent, public modbus::ModbusDevice {
class Kuntze final : public PollingComponent, public modbus::ModbusDevice {
public:
void set_ph_sensor(sensor::Sensor *ph_sensor) { ph_sensor_ = ph_sensor; }
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }

View File

@@ -19,7 +19,7 @@ enum LC709203FBatteryVoltage {
LC709203F_BATTERY_VOLTAGE_3_7 = 0x0001,
};
class Lc709203f : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
class Lc709203f final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
public:
void setup() override;
void update() override;

View File

@@ -10,7 +10,7 @@ class GPIOLCDDisplay;
using gpio_lcd_writer_t = display::DisplayWriter<GPIOLCDDisplay>;
class GPIOLCDDisplay : public lcd_base::LCDDisplay {
class GPIOLCDDisplay final : public lcd_base::LCDDisplay {
public:
void set_writer(gpio_lcd_writer_t &&writer) { this->writer_ = std::move(writer); }
void setup() override;

View File

@@ -11,7 +11,7 @@ namespace esphome::lcd_menu {
/** Class to display a hierarchical menu.
*
*/
class LCDCharacterMenuComponent : public display_menu_base::DisplayMenuComponent {
class LCDCharacterMenuComponent final : public display_menu_base::DisplayMenuComponent {
public:
void set_display(lcd_base::LCDDisplay *display) { this->display_ = display; }
void set_dimensions(uint8_t columns, uint8_t rows) {

View File

@@ -11,7 +11,7 @@ class PCF8574LCDDisplay;
using pcf8574_lcd_writer_t = display::DisplayWriter<PCF8574LCDDisplay>;
class PCF8574LCDDisplay : public lcd_base::LCDDisplay, public i2c::I2CDevice {
class PCF8574LCDDisplay final : public lcd_base::LCDDisplay, public i2c::I2CDevice {
public:
void set_writer(pcf8574_lcd_writer_t &&writer) { this->writer_ = std::move(writer); }
void setup() override;

View File

@@ -6,7 +6,7 @@
namespace esphome::ld2410 {
template<typename... Ts> class BluetoothPasswordSetAction : public Action<Ts...> {
template<typename... Ts> class BluetoothPasswordSetAction final : public Action<Ts...> {
public:
explicit BluetoothPasswordSetAction(LD2410Component *ld2410_comp) : ld2410_comp_(ld2410_comp) {}
TEMPLATABLE_VALUE(std::string, password)

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class FactoryResetButton : public button::Button, public Parented<LD2410Component> {
class FactoryResetButton final : public button::Button, public Parented<LD2410Component> {
public:
FactoryResetButton() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class QueryButton : public button::Button, public Parented<LD2410Component> {
class QueryButton final : public button::Button, public Parented<LD2410Component> {
public:
QueryButton() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class RestartButton : public button::Button, public Parented<LD2410Component> {
class RestartButton final : public button::Button, public Parented<LD2410Component> {
public:
RestartButton() = default;

View File

@@ -38,7 +38,7 @@ using namespace ld24xx;
static constexpr uint8_t MAX_LINE_LENGTH = 50;
static constexpr uint8_t TOTAL_GATES = 9; // Total number of gates supported by the LD2410
class LD2410Component : public Component, public uart::UARTDevice {
class LD2410Component final : public Component, public uart::UARTDevice {
#ifdef USE_BINARY_SENSOR
SUB_BINARY_SENSOR(out_pin_presence_status)
SUB_BINARY_SENSOR(moving_target)

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class GateThresholdNumber : public number::Number, public Parented<LD2410Component> {
class GateThresholdNumber final : public number::Number, public Parented<LD2410Component> {
public:
GateThresholdNumber(uint8_t gate);

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class LightThresholdNumber : public number::Number, public Parented<LD2410Component> {
class LightThresholdNumber final : public number::Number, public Parented<LD2410Component> {
public:
LightThresholdNumber() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class MaxDistanceTimeoutNumber : public number::Number, public Parented<LD2410Component> {
class MaxDistanceTimeoutNumber final : public number::Number, public Parented<LD2410Component> {
public:
MaxDistanceTimeoutNumber() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class BaudRateSelect : public select::Select, public Parented<LD2410Component> {
class BaudRateSelect final : public select::Select, public Parented<LD2410Component> {
public:
BaudRateSelect() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class DistanceResolutionSelect : public select::Select, public Parented<LD2410Component> {
class DistanceResolutionSelect final : public select::Select, public Parented<LD2410Component> {
public:
DistanceResolutionSelect() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class LightOutControlSelect : public select::Select, public Parented<LD2410Component> {
class LightOutControlSelect final : public select::Select, public Parented<LD2410Component> {
public:
LightOutControlSelect() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class BluetoothSwitch : public switch_::Switch, public Parented<LD2410Component> {
class BluetoothSwitch final : public switch_::Switch, public Parented<LD2410Component> {
public:
BluetoothSwitch() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2410 {
class EngineeringModeSwitch : public switch_::Switch, public Parented<LD2410Component> {
class EngineeringModeSwitch final : public switch_::Switch, public Parented<LD2410Component> {
public:
EngineeringModeSwitch() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class FactoryResetButton : public button::Button, public Parented<LD2412Component> {
class FactoryResetButton final : public button::Button, public Parented<LD2412Component> {
public:
FactoryResetButton() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class QueryButton : public button::Button, public Parented<LD2412Component> {
class QueryButton final : public button::Button, public Parented<LD2412Component> {
public:
QueryButton() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class RestartButton : public button::Button, public Parented<LD2412Component> {
class RestartButton final : public button::Button, public Parented<LD2412Component> {
public:
RestartButton() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class StartDynamicBackgroundCorrectionButton : public button::Button, public Parented<LD2412Component> {
class StartDynamicBackgroundCorrectionButton final : public button::Button, public Parented<LD2412Component> {
public:
StartDynamicBackgroundCorrectionButton() = default;

View File

@@ -36,7 +36,7 @@ using namespace ld24xx;
static constexpr uint8_t MAX_LINE_LENGTH = 54; // Max characters for serial buffer
static constexpr uint8_t TOTAL_GATES = 14; // Total number of gates supported by the LD2412
class LD2412Component : public Component, public uart::UARTDevice {
class LD2412Component final : public Component, public uart::UARTDevice {
#ifdef USE_BINARY_SENSOR
SUB_BINARY_SENSOR(dynamic_background_correction_status)
SUB_BINARY_SENSOR(moving_target)

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class GateThresholdNumber : public number::Number, public Parented<LD2412Component> {
class GateThresholdNumber final : public number::Number, public Parented<LD2412Component> {
public:
GateThresholdNumber(uint8_t gate);

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class LightThresholdNumber : public number::Number, public Parented<LD2412Component> {
class LightThresholdNumber final : public number::Number, public Parented<LD2412Component> {
public:
LightThresholdNumber() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class MaxDistanceTimeoutNumber : public number::Number, public Parented<LD2412Component> {
class MaxDistanceTimeoutNumber final : public number::Number, public Parented<LD2412Component> {
public:
MaxDistanceTimeoutNumber() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class BaudRateSelect : public select::Select, public Parented<LD2412Component> {
class BaudRateSelect final : public select::Select, public Parented<LD2412Component> {
public:
BaudRateSelect() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class DistanceResolutionSelect : public select::Select, public Parented<LD2412Component> {
class DistanceResolutionSelect final : public select::Select, public Parented<LD2412Component> {
public:
DistanceResolutionSelect() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class LightOutControlSelect : public select::Select, public Parented<LD2412Component> {
class LightOutControlSelect final : public select::Select, public Parented<LD2412Component> {
public:
LightOutControlSelect() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class BluetoothSwitch : public switch_::Switch, public Parented<LD2412Component> {
class BluetoothSwitch final : public switch_::Switch, public Parented<LD2412Component> {
public:
BluetoothSwitch() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2412 {
class EngineeringModeSwitch : public switch_::Switch, public Parented<LD2412Component> {
class EngineeringModeSwitch final : public switch_::Switch, public Parented<LD2412Component> {
public:
EngineeringModeSwitch() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2420 {
class LD2420BinarySensor : public LD2420Listener, public Component, binary_sensor::BinarySensor {
class LD2420BinarySensor final : public LD2420Listener, public Component, binary_sensor::BinarySensor {
public:
void dump_config() override;
void set_presence_sensor(binary_sensor::BinarySensor *bsensor) { this->presence_bsensor_ = bsensor; };

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2420 {
class LD2420ApplyConfigButton : public button::Button, public Parented<LD2420Component> {
class LD2420ApplyConfigButton final : public button::Button, public Parented<LD2420Component> {
public:
LD2420ApplyConfigButton() = default;
@@ -13,7 +13,7 @@ class LD2420ApplyConfigButton : public button::Button, public Parented<LD2420Com
void press_action() override;
};
class LD2420RevertConfigButton : public button::Button, public Parented<LD2420Component> {
class LD2420RevertConfigButton final : public button::Button, public Parented<LD2420Component> {
public:
LD2420RevertConfigButton() = default;
@@ -21,7 +21,7 @@ class LD2420RevertConfigButton : public button::Button, public Parented<LD2420Co
void press_action() override;
};
class LD2420RestartModuleButton : public button::Button, public Parented<LD2420Component> {
class LD2420RestartModuleButton final : public button::Button, public Parented<LD2420Component> {
public:
LD2420RestartModuleButton() = default;
@@ -29,7 +29,7 @@ class LD2420RestartModuleButton : public button::Button, public Parented<LD2420C
void press_action() override;
};
class LD2420FactoryResetButton : public button::Button, public Parented<LD2420Component> {
class LD2420FactoryResetButton final : public button::Button, public Parented<LD2420Component> {
public:
LD2420FactoryResetButton() = default;

View File

@@ -40,7 +40,7 @@ class LD2420Listener {
virtual void on_fw_version(std::string &fw){};
};
class LD2420Component : public Component, public uart::UARTDevice {
class LD2420Component final : public Component, public uart::UARTDevice {
public:
struct CmdFrameT {
uint32_t header{0};

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2420 {
class LD2420TimeoutNumber : public number::Number, public Parented<LD2420Component> {
class LD2420TimeoutNumber final : public number::Number, public Parented<LD2420Component> {
public:
LD2420TimeoutNumber() = default;
@@ -13,7 +13,7 @@ class LD2420TimeoutNumber : public number::Number, public Parented<LD2420Compone
void control(float timeout) override;
};
class LD2420MinDistanceNumber : public number::Number, public Parented<LD2420Component> {
class LD2420MinDistanceNumber final : public number::Number, public Parented<LD2420Component> {
public:
LD2420MinDistanceNumber() = default;
@@ -21,7 +21,7 @@ class LD2420MinDistanceNumber : public number::Number, public Parented<LD2420Com
void control(float min_gate) override;
};
class LD2420MaxDistanceNumber : public number::Number, public Parented<LD2420Component> {
class LD2420MaxDistanceNumber final : public number::Number, public Parented<LD2420Component> {
public:
LD2420MaxDistanceNumber() = default;
@@ -29,7 +29,7 @@ class LD2420MaxDistanceNumber : public number::Number, public Parented<LD2420Com
void control(float max_gate) override;
};
class LD2420GateSelectNumber : public number::Number, public Parented<LD2420Component> {
class LD2420GateSelectNumber final : public number::Number, public Parented<LD2420Component> {
public:
LD2420GateSelectNumber() = default;
@@ -37,7 +37,7 @@ class LD2420GateSelectNumber : public number::Number, public Parented<LD2420Comp
void control(float gate_select) override;
};
class LD2420MoveSensFactorNumber : public number::Number, public Parented<LD2420Component> {
class LD2420MoveSensFactorNumber final : public number::Number, public Parented<LD2420Component> {
public:
LD2420MoveSensFactorNumber() = default;
@@ -45,7 +45,7 @@ class LD2420MoveSensFactorNumber : public number::Number, public Parented<LD2420
void control(float move_factor) override;
};
class LD2420StillSensFactorNumber : public number::Number, public Parented<LD2420Component> {
class LD2420StillSensFactorNumber final : public number::Number, public Parented<LD2420Component> {
public:
LD2420StillSensFactorNumber() = default;
@@ -53,7 +53,7 @@ class LD2420StillSensFactorNumber : public number::Number, public Parented<LD242
void control(float still_factor) override;
};
class LD2420StillThresholdNumbers : public number::Number, public Parented<LD2420Component> {
class LD2420StillThresholdNumbers final : public number::Number, public Parented<LD2420Component> {
public:
LD2420StillThresholdNumbers() = default;
LD2420StillThresholdNumbers(uint8_t gate);
@@ -63,7 +63,7 @@ class LD2420StillThresholdNumbers : public number::Number, public Parented<LD242
void control(float still_threshold) override;
};
class LD2420MoveThresholdNumbers : public number::Number, public Parented<LD2420Component> {
class LD2420MoveThresholdNumbers final : public number::Number, public Parented<LD2420Component> {
public:
LD2420MoveThresholdNumbers() = default;
LD2420MoveThresholdNumbers(uint8_t gate);

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2420 {
class LD2420Select : public Component, public select::Select, public Parented<LD2420Component> {
class LD2420Select final : public Component, public select::Select, public Parented<LD2420Component> {
public:
LD2420Select() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2420 {
class LD2420Sensor : public LD2420Listener, public Component, sensor::Sensor {
class LD2420Sensor final : public LD2420Listener, public Component, sensor::Sensor {
public:
void dump_config() override;
void set_distance_sensor(sensor::Sensor *sensor) { this->distance_sensor_ = sensor; }

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2420 {
class LD2420TextSensor : public LD2420Listener, public Component, text_sensor::TextSensor {
class LD2420TextSensor final : public LD2420Listener, public Component, text_sensor::TextSensor {
public:
void dump_config() override;
void set_fw_version_text_sensor(text_sensor::TextSensor *tsensor) { this->fw_version_text_sensor_ = tsensor; };

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2450 {
class FactoryResetButton : public button::Button, public Parented<LD2450Component> {
class FactoryResetButton final : public button::Button, public Parented<LD2450Component> {
public:
FactoryResetButton() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2450 {
class RestartButton : public button::Button, public Parented<LD2450Component> {
class RestartButton final : public button::Button, public Parented<LD2450Component> {
public:
RestartButton() = default;

View File

@@ -75,7 +75,7 @@ struct ZoneOfNumbers {
};
#endif
class LD2450Component : public Component, public uart::UARTDevice {
class LD2450Component final : public Component, public uart::UARTDevice {
#ifdef USE_BINARY_SENSOR
SUB_BINARY_SENSOR(moving_target)
SUB_BINARY_SENSOR(still_target)

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2450 {
class PresenceTimeoutNumber : public number::Number, public Parented<LD2450Component> {
class PresenceTimeoutNumber final : public number::Number, public Parented<LD2450Component> {
public:
PresenceTimeoutNumber() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2450 {
class ZoneCoordinateNumber : public number::Number, public Parented<LD2450Component> {
class ZoneCoordinateNumber final : public number::Number, public Parented<LD2450Component> {
public:
ZoneCoordinateNumber(uint8_t zone);

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2450 {
class BaudRateSelect : public select::Select, public Parented<LD2450Component> {
class BaudRateSelect final : public select::Select, public Parented<LD2450Component> {
public:
BaudRateSelect() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2450 {
class ZoneTypeSelect : public select::Select, public Parented<LD2450Component> {
class ZoneTypeSelect final : public select::Select, public Parented<LD2450Component> {
public:
ZoneTypeSelect() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2450 {
class BluetoothSwitch : public switch_::Switch, public Parented<LD2450Component> {
class BluetoothSwitch final : public switch_::Switch, public Parented<LD2450Component> {
public:
BluetoothSwitch() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::ld2450 {
class MultiTargetSwitch : public switch_::Switch, public Parented<LD2450Component> {
class MultiTargetSwitch final : public switch_::Switch, public Parented<LD2450Component> {
public:
MultiTargetSwitch() = default;

View File

@@ -13,7 +13,7 @@ namespace esphome::ledc {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
extern uint8_t next_ledc_channel;
class LEDCOutput : public output::FloatOutput, public Component {
class LEDCOutput final : public output::FloatOutput, public Component {
public:
explicit LEDCOutput(InternalGPIOPin *pin) : pin_(pin) { this->channel_ = next_ledc_channel++; }
@@ -43,7 +43,7 @@ class LEDCOutput : public output::FloatOutput, public Component {
bool initialized_ = false;
};
template<typename... Ts> class SetFrequencyAction : public Action<Ts...> {
template<typename... Ts> class SetFrequencyAction final : public Action<Ts...> {
public:
SetFrequencyAction(LEDCOutput *parent) : parent_(parent) {}
TEMPLATABLE_VALUE(float, frequency);

View File

@@ -5,7 +5,7 @@
namespace esphome::libretiny {
class ArduinoInternalGPIOPin : public InternalGPIOPin {
class ArduinoInternalGPIOPin final : public InternalGPIOPin {
public:
void set_pin(uint8_t pin) { pin_ = pin; }
void set_inverted(bool inverted) { inverted_ = inverted; }

View File

@@ -14,7 +14,7 @@
namespace esphome::libretiny {
class LTComponent : public Component {
class LTComponent final : public Component {
public:
float get_setup_priority() const override;
void dump_config() override;

View File

@@ -9,7 +9,7 @@
namespace esphome::libretiny_pwm {
class LibreTinyPWM : public output::FloatOutput, public Component {
class LibreTinyPWM final : public output::FloatOutput, public Component {
public:
explicit LibreTinyPWM(InternalGPIOPin *pin) : pin_(pin) {}
@@ -34,7 +34,7 @@ class LibreTinyPWM : public output::FloatOutput, public Component {
bool initialized_ = false;
};
template<typename... Ts> class SetFrequencyAction : public Action<Ts...> {
template<typename... Ts> class SetFrequencyAction final : public Action<Ts...> {
public:
SetFrequencyAction(LibreTinyPWM *parent) : parent_(parent) {}
TEMPLATABLE_VALUE(float, frequency);

View File

@@ -21,7 +21,7 @@ Color color_from_light_color_values(LightColorValues val);
/// Use a custom state class for addressable lights, to allow type system to discriminate between addressable and
/// non-addressable lights.
class AddressableLightState : public LightState {
class AddressableLightState final : public LightState {
using LightState::LightState;
};

View File

@@ -8,7 +8,7 @@ namespace esphome::light {
enum class LimitMode { CLAMP, DO_NOTHING };
template<bool HasTransitionLength, typename... Ts> class ToggleAction : public Action<Ts...> {
template<bool HasTransitionLength, typename... Ts> class ToggleAction final : public Action<Ts...> {
public:
explicit ToggleAction(LightState *state) : state_(state) {}
@@ -43,7 +43,7 @@ template<bool HasTransitionLength, typename... Ts> class ToggleAction : public A
// (e.g. `const T & &` if Ts already carries a reference, or `const const
// T &` if Ts already carries a const). This keeps trigger args no-copy
// regardless of whether the trigger supplies `T`, `T &`, or `const T &`.
template<typename... Ts> class LightControlAction : public Action<Ts...> {
template<typename... Ts> class LightControlAction final : public Action<Ts...> {
public:
using ApplyFn = void (*)(LightState *, LightCall &, const std::remove_cvref_t<Ts> &...);
LightControlAction(LightState *parent, ApplyFn apply) : parent_(parent), apply_(apply) {}
@@ -59,7 +59,7 @@ template<typename... Ts> class LightControlAction : public Action<Ts...> {
ApplyFn apply_;
};
template<bool HasTransitionLength, typename... Ts> class DimRelativeAction : public Action<Ts...> {
template<bool HasTransitionLength, typename... Ts> class DimRelativeAction final : public Action<Ts...> {
public:
explicit DimRelativeAction(LightState *parent) : parent_(parent) {}
@@ -108,7 +108,7 @@ template<bool HasTransitionLength, typename... Ts> class DimRelativeAction : pub
// at compile time so the chosen branch is the only one that gets instantiated
// per action site. `include_none` is runtime so a single set of templates
// covers both the "wrap through None" and "skip None" variants.
template<bool Forward, typename... Ts> class LightEffectCycleAction : public Action<Ts...> {
template<bool Forward, typename... Ts> class LightEffectCycleAction final : public Action<Ts...> {
public:
explicit LightEffectCycleAction(LightState *parent) : parent_(parent) {}
@@ -145,7 +145,7 @@ template<bool Forward, typename... Ts> class LightEffectCycleAction : public Act
bool include_none_{false};
};
template<typename... Ts> class LightIsOnCondition : public Condition<Ts...> {
template<typename... Ts> class LightIsOnCondition final : public Condition<Ts...> {
public:
explicit LightIsOnCondition(LightState *state) : state_(state) {}
bool check(const Ts &...x) override { return this->state_->current_values.is_on(); }
@@ -153,7 +153,7 @@ template<typename... Ts> class LightIsOnCondition : public Condition<Ts...> {
protected:
LightState *state_;
};
template<typename... Ts> class LightIsOffCondition : public Condition<Ts...> {
template<typename... Ts> class LightIsOffCondition final : public Condition<Ts...> {
public:
explicit LightIsOffCondition(LightState *state) : state_(state) {}
bool check(const Ts &...x) override { return !this->state_->current_values.is_on(); }
@@ -162,7 +162,7 @@ template<typename... Ts> class LightIsOffCondition : public Condition<Ts...> {
LightState *state_;
};
class LightTurnOnTrigger : public Trigger<>, public LightRemoteValuesListener {
class LightTurnOnTrigger final : public Trigger<>, public LightRemoteValuesListener {
public:
explicit LightTurnOnTrigger(LightState *a_light) : light_(a_light) {
a_light->add_remote_values_listener(this);
@@ -187,7 +187,7 @@ class LightTurnOnTrigger : public Trigger<>, public LightRemoteValuesListener {
bool last_on_;
};
class LightTurnOffTrigger : public Trigger<>, public LightTargetStateReachedListener {
class LightTurnOffTrigger final : public Trigger<>, public LightTargetStateReachedListener {
public:
explicit LightTurnOffTrigger(LightState *a_light) : light_(a_light) {
a_light->add_target_state_reached_listener(this);
@@ -205,7 +205,7 @@ class LightTurnOffTrigger : public Trigger<>, public LightTargetStateReachedList
LightState *light_;
};
class LightStateTrigger : public Trigger<>, public LightRemoteValuesListener {
class LightStateTrigger final : public Trigger<>, public LightRemoteValuesListener {
public:
explicit LightStateTrigger(LightState *a_light) { a_light->add_remote_values_listener(this); }
@@ -216,7 +216,7 @@ class LightStateTrigger : public Trigger<>, public LightRemoteValuesListener {
// due to the template. It's just a temporary warning anyway.
void addressableset_warn_about_scale(const char *field);
template<typename... Ts> class AddressableSet : public Action<Ts...> {
template<typename... Ts> class AddressableSet final : public Action<Ts...> {
public:
explicit AddressableSet(LightState *parent) : parent_(parent) {}

View File

@@ -15,7 +15,7 @@ namespace esphome::lightwaverf {
#ifdef USE_ESP8266
class LightWaveRF : public PollingComponent {
class LightWaveRF final : public PollingComponent {
public:
void set_pin(InternalGPIOPin *pin_tx, InternalGPIOPin *pin_rx) {
pin_tx_ = pin_tx;
@@ -37,7 +37,7 @@ class LightWaveRF : public PollingComponent {
LwTx lwtx_;
};
template<typename... Ts> class SendRawAction : public Action<Ts...> {
template<typename... Ts> class SendRawAction final : public Action<Ts...> {
public:
SendRawAction(LightWaveRF *parent) : parent_(parent){};
TEMPLATABLE_VALUE(int, repeat);

View File

@@ -12,7 +12,7 @@ namespace esphome::lilygo_t5_47 {
using namespace touchscreen;
class LilygoT547Touchscreen : public Touchscreen, public i2c::I2CDevice {
class LilygoT547Touchscreen final : public Touchscreen, public i2c::I2CDevice {
public:
void setup() override;

View File

@@ -8,7 +8,7 @@ namespace esphome::lm75b {
static const uint8_t LM75B_REG_TEMPERATURE = 0x00;
class LM75BComponent : public PollingComponent, public i2c::I2CDevice, public sensor::Sensor {
class LM75BComponent final : public PollingComponent, public i2c::I2CDevice, public sensor::Sensor {
public:
void dump_config() override;
void update() override;

View File

@@ -6,7 +6,7 @@
namespace esphome::lock {
template<typename... Ts> class LockAction : public Action<Ts...> {
template<typename... Ts> class LockAction final : public Action<Ts...> {
public:
explicit LockAction(Lock *a_lock) : lock_(a_lock) {}
@@ -16,7 +16,7 @@ template<typename... Ts> class LockAction : public Action<Ts...> {
Lock *lock_;
};
template<typename... Ts> class UnlockAction : public Action<Ts...> {
template<typename... Ts> class UnlockAction final : public Action<Ts...> {
public:
explicit UnlockAction(Lock *a_lock) : lock_(a_lock) {}
@@ -26,7 +26,7 @@ template<typename... Ts> class UnlockAction : public Action<Ts...> {
Lock *lock_;
};
template<typename... Ts> class OpenAction : public Action<Ts...> {
template<typename... Ts> class OpenAction final : public Action<Ts...> {
public:
explicit OpenAction(Lock *a_lock) : lock_(a_lock) {}
@@ -36,7 +36,7 @@ template<typename... Ts> class OpenAction : public Action<Ts...> {
Lock *lock_;
};
template<typename... Ts> class LockCondition : public Condition<Ts...> {
template<typename... Ts> class LockCondition final : public Condition<Ts...> {
public:
LockCondition(Lock *parent, bool state) : parent_(parent), state_(state) {}
bool check(const Ts &...x) override {

View File

@@ -6,7 +6,7 @@
namespace esphome::lps22 {
class LPS22Component : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
class LPS22Component final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
public:
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { this->temperature_sensor_ = temperature_sensor; }
void set_pressure_sensor(sensor::Sensor *pressure_sensor) { this->pressure_sensor_ = pressure_sensor; }

View File

@@ -82,7 +82,7 @@ enum LSM6DSGyroODR : uint8_t {
};
// ── Main component class ─────────────────────────────────────────────────────
class LSM6DSComponent : public motion::MotionComponent, public i2c::I2CDevice {
class LSM6DSComponent final : public motion::MotionComponent, public i2c::I2CDevice {
public:
void setup() override;
void dump_config() override;

View File

@@ -39,7 +39,7 @@ enum LTR390RESOLUTION {
LTR390_RESOLUTION_13BIT,
};
class LTR390Component : public PollingComponent, public i2c::I2CDevice {
class LTR390Component final : public PollingComponent, public i2c::I2CDevice {
public:
void setup() override;
void dump_config() override;

View File

@@ -19,7 +19,7 @@ enum LtrType : uint8_t {
LTR_TYPE_ALS_AND_PS = 3,
};
class LTRAlsPs501Component : public PollingComponent, public i2c::I2CDevice {
class LTRAlsPs501Component final : public PollingComponent, public i2c::I2CDevice {
public:
//
// EspHome framework functions

View File

@@ -6,7 +6,7 @@
namespace esphome::lvgl {
class LVLight : public light::LightOutput {
class LVLight final : public light::LightOutput {
public:
light::LightTraits get_traits() override {
auto traits = light::LightTraits();

View File

@@ -155,7 +155,7 @@ class LvPageType : public Parented<LvglComponent> {
using event_callback_t = void(lv_event_t *);
class LvLambdaComponent : public Component {
class LvLambdaComponent final : public Component {
public:
LvLambdaComponent(void (*callback)()) : callback_(callback) {}
@@ -167,7 +167,7 @@ class LvLambdaComponent : public Component {
void (*callback_)();
};
template<typename... Ts> class ObjUpdateAction : public Action<Ts...> {
template<typename... Ts> class ObjUpdateAction final : public Action<Ts...> {
public:
explicit ObjUpdateAction(std::function<void(Ts...)> &&lamb) : lamb_(std::move(lamb)) {}
@@ -185,7 +185,7 @@ enum RotationType : uint8_t {
ROTATION_HARDWARE,
};
class LvglComponent : public PollingComponent {
class LvglComponent final : public PollingComponent {
constexpr static const char *const TAG = "lvgl";
public:
@@ -339,7 +339,7 @@ class LvglComponent : public PollingComponent {
#endif
};
class IdleTrigger : public Trigger<> {
class IdleTrigger final : public Trigger<> {
public:
explicit IdleTrigger(LvglComponent *parent, TemplatableFn<uint32_t> timeout);
@@ -348,7 +348,7 @@ class IdleTrigger : public Trigger<> {
bool is_idle_{};
};
template<typename... Ts> class LvglAction : public Action<Ts...>, public Parented<LvglComponent> {
template<typename... Ts> class LvglAction final : public Action<Ts...>, public Parented<LvglComponent> {
public:
explicit LvglAction(std::function<void(LvglComponent *)> &&lamb) : action_(std::move(lamb)) {}
@@ -357,7 +357,7 @@ template<typename... Ts> class LvglAction : public Action<Ts...>, public Parente
std::function<void(LvglComponent *)> action_{};
};
template<typename Tc, typename... Ts> class LvglCondition : public Condition<Ts...>, public Parented<Tc> {
template<typename Tc, typename... Ts> class LvglCondition final : public Condition<Ts...>, public Parented<Tc> {
public:
LvglCondition(std::function<bool(Tc *)> &&condition_lambda) : condition_lambda_(std::move(condition_lambda)) {}
bool check(const Ts &...x) override { return this->condition_lambda_(this->parent_); }
@@ -367,7 +367,7 @@ template<typename Tc, typename... Ts> class LvglCondition : public Condition<Ts.
};
#ifdef USE_LVGL_TOUCHSCREEN
class LVTouchListener : public touchscreen::TouchListener, public Parented<LvglComponent> {
class LVTouchListener final : public touchscreen::TouchListener, public Parented<LvglComponent> {
public:
LVTouchListener(uint16_t long_press_time, uint16_t long_press_repeat_time, LvglComponent *parent);
void update(const touchscreen::TouchPoints_t &tpoints) override;
@@ -403,7 +403,7 @@ class IndicatorLine : public LvCompound {
#endif
#ifdef USE_LVGL_KEY_LISTENER
class LVEncoderListener : public Parented<LvglComponent> {
class LVEncoderListener final : public Parented<LvglComponent> {
public:
LVEncoderListener(lv_indev_type_t type, uint16_t long_press_time, uint16_t long_press_repeat_time);

View File

@@ -8,7 +8,7 @@
namespace esphome::lvgl {
class LVGLNumber : public number::Number, public Component {
class LVGLNumber final : public number::Number, public Component {
public:
LVGLNumber(std::function<void(float)> control_lambda, std::function<float()> value_lambda, bool restore)
: control_lambda_(std::move(control_lambda)), value_lambda_(std::move(value_lambda)), restore_(restore) {}

View File

@@ -10,7 +10,7 @@
namespace esphome::lvgl {
class LVGLSelect : public select::Select, public Component {
class LVGLSelect final : public select::Select, public Component {
public:
LVGLSelect(LvSelectable *widget, lv_anim_enable_t anim, bool restore)
: widget_(widget), anim_(anim), restore_(restore) {}

View File

@@ -9,7 +9,7 @@
namespace esphome::lvgl {
class LVGLSwitch : public switch_::Switch, public Component {
class LVGLSwitch final : public switch_::Switch, public Component {
public:
LVGLSwitch(std::function<void(bool)> state_lambda) : state_lambda_(std::move(state_lambda)) {}

View File

@@ -6,7 +6,7 @@
namespace esphome::lvgl {
class LVGLText : public text::Text {
class LVGLText final : public text::Text {
public:
void set_control_lambda(const std::function<void(std::string)> &control_lambda) {
this->control_lambda_ = control_lambda;

View File

@@ -7,9 +7,9 @@
namespace esphome::m5stack_8angle {
class M5Stack8AngleSwitchBinarySensor : public binary_sensor::BinarySensor,
public PollingComponent,
public Parented<M5Stack8AngleComponent> {
class M5Stack8AngleSwitchBinarySensor final : public binary_sensor::BinarySensor,
public PollingComponent,
public Parented<M5Stack8AngleComponent> {
public:
void update() override;
};

View File

@@ -10,7 +10,7 @@ namespace esphome::m5stack_8angle {
static const uint8_t M5STACK_8ANGLE_NUM_LEDS = 9;
static const uint8_t M5STACK_8ANGLE_BYTES_PER_LED = 4;
class M5Stack8AngleLightOutput : public light::AddressableLight, public Parented<M5Stack8AngleComponent> {
class M5Stack8AngleLightOutput final : public light::AddressableLight, public Parented<M5Stack8AngleComponent> {
public:
void setup() override;

View File

@@ -16,7 +16,7 @@ enum AnalogBits : uint8_t {
BITS_12 = 12,
};
class M5Stack8AngleComponent : public i2c::I2CDevice, public Component {
class M5Stack8AngleComponent final : public i2c::I2CDevice, public Component {
public:
void setup() override;
void dump_config() override;

View File

@@ -7,9 +7,9 @@
namespace esphome::m5stack_8angle {
class M5Stack8AngleKnobSensor : public sensor::Sensor,
public PollingComponent,
public Parented<M5Stack8AngleComponent> {
class M5Stack8AngleKnobSensor final : public sensor::Sensor,
public PollingComponent,
public Parented<M5Stack8AngleComponent> {
public:
void update() override;
void set_channel(uint8_t channel) { this->channel_ = channel; };