mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:25:35 +00:00
Mark user-configurable classes as final (part 15/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 15 of 21, split alphabetically by component (script .. slow_pwm).
This commit is contained in:
@@ -207,7 +207,7 @@ template<typename... Ts> class ParallelScript : public Script<Ts...> {
|
||||
|
||||
template<class S, typename... Ts> class ScriptExecuteAction;
|
||||
|
||||
template<class... As, typename... Ts> class ScriptExecuteAction<Script<As...>, Ts...> : public Action<Ts...> {
|
||||
template<class... As, typename... Ts> class ScriptExecuteAction<Script<As...>, Ts...> final : public Action<Ts...> {
|
||||
public:
|
||||
ScriptExecuteAction(Script<As...> *script) : script_(script) {}
|
||||
|
||||
@@ -245,7 +245,7 @@ template<class... As, typename... Ts> class ScriptExecuteAction<Script<As...>, T
|
||||
Args args_;
|
||||
};
|
||||
|
||||
template<class C, typename... Ts> class ScriptStopAction : public Action<Ts...> {
|
||||
template<class C, typename... Ts> class ScriptStopAction final : public Action<Ts...> {
|
||||
public:
|
||||
ScriptStopAction(C *script) : script_(script) {}
|
||||
|
||||
@@ -255,7 +255,7 @@ template<class C, typename... Ts> class ScriptStopAction : public Action<Ts...>
|
||||
C *script_;
|
||||
};
|
||||
|
||||
template<class C, typename... Ts> class IsRunningCondition : public Condition<Ts...> {
|
||||
template<class C, typename... Ts> class IsRunningCondition final : public Condition<Ts...> {
|
||||
public:
|
||||
explicit IsRunningCondition(C *parent) : parent_(parent) {}
|
||||
|
||||
@@ -272,7 +272,7 @@ template<class C, typename... Ts> class IsRunningCondition : public Condition<Ts
|
||||
* (e.g., rapid button presses, high-frequency sensor updates), so we use
|
||||
* queue-based storage for correctness.
|
||||
*/
|
||||
template<class C, typename... Ts> class ScriptWaitAction : public Action<Ts...>, public Component {
|
||||
template<class C, typename... Ts> class ScriptWaitAction final : public Action<Ts...>, public Component {
|
||||
public:
|
||||
ScriptWaitAction(C *script) : script_(script) {}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace esphome::sdl {
|
||||
|
||||
constexpr static const char *const TAG = "sdl";
|
||||
|
||||
class Sdl : public display::Display {
|
||||
class Sdl final : public display::Display {
|
||||
public:
|
||||
display::DisplayType get_display_type() override { return display::DISPLAY_TYPE_COLOR; }
|
||||
void update() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::sdl {
|
||||
|
||||
class SdlTouchscreen : public touchscreen::Touchscreen, public Parented<Sdl> {
|
||||
class SdlTouchscreen final : public touchscreen::Touchscreen, public Parented<Sdl> {
|
||||
public:
|
||||
void setup() override {
|
||||
this->x_raw_max_ = this->display_->get_width();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace esphome::sdm_meter {
|
||||
|
||||
class SDMMeter : public PollingComponent, public modbus::ModbusDevice {
|
||||
class SDMMeter final : public PollingComponent, public modbus::ModbusDevice {
|
||||
public:
|
||||
void set_voltage_sensor(uint8_t phase, sensor::Sensor *voltage_sensor) {
|
||||
this->phases_[phase].setup = true;
|
||||
|
||||
@@ -8,7 +8,9 @@ namespace esphome::sdp3x {
|
||||
|
||||
enum MeasurementMode { MASS_FLOW_AVG, DP_AVG };
|
||||
|
||||
class SDP3XComponent : public PollingComponent, public sensirion_common::SensirionI2CDevice, public sensor::Sensor {
|
||||
class SDP3XComponent final : public PollingComponent,
|
||||
public sensirion_common::SensirionI2CDevice,
|
||||
public sensor::Sensor {
|
||||
public:
|
||||
/// Schedule temperature+pressure readings.
|
||||
void update() override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::sds011 {
|
||||
|
||||
class SDS011Component : public Component, public uart::UARTDevice {
|
||||
class SDS011Component final : public Component, public uart::UARTDevice {
|
||||
public:
|
||||
SDS011Component() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class CustomSetEndButton : public button::Button, public Parented<MR24HPC1Component> {
|
||||
class CustomSetEndButton final : public button::Button, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
CustomSetEndButton() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class RestartButton : public button::Button, public Parented<MR24HPC1Component> {
|
||||
class RestartButton final : public button::Button, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
RestartButton() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class CustomModeNumber : public number::Number, public Parented<MR24HPC1Component> {
|
||||
class CustomModeNumber final : public number::Number, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
CustomModeNumber() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class CustomUnmanTimeNumber : public number::Number, public Parented<MR24HPC1Component> {
|
||||
class CustomUnmanTimeNumber final : public number::Number, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
CustomUnmanTimeNumber() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class ExistenceThresholdNumber : public number::Number, public Parented<MR24HPC1Component> {
|
||||
class ExistenceThresholdNumber final : public number::Number, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
ExistenceThresholdNumber() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class MotionThresholdNumber : public number::Number, public Parented<MR24HPC1Component> {
|
||||
class MotionThresholdNumber final : public number::Number, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
MotionThresholdNumber() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class MotionTriggerTimeNumber : public number::Number, public Parented<MR24HPC1Component> {
|
||||
class MotionTriggerTimeNumber final : public number::Number, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
MotionTriggerTimeNumber() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class MotionToRestTimeNumber : public number::Number, public Parented<MR24HPC1Component> {
|
||||
class MotionToRestTimeNumber final : public number::Number, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
MotionToRestTimeNumber() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class SensitivityNumber : public number::Number, public Parented<MR24HPC1Component> {
|
||||
class SensitivityNumber final : public number::Number, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
SensitivityNumber() = default;
|
||||
|
||||
|
||||
@@ -92,8 +92,8 @@ static const char *const S_BOUNDARY_STR[10] = {"0.5m", "1.0m", "1.5m", "2.0m", "
|
||||
"3.0m", "3.5m", "4.0m", "4.5m", "5.0m"}; // uint: m
|
||||
static const float S_PRESENCE_OF_DETECTION_RANGE_STR[7] = {0.0f, 0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f}; // uint: m
|
||||
|
||||
class MR24HPC1Component : public Component,
|
||||
public uart::UARTDevice { // The class name must be the name defined by text_sensor.py
|
||||
class MR24HPC1Component final : public Component,
|
||||
public uart::UARTDevice { // The class name must be the name defined by text_sensor.py
|
||||
#ifdef USE_TEXT_SENSOR
|
||||
SUB_TEXT_SENSOR(heartbeat_state)
|
||||
SUB_TEXT_SENSOR(product_model)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class ExistenceBoundarySelect : public select::Select, public Parented<MR24HPC1Component> {
|
||||
class ExistenceBoundarySelect final : public select::Select, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
ExistenceBoundarySelect() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class MotionBoundarySelect : public select::Select, public Parented<MR24HPC1Component> {
|
||||
class MotionBoundarySelect final : public select::Select, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
MotionBoundarySelect() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class SceneModeSelect : public select::Select, public Parented<MR24HPC1Component> {
|
||||
class SceneModeSelect final : public select::Select, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
SceneModeSelect() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class UnmanTimeSelect : public select::Select, public Parented<MR24HPC1Component> {
|
||||
class UnmanTimeSelect final : public select::Select, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
UnmanTimeSelect() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr24hpc1 {
|
||||
|
||||
class UnderlyOpenFunctionSwitch : public switch_::Switch, public Parented<MR24HPC1Component> {
|
||||
class UnderlyOpenFunctionSwitch final : public switch_::Switch, public Parented<MR24HPC1Component> {
|
||||
public:
|
||||
UnderlyOpenFunctionSwitch() = default;
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ static const uint16_t HEART_RATE_TYPE_BUFFER = 0x0A15;
|
||||
static const uint16_t DISTANCE_TYPE_BUFFER = 0x0A16;
|
||||
static const uint16_t PRINT_CLOUD_BUFFER = 0x0A04;
|
||||
|
||||
class MR60BHA2Component : public Component,
|
||||
public uart::UARTDevice { // The class name must be the name defined by text_sensor.py
|
||||
class MR60BHA2Component final : public Component,
|
||||
public uart::UARTDevice { // The class name must be the name defined by text_sensor.py
|
||||
#ifdef USE_BINARY_SENSOR
|
||||
SUB_BINARY_SENSOR(has_target);
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr60fda2 {
|
||||
|
||||
class GetRadarParametersButton : public button::Button, public Parented<MR60FDA2Component> {
|
||||
class GetRadarParametersButton final : public button::Button, public Parented<MR60FDA2Component> {
|
||||
public:
|
||||
GetRadarParametersButton() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr60fda2 {
|
||||
|
||||
class ResetRadarButton : public button::Button, public Parented<MR60FDA2Component> {
|
||||
class ResetRadarButton final : public button::Button, public Parented<MR60FDA2Component> {
|
||||
public:
|
||||
ResetRadarButton() = default;
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ static const char *const INSTALL_HEIGHT_STR[7] = {"2.4m", "2.5m", "2.6", "2.7m",
|
||||
static const char *const HEIGHT_THRESHOLD_STR[7] = {"0.0m", "0.1m", "0.2m", "0.3m", "0.4m", "0.5m", "0.6m"};
|
||||
static const char *const SENSITIVITY_STR[3] = {"1", "2", "3"};
|
||||
|
||||
class MR60FDA2Component : public Component,
|
||||
public uart::UARTDevice { // The class name must be the name defined by text_sensor.py
|
||||
class MR60FDA2Component final : public Component,
|
||||
public uart::UARTDevice { // The class name must be the name defined by text_sensor.py
|
||||
#ifdef USE_BINARY_SENSOR
|
||||
SUB_BINARY_SENSOR(people_exist)
|
||||
SUB_BINARY_SENSOR(fall_detected)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr60fda2 {
|
||||
|
||||
class HeightThresholdSelect : public select::Select, public Parented<MR60FDA2Component> {
|
||||
class HeightThresholdSelect final : public select::Select, public Parented<MR60FDA2Component> {
|
||||
public:
|
||||
HeightThresholdSelect() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr60fda2 {
|
||||
|
||||
class InstallHeightSelect : public select::Select, public Parented<MR60FDA2Component> {
|
||||
class InstallHeightSelect final : public select::Select, public Parented<MR60FDA2Component> {
|
||||
public:
|
||||
InstallHeightSelect() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::seeed_mr60fda2 {
|
||||
|
||||
class SensitivitySelect : public select::Select, public Parented<MR60FDA2Component> {
|
||||
class SensitivitySelect final : public select::Select, public Parented<MR60FDA2Component> {
|
||||
public:
|
||||
SensitivitySelect() = default;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace esphome::selec_meter {
|
||||
public: \
|
||||
void set_##name##_sensor(sensor::Sensor *(name)) { this->name##_sensor_ = name; }
|
||||
|
||||
class SelecMeter : public PollingComponent, public modbus::ModbusDevice {
|
||||
class SelecMeter final : public PollingComponent, public modbus::ModbusDevice {
|
||||
public:
|
||||
SELEC_METER_SENSOR(total_active_energy)
|
||||
SELEC_METER_SENSOR(import_active_energy)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::select {
|
||||
|
||||
class SelectStateTrigger : public Trigger<StringRef, size_t> {
|
||||
class SelectStateTrigger final : public Trigger<StringRef, size_t> {
|
||||
public:
|
||||
explicit SelectStateTrigger(Select *parent) : parent_(parent) {
|
||||
parent->add_on_state_callback(
|
||||
@@ -17,7 +17,7 @@ class SelectStateTrigger : public Trigger<StringRef, size_t> {
|
||||
Select *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SelectSetAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SelectSetAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SelectSetAction(Select *select) : select_(select) {}
|
||||
TEMPLATABLE_VALUE(std::string, option)
|
||||
@@ -32,7 +32,7 @@ template<typename... Ts> class SelectSetAction : public Action<Ts...> {
|
||||
Select *select_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SelectSetIndexAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SelectSetIndexAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SelectSetIndexAction(Select *select) : select_(select) {}
|
||||
TEMPLATABLE_VALUE(size_t, index)
|
||||
@@ -47,7 +47,7 @@ template<typename... Ts> class SelectSetIndexAction : public Action<Ts...> {
|
||||
Select *select_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SelectOperationAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SelectOperationAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SelectOperationAction(Select *select) : select_(select) {}
|
||||
TEMPLATABLE_VALUE(bool, cycle)
|
||||
@@ -66,7 +66,7 @@ template<typename... Ts> class SelectOperationAction : public Action<Ts...> {
|
||||
Select *select_;
|
||||
};
|
||||
|
||||
template<size_t N, typename... Ts> class SelectIsCondition : public Condition<Ts...> {
|
||||
template<size_t N, typename... Ts> class SelectIsCondition final : public Condition<Ts...> {
|
||||
public:
|
||||
SelectIsCondition(Select *parent, const char *const *option_list) : parent_(parent), option_list_(option_list) {}
|
||||
|
||||
@@ -85,7 +85,7 @@ template<size_t N, typename... Ts> class SelectIsCondition : public Condition<Ts
|
||||
const char *const *option_list_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SelectIsCondition<0, Ts...> : public Condition<Ts...> {
|
||||
template<typename... Ts> class SelectIsCondition<0, Ts...> final : public Condition<Ts...> {
|
||||
public:
|
||||
SelectIsCondition(Select *parent, std::function<bool(const StringRef &, const Ts &...)> &&f)
|
||||
: parent_(parent), f_(f) {}
|
||||
|
||||
@@ -20,7 +20,7 @@ static const uint8_t SET_REGISTER = 0x04;
|
||||
static const uint8_t SENSOR_PASS_READ_REG = 0x07;
|
||||
static const uint8_t SENSOR_AUTO_READ_REG = 0x09;
|
||||
|
||||
class Sen0321Sensor : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
class Sen0321Sensor final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void update() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -63,7 +63,7 @@ using person_sensor_results_t = struct __attribute__((__packed__)) {
|
||||
uint16_t checksum; // Bytes 38-39.
|
||||
};
|
||||
|
||||
class Sen21231Sensor : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
class Sen21231Sensor final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void update() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::sen5x {
|
||||
|
||||
template<typename... Ts> class StartFanAction : public Action<Ts...> {
|
||||
template<typename... Ts> class StartFanAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit StartFanAction(SEN5XComponent *sen5x) : sen5x_(sen5x) {}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ struct TemperatureCompensation {
|
||||
// Prevents wear of the flash because of too many write operations
|
||||
static const uint32_t SHORTEST_BASELINE_STORE_INTERVAL = 2 * 60 * 60 * 1000;
|
||||
|
||||
class SEN5XComponent : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
class SEN5XComponent final : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::sen6x {
|
||||
|
||||
class SEN6XComponent : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
class SEN6XComponent final : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
SUB_SENSOR(pm_1_0)
|
||||
SUB_SENSOR(pm_2_5)
|
||||
SUB_SENSOR(pm_4_0)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace esphome::sendspin_ {
|
||||
|
||||
#ifdef USE_SENDSPIN_CONTROLLER
|
||||
template<typename... Ts> class SendspinSwitchCommandAction : public Action<Ts...>, public Parented<SendspinHub> {
|
||||
template<typename... Ts> class SendspinSwitchCommandAction final : public Action<Ts...>, public Parented<SendspinHub> {
|
||||
public:
|
||||
void play(const Ts &...x) override {
|
||||
// Clear any EXTERNAL_SOURCE state so the switch command is followed
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace esphome::sendspin_ {
|
||||
|
||||
class SendspinMediaPlayer : public SendspinChild, public media_player::MediaPlayer {
|
||||
class SendspinMediaPlayer final : public SendspinChild, public media_player::MediaPlayer {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
namespace esphome::sendspin_ {
|
||||
|
||||
template<typename... Ts>
|
||||
class EnableStaticDelayAdjustmentAction : public Action<Ts...>, public Parented<SendspinMediaSource> {
|
||||
class EnableStaticDelayAdjustmentAction final : public Action<Ts...>, public Parented<SendspinMediaSource> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->set_static_delay_adjustable(true); }
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
class DisableStaticDelayAdjustmentAction : public Action<Ts...>, public Parented<SendspinMediaSource> {
|
||||
class DisableStaticDelayAdjustmentAction final : public Action<Ts...>, public Parented<SendspinMediaSource> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->set_static_delay_adjustable(false); }
|
||||
};
|
||||
|
||||
@@ -17,9 +17,9 @@ namespace esphome::sendspin_ {
|
||||
/// Implements PlayerRoleListener to receive audio data from the sendspin-cpp library's
|
||||
/// SyncTask and bridges it to ESPHome's MediaSource output pipeline. Also forwards
|
||||
/// transport commands to the hub's controller role.
|
||||
class SendspinMediaSource : public SendspinChild,
|
||||
public media_source::MediaSource,
|
||||
public sendspin::PlayerRoleListener {
|
||||
class SendspinMediaSource final : public SendspinChild,
|
||||
public media_source::MediaSource,
|
||||
public sendspin::PlayerRoleListener {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace esphome::sendspin_ {
|
||||
|
||||
class SendspinTrackProgressSensor : public sensor::Sensor, public SendspinPollingChild {
|
||||
class SendspinTrackProgressSensor final : public sensor::Sensor, public SendspinPollingChild {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void setup() override;
|
||||
@@ -24,7 +24,7 @@ enum class SendspinNumericMetadataTypes {
|
||||
TRACK,
|
||||
};
|
||||
|
||||
class SendspinMetadataSensor : public sensor::Sensor, public SendspinChild {
|
||||
class SendspinMetadataSensor final : public sensor::Sensor, public SendspinChild {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void setup() override;
|
||||
|
||||
@@ -18,7 +18,7 @@ enum class SendspinTextMetadataTypes {
|
||||
ALBUM_ARTIST,
|
||||
};
|
||||
|
||||
class SendspinTextSensor : public SendspinChild, public text_sensor::TextSensor {
|
||||
class SendspinTextSensor final : public SendspinChild, public text_sensor::TextSensor {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void setup() override;
|
||||
|
||||
@@ -18,7 +18,7 @@ enum SenseAirStatus : uint8_t {
|
||||
RESERVED = 1 << 7
|
||||
};
|
||||
|
||||
class SenseAirComponent : public PollingComponent, public uart::UARTDevice {
|
||||
class SenseAirComponent final : public PollingComponent, public uart::UARTDevice {
|
||||
public:
|
||||
void set_co2_sensor(sensor::Sensor *co2_sensor) { co2_sensor_ = co2_sensor; }
|
||||
|
||||
@@ -37,7 +37,7 @@ class SenseAirComponent : public PollingComponent, public uart::UARTDevice {
|
||||
sensor::Sensor *co2_sensor_{nullptr};
|
||||
};
|
||||
|
||||
template<typename... Ts> class SenseAirBackgroundCalibrationAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SenseAirBackgroundCalibrationAction final : public Action<Ts...> {
|
||||
public:
|
||||
SenseAirBackgroundCalibrationAction(SenseAirComponent *senseair) : senseair_(senseair) {}
|
||||
|
||||
@@ -47,7 +47,7 @@ template<typename... Ts> class SenseAirBackgroundCalibrationAction : public Acti
|
||||
SenseAirComponent *senseair_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SenseAirBackgroundCalibrationResultAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SenseAirBackgroundCalibrationResultAction final : public Action<Ts...> {
|
||||
public:
|
||||
SenseAirBackgroundCalibrationResultAction(SenseAirComponent *senseair) : senseair_(senseair) {}
|
||||
|
||||
@@ -57,7 +57,7 @@ template<typename... Ts> class SenseAirBackgroundCalibrationResultAction : publi
|
||||
SenseAirComponent *senseair_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SenseAirABCEnableAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SenseAirABCEnableAction final : public Action<Ts...> {
|
||||
public:
|
||||
SenseAirABCEnableAction(SenseAirComponent *senseair) : senseair_(senseair) {}
|
||||
|
||||
@@ -67,7 +67,7 @@ template<typename... Ts> class SenseAirABCEnableAction : public Action<Ts...> {
|
||||
SenseAirComponent *senseair_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SenseAirABCDisableAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SenseAirABCDisableAction final : public Action<Ts...> {
|
||||
public:
|
||||
SenseAirABCDisableAction(SenseAirComponent *senseair) : senseair_(senseair) {}
|
||||
|
||||
@@ -77,7 +77,7 @@ template<typename... Ts> class SenseAirABCDisableAction : public Action<Ts...> {
|
||||
SenseAirComponent *senseair_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SenseAirABCGetPeriodAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SenseAirABCGetPeriodAction final : public Action<Ts...> {
|
||||
public:
|
||||
SenseAirABCGetPeriodAction(SenseAirComponent *senseair) : senseair_(senseair) {}
|
||||
|
||||
|
||||
@@ -6,21 +6,21 @@
|
||||
|
||||
namespace esphome::sensor {
|
||||
|
||||
class SensorStateTrigger : public Trigger<float> {
|
||||
class SensorStateTrigger final : public Trigger<float> {
|
||||
public:
|
||||
explicit SensorStateTrigger(Sensor *parent) {
|
||||
parent->add_on_state_callback([this](float value) { this->trigger(value); });
|
||||
}
|
||||
};
|
||||
|
||||
class SensorRawStateTrigger : public Trigger<float> {
|
||||
class SensorRawStateTrigger final : public Trigger<float> {
|
||||
public:
|
||||
explicit SensorRawStateTrigger(Sensor *parent) {
|
||||
parent->add_on_raw_state_callback([this](float value) { this->trigger(value); });
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class SensorPublishAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SensorPublishAction final : public Action<Ts...> {
|
||||
public:
|
||||
SensorPublishAction(Sensor *sensor) : sensor_(sensor) {}
|
||||
TEMPLATABLE_VALUE(float, state)
|
||||
@@ -31,7 +31,7 @@ template<typename... Ts> class SensorPublishAction : public Action<Ts...> {
|
||||
Sensor *sensor_;
|
||||
};
|
||||
|
||||
class ValueRangeTrigger : public Trigger<float>, public Component {
|
||||
class ValueRangeTrigger final : public Trigger<float>, public Component {
|
||||
public:
|
||||
explicit ValueRangeTrigger(Sensor *parent) : parent_(parent) {}
|
||||
|
||||
@@ -83,7 +83,7 @@ class ValueRangeTrigger : public Trigger<float>, public Component {
|
||||
TemplatableFn<float, float> max_{[](float) -> float { return NAN; }};
|
||||
};
|
||||
|
||||
template<typename... Ts> class SensorInRangeCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class SensorInRangeCondition final : public Condition<Ts...> {
|
||||
public:
|
||||
SensorInRangeCondition(Sensor *parent) : parent_(parent) {}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ enum SerialProxyLineStateFlag : uint32_t {
|
||||
/// Maximum bytes to read from UART in a single loop iteration
|
||||
inline constexpr size_t SERIAL_PROXY_MAX_READ_SIZE = 256;
|
||||
|
||||
class SerialProxy : public uart::UARTDevice, public Component {
|
||||
class SerialProxy final : public uart::UARTDevice, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void loop() override;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace esphome::servo {
|
||||
|
||||
extern uint32_t global_servo_id; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
class Servo : public Component {
|
||||
class Servo final : public Component {
|
||||
public:
|
||||
void set_output(output::FloatOutput *output) { output_ = output; }
|
||||
void loop() override;
|
||||
@@ -51,7 +51,7 @@ class Servo : public Component {
|
||||
};
|
||||
};
|
||||
|
||||
template<typename... Ts> class ServoWriteAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ServoWriteAction final : public Action<Ts...> {
|
||||
public:
|
||||
ServoWriteAction(Servo *servo) : servo_(servo) {}
|
||||
TEMPLATABLE_VALUE(float, value)
|
||||
@@ -62,7 +62,7 @@ template<typename... Ts> class ServoWriteAction : public Action<Ts...> {
|
||||
Servo *servo_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class ServoDetachAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ServoDetachAction final : public Action<Ts...> {
|
||||
public:
|
||||
ServoDetachAction(Servo *servo) : servo_(servo) {}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::sfa30 {
|
||||
|
||||
class SFA30Component : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
class SFA30Component final : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
enum ErrorCode { DEVICE_MARKING_READ_FAILED, MEASUREMENT_INIT_FAILED, UNKNOWN };
|
||||
|
||||
public:
|
||||
|
||||
@@ -16,7 +16,7 @@ struct SGP30Baselines {
|
||||
} PACKED;
|
||||
|
||||
/// This class implements support for the Sensirion SGP30 i2c GAS (VOC and CO2eq) sensors.
|
||||
class SGP30Component : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
class SGP30Component final : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
public:
|
||||
void set_eco2_sensor(sensor::Sensor *eco2) { eco2_sensor_ = eco2; }
|
||||
void set_tvoc_sensor(sensor::Sensor *tvoc) { tvoc_sensor_ = tvoc; }
|
||||
|
||||
@@ -54,7 +54,9 @@ const float MAXIMUM_STORAGE_DIFF = 50.0f;
|
||||
class SGP4xComponent;
|
||||
|
||||
/// This class implements support for the Sensirion sgp4x i2c GAS (VOC) sensors.
|
||||
class SGP4xComponent : public PollingComponent, public sensor::Sensor, public sensirion_common::SensirionI2CDevice {
|
||||
class SGP4xComponent final : public PollingComponent,
|
||||
public sensor::Sensor,
|
||||
public sensirion_common::SensirionI2CDevice {
|
||||
enum ErrorCode {
|
||||
COMMUNICATION_FAILED,
|
||||
MEASUREMENT_INIT_FAILED,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace esphome::shelly_dimmer {
|
||||
|
||||
class ShellyDimmer : public PollingComponent, public light::LightOutput, public uart::UARTDevice {
|
||||
class ShellyDimmer final : public PollingComponent, public light::LightOutput, public uart::UARTDevice {
|
||||
private:
|
||||
static constexpr uint16_t SHELLY_DIMMER_BUFFER_SIZE = 256;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace esphome::sht3xd {
|
||||
|
||||
/// This class implements support for the SHT3x-DIS family of temperature+humidity i2c sensors.
|
||||
class SHT3XDComponent : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
class SHT3XDComponent final : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
public:
|
||||
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
|
||||
void set_humidity_sensor(sensor::Sensor *humidity_sensor) { humidity_sensor_ = humidity_sensor; }
|
||||
|
||||
@@ -14,7 +14,7 @@ enum SHT4XHEATERPOWER { SHT4X_HEATERPOWER_HIGH, SHT4X_HEATERPOWER_MED, SHT4X_HEA
|
||||
|
||||
enum SHT4XHEATERTIME : uint16_t { SHT4X_HEATERTIME_LONG = 1100, SHT4X_HEATERTIME_SHORT = 110 };
|
||||
|
||||
class SHT4XComponent : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
class SHT4XComponent final : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -13,7 +13,7 @@ enum SHTCXType : uint8_t {
|
||||
};
|
||||
|
||||
/// This class implements support for the SHT3x-DIS family of temperature+humidity i2c sensors.
|
||||
class SHTCXComponent : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
class SHTCXComponent final : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
public:
|
||||
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
|
||||
void set_humidity_sensor(sensor::Sensor *humidity_sensor) { humidity_sensor_ = humidity_sensor; }
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::shutdown {
|
||||
|
||||
class ShutdownButton : public button::Button, public Component {
|
||||
class ShutdownButton final : public button::Button, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::shutdown {
|
||||
|
||||
class ShutdownSwitch : public switch_::Switch, public Component {
|
||||
class ShutdownSwitch final : public switch_::Switch, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::sigma_delta_output {
|
||||
|
||||
class SigmaDeltaOutput : public PollingComponent, public output::FloatOutput {
|
||||
class SigmaDeltaOutput final : public PollingComponent, public output::FloatOutput {
|
||||
public:
|
||||
Trigger<> *get_turn_on_trigger() {
|
||||
if (!this->turn_on_trigger_)
|
||||
|
||||
@@ -46,7 +46,7 @@ enum State {
|
||||
STATE_RECEIVED_USSD
|
||||
};
|
||||
|
||||
class Sim800LComponent : public uart::UARTDevice, public PollingComponent {
|
||||
class Sim800LComponent final : public uart::UARTDevice, public PollingComponent {
|
||||
public:
|
||||
/// Retrieve the latest sensor values. This operation takes approximately 16ms.
|
||||
void update() override;
|
||||
@@ -120,7 +120,7 @@ class Sim800LComponent : public uart::UARTDevice, public PollingComponent {
|
||||
CallbackManager<void(std::string)> ussd_received_callback_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class Sim800LSendSmsAction : public Action<Ts...> {
|
||||
template<typename... Ts> class Sim800LSendSmsAction final : public Action<Ts...> {
|
||||
public:
|
||||
Sim800LSendSmsAction(Sim800LComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(std::string, recipient)
|
||||
@@ -136,7 +136,7 @@ template<typename... Ts> class Sim800LSendSmsAction : public Action<Ts...> {
|
||||
Sim800LComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class Sim800LSendUssdAction : public Action<Ts...> {
|
||||
template<typename... Ts> class Sim800LSendUssdAction final : public Action<Ts...> {
|
||||
public:
|
||||
Sim800LSendUssdAction(Sim800LComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(std::string, ussd)
|
||||
@@ -150,7 +150,7 @@ template<typename... Ts> class Sim800LSendUssdAction : public Action<Ts...> {
|
||||
Sim800LComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class Sim800LDialAction : public Action<Ts...> {
|
||||
template<typename... Ts> class Sim800LDialAction final : public Action<Ts...> {
|
||||
public:
|
||||
Sim800LDialAction(Sim800LComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(std::string, recipient)
|
||||
@@ -163,7 +163,7 @@ template<typename... Ts> class Sim800LDialAction : public Action<Ts...> {
|
||||
protected:
|
||||
Sim800LComponent *parent_;
|
||||
};
|
||||
template<typename... Ts> class Sim800LConnectAction : public Action<Ts...> {
|
||||
template<typename... Ts> class Sim800LConnectAction final : public Action<Ts...> {
|
||||
public:
|
||||
Sim800LConnectAction(Sim800LComponent *parent) : parent_(parent) {}
|
||||
|
||||
@@ -173,7 +173,7 @@ template<typename... Ts> class Sim800LConnectAction : public Action<Ts...> {
|
||||
Sim800LComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class Sim800LDisconnectAction : public Action<Ts...> {
|
||||
template<typename... Ts> class Sim800LDisconnectAction final : public Action<Ts...> {
|
||||
public:
|
||||
Sim800LDisconnectAction(Sim800LComponent *parent) : parent_(parent) {}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::slow_pwm {
|
||||
|
||||
class SlowPWMOutput : public output::FloatOutput, public Component {
|
||||
class SlowPWMOutput final : public output::FloatOutput, public Component {
|
||||
public:
|
||||
void set_pin(GPIOPin *pin) { pin_ = pin; };
|
||||
void set_period(unsigned int period) { period_ = period; };
|
||||
|
||||
Reference in New Issue
Block a user