Mark user-configurable classes as final (part 7/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 7 of 21, split alphabetically by
component (gcja5 .. hlw8032).
This commit is contained in:
Jesse Hills
2026-06-15 13:19:47 +12:00
parent a25ac28ae5
commit 26a6015c5a
45 changed files with 79 additions and 79 deletions

View File

@@ -7,7 +7,7 @@
namespace esphome::gcja5 { namespace esphome::gcja5 {
class GCJA5Component : public Component, public uart::UARTDevice { class GCJA5Component final : public Component, public uart::UARTDevice {
public: public:
void dump_config() override; void dump_config() override;
void loop() override; void loop() override;

View File

@@ -22,7 +22,7 @@ static const uint8_t GDK101_REG_READ_MEASURING_TIME = 0xB1; // Mesuring time
static const uint8_t GDK101_REG_READ_10MIN_AVG = 0xB2; // Average radiation dose per 10 min static const uint8_t GDK101_REG_READ_10MIN_AVG = 0xB2; // Average radiation dose per 10 min
static const uint8_t GDK101_REG_READ_1MIN_AVG = 0xB3; // Average radiation dose per 1 min static const uint8_t GDK101_REG_READ_1MIN_AVG = 0xB3; // Average radiation dose per 1 min
class GDK101Component : public PollingComponent, public i2c::I2CDevice { class GDK101Component final : public PollingComponent, public i2c::I2CDevice {
#ifdef USE_SENSOR #ifdef USE_SENSOR
SUB_SENSOR(rad_1m) SUB_SENSOR(rad_1m)
SUB_SENSOR(rad_10m) SUB_SENSOR(rad_10m)

View File

@@ -6,7 +6,7 @@
namespace esphome::gl_r01_i2c { namespace esphome::gl_r01_i2c {
class GLR01I2CComponent : public sensor::Sensor, public i2c::I2CDevice, public PollingComponent { class GLR01I2CComponent final : public sensor::Sensor, public i2c::I2CDevice, public PollingComponent {
public: public:
void setup() override; void setup() override;
void dump_config() override; void dump_config() override;

View File

@@ -7,7 +7,7 @@
namespace esphome::globals { namespace esphome::globals {
template<typename T> class GlobalsComponent : public Component { template<typename T> class GlobalsComponent final : public Component {
public: public:
using value_type = T; using value_type = T;
explicit GlobalsComponent() = default; explicit GlobalsComponent() = default;
@@ -127,7 +127,7 @@ template<typename T, uint8_t SZ> class RestoringGlobalStringComponent : public P
ESPPreferenceObject rtc_; ESPPreferenceObject rtc_;
}; };
template<class C, typename... Ts> class GlobalVarSetAction : public Action<Ts...> { template<class C, typename... Ts> class GlobalVarSetAction final : public Action<Ts...> {
public: public:
explicit GlobalVarSetAction(C *parent) : parent_(parent) {} explicit GlobalVarSetAction(C *parent) : parent_(parent) {}

View File

@@ -7,7 +7,7 @@
namespace esphome::gp2y1010au0f { namespace esphome::gp2y1010au0f {
class GP2Y1010AU0FSensor : public sensor::Sensor, public PollingComponent { class GP2Y1010AU0FSensor final : public sensor::Sensor, public PollingComponent {
public: public:
void update() override; void update() override;
void loop() override; void loop() override;

View File

@@ -15,7 +15,7 @@ enum GP8403Model : uint8_t {
GP8413, GP8413,
}; };
class GP8403Component : public Component, public i2c::I2CDevice { class GP8403Component final : public Component, public i2c::I2CDevice {
public: public:
void setup() override; void setup() override;
void dump_config() override; void dump_config() override;

View File

@@ -7,7 +7,7 @@
namespace esphome::gp8403 { namespace esphome::gp8403 {
class GP8403Output : public Component, public output::FloatOutput, public Parented<GP8403Component> { class GP8403Output final : public Component, public output::FloatOutput, public Parented<GP8403Component> {
public: public:
void dump_config() override; void dump_config() override;
float get_setup_priority() const override { return setup_priority::DATA - 1; } float get_setup_priority() const override { return setup_priority::DATA - 1; }

View File

@@ -6,7 +6,7 @@
namespace esphome::gpio { namespace esphome::gpio {
class GPIOOneWireBus : public one_wire::OneWireBus, public Component { class GPIOOneWireBus final : public one_wire::OneWireBus, public Component {
public: public:
void setup() override; void setup() override;
void dump_config() override; void dump_config() override;

View File

@@ -6,7 +6,7 @@
namespace esphome::gpio { namespace esphome::gpio {
class GPIOBinaryOutput : public output::BinaryOutput, public Component { class GPIOBinaryOutput final : public output::BinaryOutput, public Component {
public: public:
void set_pin(GPIOPin *pin) { pin_ = pin; } void set_pin(GPIOPin *pin) { pin_ = pin; }

View File

@@ -22,7 +22,7 @@ class GPSListener {
GPS *parent_; GPS *parent_;
}; };
class GPS : public PollingComponent, public uart::UARTDevice { class GPS final : public PollingComponent, public uart::UARTDevice {
public: public:
void set_latitude_sensor(sensor::Sensor *latitude_sensor) { this->latitude_sensor_ = latitude_sensor; } void set_latitude_sensor(sensor::Sensor *latitude_sensor) { this->latitude_sensor_ = latitude_sensor; }
void set_longitude_sensor(sensor::Sensor *longitude_sensor) { this->longitude_sensor_ = longitude_sensor; } void set_longitude_sensor(sensor::Sensor *longitude_sensor) { this->longitude_sensor_ = longitude_sensor; }

View File

@@ -6,7 +6,7 @@
namespace esphome::gps { namespace esphome::gps {
class GPSTime : public time::RealTimeClock, public GPSListener { class GPSTime final : public time::RealTimeClock, public GPSListener {
public: public:
void update() override { this->from_tiny_gps_(this->get_tiny_gps()); }; void update() override { this->from_tiny_gps_(this->get_tiny_gps()); };
void on_update(TinyGPSPlus &tiny_gps) override { void on_update(TinyGPSPlus &tiny_gps) override {

View File

@@ -42,7 +42,7 @@ enum ValuePositionType {
VALUE_POSITION_TYPE_BELOW VALUE_POSITION_TYPE_BELOW
}; };
class GraphLegend { class GraphLegend final {
public: public:
void init(Graph *g); void init(Graph *g);
void set_name_font(display::BaseFont *font) { this->font_label_ = font; } void set_name_font(display::BaseFont *font) { this->font_label_ = font; }
@@ -105,7 +105,7 @@ class HistoryData {
std::vector<float> samples_; std::vector<float> samples_;
}; };
class GraphTrace { class GraphTrace final {
public: public:
void init(Graph *g); void init(Graph *g);
void set_name(std::string name) { name_ = std::move(name); } void set_name(std::string name) { name_ = std::move(name); }
@@ -134,7 +134,7 @@ class GraphTrace {
friend GraphLegend; friend GraphLegend;
}; };
class Graph : public Component { class Graph final : public Component {
public: public:
void draw(display::Display *buff, uint16_t x_offset, uint16_t y_offset, Color color); void draw(display::Display *buff, uint16_t x_offset, uint16_t y_offset, Color color);
void draw_legend(display::Display *buff, uint16_t x_offset, uint16_t y_offset, Color color); void draw_legend(display::Display *buff, uint16_t x_offset, uint16_t y_offset, Color color);

View File

@@ -33,7 +33,7 @@ struct MenuItemValueArguments {
bool is_menu_editing; bool is_menu_editing;
}; };
class GraphicalDisplayMenu : public display_menu_base::DisplayMenuComponent { class GraphicalDisplayMenu final : public display_menu_base::DisplayMenuComponent {
public: public:
void setup() override; void setup() override;
void dump_config() override; void dump_config() override;
@@ -73,7 +73,7 @@ class GraphicalDisplayMenu : public display_menu_base::DisplayMenuComponent {
CallbackManager<void()> on_redraw_callbacks_{}; CallbackManager<void()> on_redraw_callbacks_{};
}; };
class GraphicalDisplayMenuOnRedrawTrigger : public Trigger<const GraphicalDisplayMenu *> { class GraphicalDisplayMenuOnRedrawTrigger final : public Trigger<const GraphicalDisplayMenu *> {
public: public:
explicit GraphicalDisplayMenuOnRedrawTrigger(GraphicalDisplayMenu *parent) : parent_(parent) { explicit GraphicalDisplayMenuOnRedrawTrigger(GraphicalDisplayMenu *parent) : parent_(parent) {
parent->add_on_redraw_callback([this]() { this->trigger(this->parent_); }); parent->add_on_redraw_callback([this]() { this->trigger(this->parent_); });

View File

@@ -79,7 +79,7 @@ static constexpr uint8_t GREE_PRESET_SLEEP_BIT = 0x80;
// Model codes // Model codes
enum Model { GREE_GENERIC, GREE_YAN, GREE_YAA, GREE_YAC, GREE_YAC1FB9, GREE_YX1FF, GREE_YAG }; enum Model { GREE_GENERIC, GREE_YAN, GREE_YAA, GREE_YAC, GREE_YAC1FB9, GREE_YX1FF, GREE_YAG };
class GreeClimate : public climate_ir::ClimateIR { class GreeClimate final : public climate_ir::ClimateIR {
public: public:
GreeClimate() GreeClimate()
: climate_ir::ClimateIR(GREE_TEMP_MIN, GREE_TEMP_MAX, 1.0f, true, true, : climate_ir::ClimateIR(GREE_TEMP_MIN, GREE_TEMP_MAX, 1.0f, true, true,

View File

@@ -6,7 +6,7 @@
namespace esphome::gree { namespace esphome::gree {
class GreeModeBitSwitch : public switch_::Switch, public Component, public Parented<GreeClimate> { class GreeModeBitSwitch final : public switch_::Switch, public Component, public Parented<GreeClimate> {
public: public:
GreeModeBitSwitch(const char *name, uint8_t bit_mask) : name_(name), bit_mask_(bit_mask) {} GreeModeBitSwitch(const char *name, uint8_t bit_mask) : name_(name), bit_mask_(bit_mask) {}

View File

@@ -7,7 +7,7 @@
namespace esphome::grove_gas_mc_v2 { namespace esphome::grove_gas_mc_v2 {
class GroveGasMultichannelV2Component : public PollingComponent, public i2c::I2CDevice { class GroveGasMultichannelV2Component final : public PollingComponent, public i2c::I2CDevice {
SUB_SENSOR(tvoc) SUB_SENSOR(tvoc)
SUB_SENSOR(carbon_monoxide) SUB_SENSOR(carbon_monoxide)
SUB_SENSOR(nitrogen_dioxide) SUB_SENSOR(nitrogen_dioxide)

View File

@@ -47,7 +47,7 @@ enum StepperModeTypeT {
MICRO_STEPPING = 3, MICRO_STEPPING = 3,
}; };
class GroveMotorDriveTB6612FNG : public Component, public i2c::I2CDevice { class GroveMotorDriveTB6612FNG final : public Component, public i2c::I2CDevice {
public: public:
void setup() override; void setup() override;
void dump_config() override; void dump_config() override;
@@ -162,7 +162,7 @@ class GroveMotorDriveTB6612FNG : public Component, public i2c::I2CDevice {
}; };
template<typename... Ts> template<typename... Ts>
class GROVETB6612FNGMotorRunAction : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> { class GROVETB6612FNGMotorRunAction final : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> {
public: public:
TEMPLATABLE_VALUE(uint8_t, channel) TEMPLATABLE_VALUE(uint8_t, channel)
TEMPLATABLE_VALUE(uint16_t, speed) TEMPLATABLE_VALUE(uint16_t, speed)
@@ -183,7 +183,7 @@ class GROVETB6612FNGMotorRunAction : public Action<Ts...>, public Parented<Grove
}; };
template<typename... Ts> template<typename... Ts>
class GROVETB6612FNGMotorBrakeAction : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> { class GROVETB6612FNGMotorBrakeAction final : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> {
public: public:
TEMPLATABLE_VALUE(uint8_t, channel) TEMPLATABLE_VALUE(uint8_t, channel)
@@ -191,7 +191,7 @@ class GROVETB6612FNGMotorBrakeAction : public Action<Ts...>, public Parented<Gro
}; };
template<typename... Ts> template<typename... Ts>
class GROVETB6612FNGMotorStopAction : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> { class GROVETB6612FNGMotorStopAction final : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> {
public: public:
TEMPLATABLE_VALUE(uint8_t, channel) TEMPLATABLE_VALUE(uint8_t, channel)
@@ -199,19 +199,19 @@ class GROVETB6612FNGMotorStopAction : public Action<Ts...>, public Parented<Grov
}; };
template<typename... Ts> template<typename... Ts>
class GROVETB6612FNGMotorStandbyAction : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> { class GROVETB6612FNGMotorStandbyAction final : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> {
public: public:
void play(const Ts &...x) override { this->parent_->standby(); } void play(const Ts &...x) override { this->parent_->standby(); }
}; };
template<typename... Ts> template<typename... Ts>
class GROVETB6612FNGMotorNoStandbyAction : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> { class GROVETB6612FNGMotorNoStandbyAction final : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> {
public: public:
void play(const Ts &...x) override { this->parent_->not_standby(); } void play(const Ts &...x) override { this->parent_->not_standby(); }
}; };
template<typename... Ts> template<typename... Ts>
class GROVETB6612FNGMotorChangeAddressAction : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> { class GROVETB6612FNGMotorChangeAddressAction final : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> {
public: public:
TEMPLATABLE_VALUE(uint8_t, address) TEMPLATABLE_VALUE(uint8_t, address)

View File

@@ -65,7 +65,7 @@ constexpr size_t RTU2_TODAY_PRODUCTION = 53; // length = 2
constexpr size_t RTU2_TOTAL_ENERGY_PRODUCTION = 55; // length = 2 constexpr size_t RTU2_TOTAL_ENERGY_PRODUCTION = 55; // length = 2
constexpr size_t RTU2_INVERTER_MODULE_TEMP = 93; // length = 1 constexpr size_t RTU2_INVERTER_MODULE_TEMP = 93; // length = 1
class GrowattSolar : public PollingComponent, public modbus::ModbusDevice { class GrowattSolar final : public PollingComponent, public modbus::ModbusDevice {
public: public:
void loop() override; void loop() override;
void update() override; void update() override;

View File

@@ -7,10 +7,10 @@
namespace esphome::gt911 { namespace esphome::gt911 {
class GT911Button : public binary_sensor::BinarySensor, class GT911Button final : public binary_sensor::BinarySensor,
public Component, public Component,
public GT911ButtonListener, public GT911ButtonListener,
public Parented<GT911Touchscreen> { public Parented<GT911Touchscreen> {
public: public:
void setup() override; void setup() override;
void dump_config() override; void dump_config() override;

View File

@@ -12,7 +12,7 @@ class GT911ButtonListener {
virtual void update_button(uint8_t index, bool state) = 0; virtual void update_button(uint8_t index, bool state) = 0;
}; };
class GT911Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice { class GT911Touchscreen final : public touchscreen::Touchscreen, public i2c::I2CDevice {
public: public:
/// @brief Initialize the GT911 touchscreen. /// @brief Initialize the GT911 touchscreen.
/// ///

View File

@@ -6,7 +6,7 @@
namespace esphome::haier { namespace esphome::haier {
template<typename... Ts> class DisplayOnAction : public Action<Ts...> { template<typename... Ts> class DisplayOnAction final : public Action<Ts...> {
public: public:
DisplayOnAction(HaierClimateBase *parent) : parent_(parent) {} DisplayOnAction(HaierClimateBase *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->set_display_state(true); } void play(const Ts &...x) { this->parent_->set_display_state(true); }
@@ -15,7 +15,7 @@ template<typename... Ts> class DisplayOnAction : public Action<Ts...> {
HaierClimateBase *parent_; HaierClimateBase *parent_;
}; };
template<typename... Ts> class DisplayOffAction : public Action<Ts...> { template<typename... Ts> class DisplayOffAction final : public Action<Ts...> {
public: public:
DisplayOffAction(HaierClimateBase *parent) : parent_(parent) {} DisplayOffAction(HaierClimateBase *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->set_display_state(false); } void play(const Ts &...x) { this->parent_->set_display_state(false); }
@@ -24,7 +24,7 @@ template<typename... Ts> class DisplayOffAction : public Action<Ts...> {
HaierClimateBase *parent_; HaierClimateBase *parent_;
}; };
template<typename... Ts> class BeeperOnAction : public Action<Ts...> { template<typename... Ts> class BeeperOnAction final : public Action<Ts...> {
public: public:
BeeperOnAction(HonClimate *parent) : parent_(parent) {} BeeperOnAction(HonClimate *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->set_beeper_state(true); } void play(const Ts &...x) { this->parent_->set_beeper_state(true); }
@@ -33,7 +33,7 @@ template<typename... Ts> class BeeperOnAction : public Action<Ts...> {
HonClimate *parent_; HonClimate *parent_;
}; };
template<typename... Ts> class BeeperOffAction : public Action<Ts...> { template<typename... Ts> class BeeperOffAction final : public Action<Ts...> {
public: public:
BeeperOffAction(HonClimate *parent) : parent_(parent) {} BeeperOffAction(HonClimate *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->set_beeper_state(false); } void play(const Ts &...x) { this->parent_->set_beeper_state(false); }
@@ -42,7 +42,7 @@ template<typename... Ts> class BeeperOffAction : public Action<Ts...> {
HonClimate *parent_; HonClimate *parent_;
}; };
template<typename... Ts> class VerticalAirflowAction : public Action<Ts...> { template<typename... Ts> class VerticalAirflowAction final : public Action<Ts...> {
public: public:
VerticalAirflowAction(HonClimate *parent) : parent_(parent) {} VerticalAirflowAction(HonClimate *parent) : parent_(parent) {}
TEMPLATABLE_VALUE(hon_protocol::VerticalSwingMode, direction) TEMPLATABLE_VALUE(hon_protocol::VerticalSwingMode, direction)
@@ -52,7 +52,7 @@ template<typename... Ts> class VerticalAirflowAction : public Action<Ts...> {
HonClimate *parent_; HonClimate *parent_;
}; };
template<typename... Ts> class HorizontalAirflowAction : public Action<Ts...> { template<typename... Ts> class HorizontalAirflowAction final : public Action<Ts...> {
public: public:
HorizontalAirflowAction(HonClimate *parent) : parent_(parent) {} HorizontalAirflowAction(HonClimate *parent) : parent_(parent) {}
TEMPLATABLE_VALUE(hon_protocol::HorizontalSwingMode, direction) TEMPLATABLE_VALUE(hon_protocol::HorizontalSwingMode, direction)
@@ -62,7 +62,7 @@ template<typename... Ts> class HorizontalAirflowAction : public Action<Ts...> {
HonClimate *parent_; HonClimate *parent_;
}; };
template<typename... Ts> class HealthOnAction : public Action<Ts...> { template<typename... Ts> class HealthOnAction final : public Action<Ts...> {
public: public:
HealthOnAction(HaierClimateBase *parent) : parent_(parent) {} HealthOnAction(HaierClimateBase *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->set_health_mode(true); } void play(const Ts &...x) { this->parent_->set_health_mode(true); }
@@ -71,7 +71,7 @@ template<typename... Ts> class HealthOnAction : public Action<Ts...> {
HaierClimateBase *parent_; HaierClimateBase *parent_;
}; };
template<typename... Ts> class HealthOffAction : public Action<Ts...> { template<typename... Ts> class HealthOffAction final : public Action<Ts...> {
public: public:
HealthOffAction(HaierClimateBase *parent) : parent_(parent) {} HealthOffAction(HaierClimateBase *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->set_health_mode(false); } void play(const Ts &...x) { this->parent_->set_health_mode(false); }
@@ -80,7 +80,7 @@ template<typename... Ts> class HealthOffAction : public Action<Ts...> {
HaierClimateBase *parent_; HaierClimateBase *parent_;
}; };
template<typename... Ts> class StartSelfCleaningAction : public Action<Ts...> { template<typename... Ts> class StartSelfCleaningAction final : public Action<Ts...> {
public: public:
StartSelfCleaningAction(HonClimate *parent) : parent_(parent) {} StartSelfCleaningAction(HonClimate *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->start_self_cleaning(); } void play(const Ts &...x) { this->parent_->start_self_cleaning(); }
@@ -89,7 +89,7 @@ template<typename... Ts> class StartSelfCleaningAction : public Action<Ts...> {
HonClimate *parent_; HonClimate *parent_;
}; };
template<typename... Ts> class StartSteriCleaningAction : public Action<Ts...> { template<typename... Ts> class StartSteriCleaningAction final : public Action<Ts...> {
public: public:
StartSteriCleaningAction(HonClimate *parent) : parent_(parent) {} StartSteriCleaningAction(HonClimate *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->start_steri_cleaning(); } void play(const Ts &...x) { this->parent_->start_steri_cleaning(); }
@@ -98,7 +98,7 @@ template<typename... Ts> class StartSteriCleaningAction : public Action<Ts...> {
HonClimate *parent_; HonClimate *parent_;
}; };
template<typename... Ts> class PowerOnAction : public Action<Ts...> { template<typename... Ts> class PowerOnAction final : public Action<Ts...> {
public: public:
PowerOnAction(HaierClimateBase *parent) : parent_(parent) {} PowerOnAction(HaierClimateBase *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->send_power_on_command(); } void play(const Ts &...x) { this->parent_->send_power_on_command(); }
@@ -107,7 +107,7 @@ template<typename... Ts> class PowerOnAction : public Action<Ts...> {
HaierClimateBase *parent_; HaierClimateBase *parent_;
}; };
template<typename... Ts> class PowerOffAction : public Action<Ts...> { template<typename... Ts> class PowerOffAction final : public Action<Ts...> {
public: public:
PowerOffAction(HaierClimateBase *parent) : parent_(parent) {} PowerOffAction(HaierClimateBase *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->send_power_off_command(); } void play(const Ts &...x) { this->parent_->send_power_off_command(); }
@@ -116,7 +116,7 @@ template<typename... Ts> class PowerOffAction : public Action<Ts...> {
HaierClimateBase *parent_; HaierClimateBase *parent_;
}; };
template<typename... Ts> class PowerToggleAction : public Action<Ts...> { template<typename... Ts> class PowerToggleAction final : public Action<Ts...> {
public: public:
PowerToggleAction(HaierClimateBase *parent) : parent_(parent) {} PowerToggleAction(HaierClimateBase *parent) : parent_(parent) {}
void play(const Ts &...x) { this->parent_->toggle_power(); } void play(const Ts &...x) { this->parent_->toggle_power(); }

View File

@@ -5,7 +5,7 @@
namespace esphome::haier { namespace esphome::haier {
class SelfCleaningButton : public button::Button, public Parented<HonClimate> { class SelfCleaningButton final : public button::Button, public Parented<HonClimate> {
public: public:
SelfCleaningButton() = default; SelfCleaningButton() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::haier { namespace esphome::haier {
class SteriCleaningButton : public button::Button, public Parented<HonClimate> { class SteriCleaningButton final : public button::Button, public Parented<HonClimate> {
public: public:
SteriCleaningButton() = default; SteriCleaningButton() = default;

View File

@@ -35,7 +35,7 @@ struct HonSettings {
bool quiet_mode_state{false}; bool quiet_mode_state{false};
}; };
class HonClimate : public HaierClimateBase { class HonClimate final : public HaierClimateBase {
#ifdef USE_SENSOR #ifdef USE_SENSOR
public: public:
enum class SubSensorType { enum class SubSensorType {

View File

@@ -5,7 +5,7 @@
namespace esphome::haier { namespace esphome::haier {
class Smartair2Climate : public HaierClimateBase { class Smartair2Climate final : public HaierClimateBase {
public: public:
Smartair2Climate(); Smartair2Climate();
Smartair2Climate(const Smartair2Climate &) = delete; Smartair2Climate(const Smartair2Climate &) = delete;

View File

@@ -5,7 +5,7 @@
namespace esphome::haier { namespace esphome::haier {
class BeeperSwitch : public switch_::Switch, public Parented<HonClimate> { class BeeperSwitch final : public switch_::Switch, public Parented<HonClimate> {
public: public:
BeeperSwitch() = default; BeeperSwitch() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::haier { namespace esphome::haier {
class DisplaySwitch : public switch_::Switch, public Parented<HaierClimateBase> { class DisplaySwitch final : public switch_::Switch, public Parented<HaierClimateBase> {
public: public:
DisplaySwitch() = default; DisplaySwitch() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::haier { namespace esphome::haier {
class HealthModeSwitch : public switch_::Switch, public Parented<HaierClimateBase> { class HealthModeSwitch final : public switch_::Switch, public Parented<HaierClimateBase> {
public: public:
HealthModeSwitch() = default; HealthModeSwitch() = default;

View File

@@ -5,7 +5,7 @@
namespace esphome::haier { namespace esphome::haier {
class QuietModeSwitch : public switch_::Switch, public Parented<HonClimate> { class QuietModeSwitch final : public switch_::Switch, public Parented<HonClimate> {
public: public:
QuietModeSwitch() = default; QuietModeSwitch() = default;

View File

@@ -8,7 +8,7 @@
namespace esphome::havells_solar { namespace esphome::havells_solar {
class HavellsSolar : public PollingComponent, public modbus::ModbusDevice { class HavellsSolar final : public PollingComponent, public modbus::ModbusDevice {
public: public:
void set_voltage_sensor(uint8_t phase, sensor::Sensor *voltage_sensor) { void set_voltage_sensor(uint8_t phase, sensor::Sensor *voltage_sensor) {
this->phases_[phase].setup = true; this->phases_[phase].setup = true;

View File

@@ -12,7 +12,7 @@ enum DecayMode {
DECAY_MODE_FAST = 1, DECAY_MODE_FAST = 1,
}; };
class HBridgeFan : public Component, public fan::Fan { class HBridgeFan final : public Component, public fan::Fan {
public: public:
HBridgeFan(int speed_count, DecayMode decay_mode) : speed_count_(speed_count), decay_mode_(decay_mode) {} HBridgeFan(int speed_count, DecayMode decay_mode) : speed_count_(speed_count), decay_mode_(decay_mode) {}
@@ -46,7 +46,7 @@ class HBridgeFan : public Component, public fan::Fan {
void set_hbridge_levels_(float a_level, float b_level, float enable); void set_hbridge_levels_(float a_level, float b_level, float enable);
}; };
template<typename... Ts> class BrakeAction : public Action<Ts...> { template<typename... Ts> class BrakeAction final : public Action<Ts...> {
public: public:
explicit BrakeAction(HBridgeFan *parent) : parent_(parent) {} explicit BrakeAction(HBridgeFan *parent) : parent_(parent) {}

View File

@@ -7,7 +7,7 @@
namespace esphome::hbridge { namespace esphome::hbridge {
class HBridgeLightOutput : public Component, public light::LightOutput { class HBridgeLightOutput final : public Component, public light::LightOutput {
public: public:
void set_pina_pin(output::FloatOutput *pina_pin) { this->pina_pin_ = pina_pin; } void set_pina_pin(output::FloatOutput *pina_pin) { this->pina_pin_ = pina_pin; }
void set_pinb_pin(output::FloatOutput *pinb_pin) { this->pinb_pin_ = pinb_pin; } void set_pinb_pin(output::FloatOutput *pinb_pin) { this->pinb_pin_ = pinb_pin; }

View File

@@ -16,7 +16,7 @@ enum RelayState : uint8_t {
RELAY_STATE_UNKNOWN = 4, RELAY_STATE_UNKNOWN = 4,
}; };
class HBridgeSwitch : public switch_::Switch, public Component { class HBridgeSwitch final : public switch_::Switch, public Component {
public: public:
void set_on_pin(GPIOPin *pin) { this->on_pin_ = pin; } void set_on_pin(GPIOPin *pin) { this->on_pin_ = pin; }
void set_off_pin(GPIOPin *pin) { this->off_pin_ = pin; } void set_off_pin(GPIOPin *pin) { this->off_pin_ = pin; }

View File

@@ -9,7 +9,7 @@
namespace esphome::hc8 { namespace esphome::hc8 {
class HC8Component : public PollingComponent, public uart::UARTDevice { class HC8Component final : public PollingComponent, public uart::UARTDevice {
public: public:
void setup() override; void setup() override;
void update() override; void update() override;
@@ -26,7 +26,7 @@ class HC8Component : public PollingComponent, public uart::UARTDevice {
bool warmup_complete_{false}; bool warmup_complete_{false};
}; };
template<typename... Ts> class HC8CalibrateAction : public Action<Ts...>, public Parented<HC8Component> { template<typename... Ts> class HC8CalibrateAction final : public Action<Ts...>, public Parented<HC8Component> {
public: public:
TEMPLATABLE_VALUE(uint16_t, baseline) TEMPLATABLE_VALUE(uint16_t, baseline)

View File

@@ -6,7 +6,7 @@
namespace esphome::hdc1080 { namespace esphome::hdc1080 {
class HDC1080Component : public PollingComponent, public i2c::I2CDevice { class HDC1080Component final : public PollingComponent, public i2c::I2CDevice {
public: public:
void set_temperature(sensor::Sensor *temperature) { temperature_ = temperature; } void set_temperature(sensor::Sensor *temperature) { temperature_ = temperature; }
void set_humidity(sensor::Sensor *humidity) { humidity_ = humidity; } void set_humidity(sensor::Sensor *humidity) { humidity_ = humidity; }

View File

@@ -6,7 +6,7 @@
namespace esphome::hdc2010 { namespace esphome::hdc2010 {
class HDC2010Component : public PollingComponent, public i2c::I2CDevice { class HDC2010Component final : public PollingComponent, public i2c::I2CDevice {
public: public:
void set_temperature_sensor(sensor::Sensor *temperature) { this->temperature_sensor_ = temperature; } void set_temperature_sensor(sensor::Sensor *temperature) { this->temperature_sensor_ = temperature; }

View File

@@ -6,7 +6,7 @@
namespace esphome::hdc2080 { namespace esphome::hdc2080 {
class HDC2080Component : public PollingComponent, public i2c::I2CDevice { class HDC2080Component final : public PollingComponent, public i2c::I2CDevice {
public: public:
void set_temperature(sensor::Sensor *temperature) { this->temperature_sensor_ = temperature; } void set_temperature(sensor::Sensor *temperature) { this->temperature_sensor_ = temperature; }
void set_humidity(sensor::Sensor *humidity) { this->humidity_sensor_ = humidity; } void set_humidity(sensor::Sensor *humidity) { this->humidity_sensor_ = humidity; }

View File

@@ -20,7 +20,7 @@ enum HDC302XPowerMode : uint8_t {
Datasheet: Datasheet:
https://www.ti.com/lit/ds/symlink/hdc3020.pdf https://www.ti.com/lit/ds/symlink/hdc3020.pdf
*/ */
class HDC302XComponent : public PollingComponent, public i2c::I2CDevice { class HDC302XComponent final : public PollingComponent, public i2c::I2CDevice {
public: public:
void setup() override; void setup() override;
void dump_config() override; void dump_config() override;
@@ -48,7 +48,7 @@ class HDC302XComponent : public PollingComponent, public i2c::I2CDevice {
uint32_t conversion_delay_ms_(); uint32_t conversion_delay_ms_();
}; };
template<typename... Ts> class HeaterOnAction : public Action<Ts...>, public Parented<HDC302XComponent> { template<typename... Ts> class HeaterOnAction final : public Action<Ts...>, public Parented<HDC302XComponent> {
public: public:
TEMPLATABLE_VALUE(uint16_t, power) TEMPLATABLE_VALUE(uint16_t, power)
TEMPLATABLE_VALUE(uint32_t, duration) TEMPLATABLE_VALUE(uint32_t, duration)
@@ -60,7 +60,7 @@ template<typename... Ts> class HeaterOnAction : public Action<Ts...>, public Par
} }
}; };
template<typename... Ts> class HeaterOffAction : public Action<Ts...>, public Parented<HDC302XComponent> { template<typename... Ts> class HeaterOffAction final : public Action<Ts...>, public Parented<HDC302XComponent> {
public: public:
void play(const Ts &...x) override { this->parent_->stop_heater(); } void play(const Ts &...x) override { this->parent_->stop_heater(); }
}; };

View File

@@ -7,7 +7,7 @@
namespace esphome::he60r { namespace esphome::he60r {
class HE60rCover : public cover::Cover, public Component, public uart::UARTDevice { class HE60rCover final : public cover::Cover, public Component, public uart::UARTDevice {
public: public:
void setup() override; void setup() override;
void loop() override; void loop() override;

View File

@@ -93,7 +93,7 @@ enum VerticalDirection {
const float TEMP_MIN = 0; // Celsius const float TEMP_MIN = 0; // Celsius
const float TEMP_MAX = 100; // Celsius const float TEMP_MAX = 100; // Celsius
class HeatpumpIRClimate : public climate_ir::ClimateIR { class HeatpumpIRClimate final : public climate_ir::ClimateIR {
public: public:
HeatpumpIRClimate() HeatpumpIRClimate()
: climate_ir::ClimateIR(TEMP_MIN, TEMP_MAX, 1.0f, true, true, : climate_ir::ClimateIR(TEMP_MIN, TEMP_MAX, 1.0f, true, true,

View File

@@ -75,7 +75,7 @@ const uint16_t HITACHI_AC344_BITS = HITACHI_AC344_STATE_LENGTH * 8;
#define GETBIT8(a, b) ((a) & ((uint8_t) 1 << (b))) #define GETBIT8(a, b) ((a) & ((uint8_t) 1 << (b)))
#define GETBITS8(data, offset, size) (((data) & (((uint8_t) UINT8_MAX >> (8 - (size))) << (offset))) >> (offset)) #define GETBITS8(data, offset, size) (((data) & (((uint8_t) UINT8_MAX >> (8 - (size))) << (offset))) >> (offset))
class HitachiClimate : public climate_ir::ClimateIR { class HitachiClimate final : public climate_ir::ClimateIR {
public: public:
HitachiClimate() HitachiClimate()
: climate_ir::ClimateIR(HITACHI_AC344_TEMP_MIN, HITACHI_AC344_TEMP_MAX, 1.0F, true, true, : climate_ir::ClimateIR(HITACHI_AC344_TEMP_MIN, HITACHI_AC344_TEMP_MAX, 1.0F, true, true,

View File

@@ -77,7 +77,7 @@ const uint16_t HITACHI_AC424_BITS = HITACHI_AC424_STATE_LENGTH * 8;
#define HITACHI_AC424_GETBITS8(data, offset, size) \ #define HITACHI_AC424_GETBITS8(data, offset, size) \
(((data) & (((uint8_t) UINT8_MAX >> (8 - (size))) << (offset))) >> (offset)) (((data) & (((uint8_t) UINT8_MAX >> (8 - (size))) << (offset))) >> (offset))
class HitachiClimate : public climate_ir::ClimateIR { class HitachiClimate final : public climate_ir::ClimateIR {
public: public:
HitachiClimate() HitachiClimate()
: climate_ir::ClimateIR(HITACHI_AC424_TEMP_MIN, HITACHI_AC424_TEMP_MAX, 1.0F, true, true, : climate_ir::ClimateIR(HITACHI_AC424_TEMP_MIN, HITACHI_AC424_TEMP_MAX, 1.0F, true, true,

View File

@@ -71,7 +71,7 @@ enum HlkFm22xFaceDirection {
FACE_DIRECTION_UP = 0x10, FACE_DIRECTION_UP = 0x10,
}; };
class HlkFm22xComponent : public PollingComponent, public uart::UARTDevice { class HlkFm22xComponent final : public PollingComponent, public uart::UARTDevice {
public: public:
void setup() override; void setup() override;
void update() override; void update() override;
@@ -141,7 +141,7 @@ class HlkFm22xComponent : public PollingComponent, public uart::UARTDevice {
CallbackManager<void(uint8_t)> enrollment_failed_callback_; CallbackManager<void(uint8_t)> enrollment_failed_callback_;
}; };
template<typename... Ts> class EnrollmentAction : public Action<Ts...>, public Parented<HlkFm22xComponent> { template<typename... Ts> class EnrollmentAction final : public Action<Ts...>, public Parented<HlkFm22xComponent> {
public: public:
TEMPLATABLE_VALUE(std::string, name) TEMPLATABLE_VALUE(std::string, name)
TEMPLATABLE_VALUE(uint8_t, direction) TEMPLATABLE_VALUE(uint8_t, direction)
@@ -153,7 +153,7 @@ template<typename... Ts> class EnrollmentAction : public Action<Ts...>, public P
} }
}; };
template<typename... Ts> class DeleteAction : public Action<Ts...>, public Parented<HlkFm22xComponent> { template<typename... Ts> class DeleteAction final : public Action<Ts...>, public Parented<HlkFm22xComponent> {
public: public:
TEMPLATABLE_VALUE(int16_t, face_id) TEMPLATABLE_VALUE(int16_t, face_id)
@@ -163,17 +163,17 @@ template<typename... Ts> class DeleteAction : public Action<Ts...>, public Paren
} }
}; };
template<typename... Ts> class DeleteAllAction : public Action<Ts...>, public Parented<HlkFm22xComponent> { template<typename... Ts> class DeleteAllAction final : public Action<Ts...>, public Parented<HlkFm22xComponent> {
public: public:
void play(const Ts &...x) override { this->parent_->delete_all_faces(); } void play(const Ts &...x) override { this->parent_->delete_all_faces(); }
}; };
template<typename... Ts> class ScanAction : public Action<Ts...>, public Parented<HlkFm22xComponent> { template<typename... Ts> class ScanAction final : public Action<Ts...>, public Parented<HlkFm22xComponent> {
public: public:
void play(const Ts &...x) override { this->parent_->scan_face(); } void play(const Ts &...x) override { this->parent_->scan_face(); }
}; };
template<typename... Ts> class ResetAction : public Action<Ts...>, public Parented<HlkFm22xComponent> { template<typename... Ts> class ResetAction final : public Action<Ts...>, public Parented<HlkFm22xComponent> {
public: public:
void play(const Ts &...x) override { this->parent_->reset(); } void play(const Ts &...x) override { this->parent_->reset(); }
}; };

View File

@@ -23,7 +23,7 @@ enum HLW8012SensorModels {
#define USE_PCNT false #define USE_PCNT false
#endif #endif
class HLW8012Component : public PollingComponent { class HLW8012Component final : public PollingComponent {
public: public:
HLW8012Component() HLW8012Component()
: cf_store_(*pulse_counter::get_storage(USE_PCNT)), cf1_store_(*pulse_counter::get_storage(USE_PCNT)) {} : cf_store_(*pulse_counter::get_storage(USE_PCNT)), cf1_store_(*pulse_counter::get_storage(USE_PCNT)) {}

View File

@@ -6,7 +6,7 @@
namespace esphome::hlw8032 { namespace esphome::hlw8032 {
class HLW8032Component : public Component, public uart::UARTDevice { class HLW8032Component final : public Component, public uart::UARTDevice {
public: public:
void loop() override; void loop() override;
void dump_config() override; void dump_config() override;