mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:07:33 +00:00
Mark user-configurable classes as final (part 12/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 12 of 21, split alphabetically by component (msa3xx .. pm2005).
This commit is contained in:
@@ -211,7 +211,7 @@ union RegTapDuration {
|
||||
uint8_t raw{0x04};
|
||||
};
|
||||
|
||||
class MSA3xxComponent : public PollingComponent, public i2c::I2CDevice {
|
||||
class MSA3xxComponent final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
namespace esphome::my9231 {
|
||||
|
||||
/// MY9231 float output component.
|
||||
class MY9231OutputComponent : public Component {
|
||||
class MY9231OutputComponent final : public Component {
|
||||
public:
|
||||
class Channel;
|
||||
void set_pin_di(GPIOPin *pin_di) { pin_di_ = pin_di; }
|
||||
@@ -26,7 +26,7 @@ class MY9231OutputComponent : public Component {
|
||||
/// Send new values if they were updated.
|
||||
void loop() override;
|
||||
|
||||
class Channel : public output::FloatOutput {
|
||||
class Channel final : public output::FloatOutput {
|
||||
public:
|
||||
void set_parent(MY9231OutputComponent *parent) { parent_ = parent; }
|
||||
void set_channel(uint16_t channel) { channel_ = channel; }
|
||||
|
||||
@@ -47,7 +47,7 @@ enum NAU7802CalibrationModes {
|
||||
NAU7802_CALIBRATE_GAIN = 0b11,
|
||||
};
|
||||
|
||||
class NAU7802Sensor : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
class NAU7802Sensor final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void set_samples_per_second(NAU7802SPS sps) { this->sps_ = sps; }
|
||||
void set_ldo_voltage(NAU7802LDO ldo) { this->ldo_ = ldo; }
|
||||
@@ -97,18 +97,18 @@ class NAU7802Sensor : public sensor::Sensor, public PollingComponent, public i2c
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
class NAU7802CalbrateExternalOffsetAction : public Action<Ts...>, public Parented<NAU7802Sensor> {
|
||||
class NAU7802CalbrateExternalOffsetAction final : public Action<Ts...>, public Parented<NAU7802Sensor> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->calibrate_external_offset(); }
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
class NAU7802CalbrateInternalOffsetAction : public Action<Ts...>, public Parented<NAU7802Sensor> {
|
||||
class NAU7802CalbrateInternalOffsetAction final : public Action<Ts...>, public Parented<NAU7802Sensor> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->calibrate_internal_offset(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class NAU7802CalbrateGainAction : public Action<Ts...>, public Parented<NAU7802Sensor> {
|
||||
template<typename... Ts> class NAU7802CalbrateGainAction final : public Action<Ts...>, public Parented<NAU7802Sensor> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->calibrate_gain(); }
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "esphome/core/component.h"
|
||||
|
||||
namespace esphome::network {
|
||||
class NetworkComponent : public Component {
|
||||
class NetworkComponent final : public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
// AFTER_BLUETOOTH: BLE controller must initialize before esp_netif_init per IDF guidance.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::nextion {
|
||||
|
||||
template<typename... Ts> class NextionSetBrightnessAction : public Action<Ts...> {
|
||||
template<typename... Ts> class NextionSetBrightnessAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit NextionSetBrightnessAction(Nextion *component) : component_(component) {}
|
||||
|
||||
@@ -24,7 +24,7 @@ template<typename... Ts> class NextionSetBrightnessAction : public Action<Ts...>
|
||||
Nextion *component_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class NextionPublishFloatAction : public Action<Ts...> {
|
||||
template<typename... Ts> class NextionPublishFloatAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit NextionPublishFloatAction(NextionComponent *component) : component_(component) {}
|
||||
|
||||
@@ -47,7 +47,7 @@ template<typename... Ts> class NextionPublishFloatAction : public Action<Ts...>
|
||||
NextionComponent *component_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class NextionPublishTextAction : public Action<Ts...> {
|
||||
template<typename... Ts> class NextionPublishTextAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit NextionPublishTextAction(NextionComponent *component) : component_(component) {}
|
||||
|
||||
@@ -70,7 +70,7 @@ template<typename... Ts> class NextionPublishTextAction : public Action<Ts...> {
|
||||
NextionComponent *component_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class NextionPublishBoolAction : public Action<Ts...> {
|
||||
template<typename... Ts> class NextionPublishBoolAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit NextionPublishBoolAction(NextionComponent *component) : component_(component) {}
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace esphome::nextion {
|
||||
|
||||
class NextionBinarySensor;
|
||||
|
||||
class NextionBinarySensor : public NextionComponent,
|
||||
public binary_sensor::BinarySensorInitiallyOff,
|
||||
public PollingComponent {
|
||||
class NextionBinarySensor final : public NextionComponent,
|
||||
public binary_sensor::BinarySensorInitiallyOff,
|
||||
public PollingComponent {
|
||||
public:
|
||||
NextionBinarySensor(NextionBase *nextion) { this->nextion_ = nextion; }
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class NextionCommandPacer {
|
||||
};
|
||||
#endif // USE_NEXTION_COMMAND_SPACING
|
||||
|
||||
class Nextion : public NextionBase, public PollingComponent, public uart::UARTDevice {
|
||||
class Nextion final : public NextionBase, public PollingComponent, public uart::UARTDevice {
|
||||
public:
|
||||
#ifdef USE_NEXTION_MAX_COMMANDS_PER_LOOP
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace esphome::nextion {
|
||||
|
||||
class NextionSensor;
|
||||
|
||||
class NextionSensor : public NextionComponent, public sensor::Sensor, public PollingComponent {
|
||||
class NextionSensor final : public NextionComponent, public sensor::Sensor, public PollingComponent {
|
||||
public:
|
||||
NextionSensor(NextionBase *nextion) { this->nextion_ = nextion; }
|
||||
void send_state_to_nextion() override { this->set_state(this->state, false, true); };
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace esphome::nextion {
|
||||
|
||||
class NextionSwitch;
|
||||
|
||||
class NextionSwitch : public NextionComponent, public switch_::Switch, public PollingComponent {
|
||||
class NextionSwitch final : public NextionComponent, public switch_::Switch, public PollingComponent {
|
||||
public:
|
||||
NextionSwitch(NextionBase *nextion) { this->nextion_ = nextion; }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace esphome::nextion {
|
||||
|
||||
class NextionTextSensor;
|
||||
|
||||
class NextionTextSensor : public NextionComponent, public text_sensor::TextSensor, public PollingComponent {
|
||||
class NextionTextSensor final : public NextionComponent, public text_sensor::TextSensor, public PollingComponent {
|
||||
public:
|
||||
NextionTextSensor(NextionBase *nextion) { this->nextion_ = nextion; }
|
||||
void update() override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::nfc {
|
||||
|
||||
class NfcOnTagTrigger : public Trigger<std::string, NfcTag> {
|
||||
class NfcOnTagTrigger final : public Trigger<std::string, NfcTag> {
|
||||
public:
|
||||
void process(const std::unique_ptr<NfcTag> &tag);
|
||||
};
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
namespace esphome::nfc {
|
||||
|
||||
class NfcTagBinarySensor : public binary_sensor::BinarySensor,
|
||||
public Component,
|
||||
public NfcTagListener,
|
||||
public Parented<Nfcc> {
|
||||
class NfcTagBinarySensor final : public binary_sensor::BinarySensor,
|
||||
public Component,
|
||||
public NfcTagListener,
|
||||
public Parented<Nfcc> {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace esphome::noblex {
|
||||
const uint8_t NOBLEX_TEMP_MIN = 16; // Celsius
|
||||
const uint8_t NOBLEX_TEMP_MAX = 30; // Celsius
|
||||
|
||||
class NoblexClimate : public climate_ir::ClimateIR {
|
||||
class NoblexClimate final : public climate_ir::ClimateIR {
|
||||
public:
|
||||
NoblexClimate()
|
||||
: climate_ir::ClimateIR(NOBLEX_TEMP_MIN, NOBLEX_TEMP_MAX, 1.0f, true, true,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace esphome::npi19 {
|
||||
|
||||
/// This class implements support for the npi19 pressure and temperature i2c sensors.
|
||||
class NPI19Component : public PollingComponent, public i2c::I2CDevice {
|
||||
class NPI19Component final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { this->temperature_sensor_ = temperature_sensor; }
|
||||
void set_raw_pressure_sensor(sensor::Sensor *raw_pressure_sensor) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "esphome/core/gpio.h"
|
||||
|
||||
namespace esphome::nrf52 {
|
||||
class DeviceFirmwareUpdate : public Component {
|
||||
class DeviceFirmwareUpdate final : public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void set_reset_pin(GPIOPin *reset) { this->reset_pin_ = reset; }
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::ntc {
|
||||
|
||||
class NTC : public Component, public sensor::Sensor {
|
||||
class NTC final : public Component, public sensor::Sensor {
|
||||
public:
|
||||
void set_sensor(Sensor *sensor) { sensor_ = sensor; }
|
||||
void set_a(double a) { a_ = a; }
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
namespace esphome::number {
|
||||
|
||||
class NumberStateTrigger : public Trigger<float> {
|
||||
class NumberStateTrigger final : public Trigger<float> {
|
||||
public:
|
||||
explicit NumberStateTrigger(Number *parent) {
|
||||
parent->add_on_state_callback([this](float value) { this->trigger(value); });
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class NumberSetAction : public Action<Ts...> {
|
||||
template<typename... Ts> class NumberSetAction final : public Action<Ts...> {
|
||||
public:
|
||||
NumberSetAction(Number *number) : number_(number) {}
|
||||
TEMPLATABLE_VALUE(float, value)
|
||||
@@ -28,7 +28,7 @@ template<typename... Ts> class NumberSetAction : public Action<Ts...> {
|
||||
Number *number_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class NumberOperationAction : public Action<Ts...> {
|
||||
template<typename... Ts> class NumberOperationAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit NumberOperationAction(Number *number) : number_(number) {}
|
||||
TEMPLATABLE_VALUE(NumberOperation, operation)
|
||||
@@ -47,7 +47,7 @@ template<typename... Ts> class NumberOperationAction : public Action<Ts...> {
|
||||
Number *number_;
|
||||
};
|
||||
|
||||
class ValueRangeTrigger : public Trigger<float>, public Component {
|
||||
class ValueRangeTrigger final : public Trigger<float>, public Component {
|
||||
public:
|
||||
explicit ValueRangeTrigger(Number *parent) : parent_(parent) {}
|
||||
|
||||
@@ -67,7 +67,7 @@ class ValueRangeTrigger : public Trigger<float>, public Component {
|
||||
TemplatableFn<float, float> max_{[](float) -> float { return NAN; }};
|
||||
};
|
||||
|
||||
template<typename... Ts> class NumberInRangeCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class NumberInRangeCondition final : public Condition<Ts...> {
|
||||
public:
|
||||
NumberInRangeCondition(Number *parent) : parent_(parent) {}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::number {
|
||||
|
||||
class NumberSensor : public sensor::Sensor, public Component {
|
||||
class NumberSensor final : public sensor::Sensor, public Component {
|
||||
public:
|
||||
explicit NumberSensor(Number *source) : source_(source) {}
|
||||
void setup() override;
|
||||
|
||||
@@ -21,9 +21,9 @@ using t_http_codes = enum {
|
||||
* The image will then be stored in a buffer, so that it can be re-displayed without the
|
||||
* need to re-download or re-decode.
|
||||
*/
|
||||
class OnlineImage : public PollingComponent,
|
||||
public runtime_image::RuntimeImage,
|
||||
public Parented<esphome::http_request::HttpRequestComponent> {
|
||||
class OnlineImage final : public PollingComponent,
|
||||
public runtime_image::RuntimeImage,
|
||||
public Parented<esphome::http_request::HttpRequestComponent> {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new OnlineImage object.
|
||||
@@ -104,7 +104,7 @@ class OnlineImage : public PollingComponent,
|
||||
uint32_t start_time_{0};
|
||||
};
|
||||
|
||||
template<typename... Ts> class OnlineImageSetUrlAction : public Action<Ts...> {
|
||||
template<typename... Ts> class OnlineImageSetUrlAction final : public Action<Ts...> {
|
||||
public:
|
||||
OnlineImageSetUrlAction(OnlineImage *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(std::string, url)
|
||||
@@ -120,7 +120,7 @@ template<typename... Ts> class OnlineImageSetUrlAction : public Action<Ts...> {
|
||||
OnlineImage *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class OnlineImageReleaseAction : public Action<Ts...> {
|
||||
template<typename... Ts> class OnlineImageReleaseAction final : public Action<Ts...> {
|
||||
public:
|
||||
OnlineImageReleaseAction(OnlineImage *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) override { this->parent_->release(); }
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
namespace esphome::opentherm {
|
||||
|
||||
class BeforeSendTrigger : public Trigger<OpenthermData &> {
|
||||
class BeforeSendTrigger final : public Trigger<OpenthermData &> {
|
||||
public:
|
||||
BeforeSendTrigger(OpenthermHub *hub) {
|
||||
hub->add_on_before_send_callback([this](OpenthermData &x) { this->trigger(x); });
|
||||
}
|
||||
};
|
||||
|
||||
class BeforeProcessResponseTrigger : public Trigger<OpenthermData &> {
|
||||
class BeforeProcessResponseTrigger final : public Trigger<OpenthermData &> {
|
||||
public:
|
||||
BeforeProcessResponseTrigger(OpenthermHub *hub) {
|
||||
hub->add_on_before_process_response_callback([this](OpenthermData &x) { this->trigger(x); });
|
||||
|
||||
@@ -41,7 +41,7 @@ static const uint8_t REPEATING_MESSAGE_ORDER = 255;
|
||||
static const uint8_t INITIAL_UNORDERED_MESSAGE_ORDER = 254;
|
||||
|
||||
// OpenTherm component for ESPHome
|
||||
class OpenthermHub : public Component {
|
||||
class OpenthermHub final : public Component {
|
||||
protected:
|
||||
// Communication pins for the OpenTherm interface
|
||||
InternalGPIOPin *in_pin_, *out_pin_;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
namespace esphome::opentherm {
|
||||
|
||||
// Just a simple number, which stores the number
|
||||
class OpenthermNumber : public number::Number, public Component, public OpenthermInput {
|
||||
class OpenthermNumber final : public number::Number, public Component, public OpenthermInput {
|
||||
protected:
|
||||
void control(float value) override;
|
||||
void setup() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::opentherm {
|
||||
|
||||
class OpenthermOutput : public output::FloatOutput, public Component, public OpenthermInput {
|
||||
class OpenthermOutput final : public output::FloatOutput, public Component, public OpenthermInput {
|
||||
protected:
|
||||
bool has_state_ = false;
|
||||
const char *id_ = nullptr;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::opentherm {
|
||||
|
||||
class OpenthermSwitch : public switch_::Switch, public Component {
|
||||
class OpenthermSwitch final : public switch_::Switch, public Component {
|
||||
protected:
|
||||
void write_state(bool state) override;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace esphome::openthread {
|
||||
|
||||
class InstanceLock;
|
||||
|
||||
class OpenThreadComponent : public Component {
|
||||
class OpenThreadComponent final : public Component {
|
||||
public:
|
||||
OpenThreadComponent();
|
||||
~OpenThreadComponent();
|
||||
@@ -67,7 +67,7 @@ class OpenThreadComponent : public Component {
|
||||
|
||||
extern OpenThreadComponent *global_openthread_component; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
class OpenThreadSrpComponent : public Component {
|
||||
class OpenThreadSrpComponent final : public Component {
|
||||
public:
|
||||
void set_mdns(esphome::mdns::MDNSComponent *mdns);
|
||||
// This has to run after the mdns component or else no services are available to advertise
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace esphome::opt3001 {
|
||||
|
||||
/// This class implements support for the i2c-based OPT3001 ambient light sensor.
|
||||
class OPT3001Sensor : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
class OPT3001Sensor final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void update() override;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace esphome::output {
|
||||
|
||||
template<typename... Ts> class TurnOffAction : public Action<Ts...> {
|
||||
template<typename... Ts> class TurnOffAction final : public Action<Ts...> {
|
||||
public:
|
||||
TurnOffAction(BinaryOutput *output) : output_(output) {}
|
||||
|
||||
@@ -18,7 +18,7 @@ template<typename... Ts> class TurnOffAction : public Action<Ts...> {
|
||||
BinaryOutput *output_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class TurnOnAction : public Action<Ts...> {
|
||||
template<typename... Ts> class TurnOnAction final : public Action<Ts...> {
|
||||
public:
|
||||
TurnOnAction(BinaryOutput *output) : output_(output) {}
|
||||
|
||||
@@ -28,7 +28,7 @@ template<typename... Ts> class TurnOnAction : public Action<Ts...> {
|
||||
BinaryOutput *output_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetLevelAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetLevelAction final : public Action<Ts...> {
|
||||
public:
|
||||
SetLevelAction(FloatOutput *output) : output_(output) {}
|
||||
|
||||
@@ -41,7 +41,7 @@ template<typename... Ts> class SetLevelAction : public Action<Ts...> {
|
||||
};
|
||||
|
||||
#ifdef USE_OUTPUT_FLOAT_POWER_SCALING
|
||||
template<typename... Ts> class SetMinPowerAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetMinPowerAction final : public Action<Ts...> {
|
||||
public:
|
||||
SetMinPowerAction(FloatOutput *output) : output_(output) {}
|
||||
|
||||
@@ -53,7 +53,7 @@ template<typename... Ts> class SetMinPowerAction : public Action<Ts...> {
|
||||
FloatOutput *output_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetMaxPowerAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetMaxPowerAction final : public Action<Ts...> {
|
||||
public:
|
||||
SetMaxPowerAction(FloatOutput *output) : output_(output) {}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::output {
|
||||
|
||||
class OutputButton : public button::Button, public Component {
|
||||
class OutputButton final : public button::Button, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::output {
|
||||
|
||||
class OutputLock : public lock::Lock, public Component {
|
||||
class OutputLock final : public lock::Lock, public Component {
|
||||
public:
|
||||
void set_output(BinaryOutput *output) { output_ = output; }
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::output {
|
||||
|
||||
class OutputSwitch : public switch_::Switch, public Component {
|
||||
class OutputSwitch final : public switch_::Switch, public Component {
|
||||
public:
|
||||
void set_output(BinaryOutput *output) { output_ = output; }
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class AddressableSegment {
|
||||
bool reversed_;
|
||||
};
|
||||
|
||||
class PartitionLightOutput : public light::AddressableLight {
|
||||
class PartitionLightOutput final : public light::AddressableLight {
|
||||
public:
|
||||
explicit PartitionLightOutput(std::vector<AddressableSegment> segments) : segments_(std::move(segments)) {
|
||||
int32_t off = 0;
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
namespace esphome::pca6416a {
|
||||
|
||||
class PCA6416AComponent : public Component,
|
||||
public i2c::I2CDevice,
|
||||
public gpio_expander::CachedGpioExpander<uint8_t, 16> {
|
||||
class PCA6416AComponent final : public Component,
|
||||
public i2c::I2CDevice,
|
||||
public gpio_expander::CachedGpioExpander<uint8_t, 16> {
|
||||
public:
|
||||
PCA6416AComponent() = default;
|
||||
|
||||
@@ -49,7 +49,7 @@ class PCA6416AComponent : public Component,
|
||||
};
|
||||
|
||||
/// Helper class to expose a PCA6416A pin as an internal input GPIO pin.
|
||||
class PCA6416AGPIOPin : public GPIOPin {
|
||||
class PCA6416AGPIOPin final : public GPIOPin {
|
||||
public:
|
||||
void setup() override;
|
||||
void pin_mode(gpio::Flags flags) override;
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
namespace esphome::pca9554 {
|
||||
|
||||
class PCA9554Component : public Component,
|
||||
public i2c::I2CDevice,
|
||||
public gpio_expander::CachedGpioExpander<uint16_t, 16> {
|
||||
class PCA9554Component final : public Component,
|
||||
public i2c::I2CDevice,
|
||||
public gpio_expander::CachedGpioExpander<uint16_t, 16> {
|
||||
public:
|
||||
PCA9554Component() = default;
|
||||
|
||||
@@ -53,7 +53,7 @@ class PCA9554Component : public Component,
|
||||
};
|
||||
|
||||
/// Helper class to expose a PCA9554 pin as an internal input GPIO pin.
|
||||
class PCA9554GPIOPin : public GPIOPin {
|
||||
class PCA9554GPIOPin final : public GPIOPin {
|
||||
public:
|
||||
void setup() override;
|
||||
void pin_mode(gpio::Flags flags) override;
|
||||
|
||||
@@ -24,7 +24,7 @@ inline constexpr uint8_t PCA9685_MODE_OUTNE_LOW = 0x01;
|
||||
|
||||
class PCA9685Output;
|
||||
|
||||
class PCA9685Channel : public output::FloatOutput {
|
||||
class PCA9685Channel final : public output::FloatOutput {
|
||||
public:
|
||||
void set_channel(uint8_t channel) { channel_ = channel; }
|
||||
void set_parent(PCA9685Output *parent) { parent_ = parent; }
|
||||
@@ -39,7 +39,7 @@ class PCA9685Channel : public output::FloatOutput {
|
||||
};
|
||||
|
||||
/// PCA9685 float output component.
|
||||
class PCA9685Output : public Component, public i2c::I2CDevice {
|
||||
class PCA9685Output final : public Component, public i2c::I2CDevice {
|
||||
public:
|
||||
PCA9685Output(uint8_t mode = PCA9685_MODE_OUTPUT_ONACK | PCA9685_MODE_OUTPUT_TOTEM_POLE) : mode_(mode) {}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace esphome::pcd8544 {
|
||||
|
||||
class PCD8544 : public display::DisplayBuffer,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
class PCD8544 final : public display::DisplayBuffer,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
const uint8_t PCD8544_POWERDOWN = 0x04;
|
||||
const uint8_t PCD8544_ENTRYMODE = 0x02;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::pcf85063 {
|
||||
|
||||
class PCF85063Component : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
class PCF85063Component final : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void update() override;
|
||||
@@ -81,12 +81,12 @@ class PCF85063Component : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
} pcf85063_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class WriteAction : public Action<Ts...>, public Parented<PCF85063Component> {
|
||||
template<typename... Ts> class WriteAction final : public Action<Ts...>, public Parented<PCF85063Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->write_time(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class ReadAction : public Action<Ts...>, public Parented<PCF85063Component> {
|
||||
template<typename... Ts> class ReadAction final : public Action<Ts...>, public Parented<PCF85063Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->read_time(); }
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::pcf8563 {
|
||||
|
||||
class PCF8563Component : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
class PCF8563Component final : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void update() override;
|
||||
@@ -109,12 +109,12 @@ class PCF8563Component : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
} pcf8563_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class WriteAction : public Action<Ts...>, public Parented<PCF8563Component> {
|
||||
template<typename... Ts> class WriteAction final : public Action<Ts...>, public Parented<PCF8563Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->write_time(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class ReadAction : public Action<Ts...>, public Parented<PCF8563Component> {
|
||||
template<typename... Ts> class ReadAction final : public Action<Ts...>, public Parented<PCF8563Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->read_time(); }
|
||||
};
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace esphome::pcf8574 {
|
||||
|
||||
// PCF8574(8 pins)/PCF8575(16 pins) always read/write all pins in a single I2C transaction
|
||||
// so we use uint16_t as bank type to ensure all pins are in one bank and cached together
|
||||
class PCF8574Component : public Component,
|
||||
public i2c::I2CDevice,
|
||||
public gpio_expander::CachedGpioExpander<uint16_t, 16> {
|
||||
class PCF8574Component final : public Component,
|
||||
public i2c::I2CDevice,
|
||||
public gpio_expander::CachedGpioExpander<uint16_t, 16> {
|
||||
public:
|
||||
PCF8574Component() = default;
|
||||
|
||||
@@ -49,7 +49,7 @@ class PCF8574Component : public Component,
|
||||
};
|
||||
|
||||
/// Helper class to expose a PCF8574 pin as an internal input GPIO pin.
|
||||
class PCF8574GPIOPin : public GPIOPin {
|
||||
class PCF8574GPIOPin final : public GPIOPin {
|
||||
public:
|
||||
void setup() override;
|
||||
void pin_mode(gpio::Flags flags) override;
|
||||
|
||||
@@ -41,7 +41,7 @@ enum PCM5122BitsPerSample : uint8_t {
|
||||
PCM5122_BITS_PER_SAMPLE_32 = 32,
|
||||
};
|
||||
|
||||
class PCM5122 : public audio_dac::AudioDac, public Component, public i2c::I2CDevice {
|
||||
class PCM5122 final : public audio_dac::AudioDac, public Component, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::pcm5122 {
|
||||
|
||||
class PCM5122GPIOPin : public GPIOPin, public Parented<PCM5122> {
|
||||
class PCM5122GPIOPin final : public GPIOPin, public Parented<PCM5122> {
|
||||
public:
|
||||
void setup() override;
|
||||
void pin_mode(gpio::Flags flags) override;
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "esphome/core/hal.h"
|
||||
|
||||
namespace esphome::pi4ioe5v6408 {
|
||||
class PI4IOE5V6408Component : public Component,
|
||||
public i2c::I2CDevice,
|
||||
public gpio_expander::CachedGpioExpander<uint8_t, 8> {
|
||||
class PI4IOE5V6408Component final : public Component,
|
||||
public i2c::I2CDevice,
|
||||
public gpio_expander::CachedGpioExpander<uint8_t, 8> {
|
||||
public:
|
||||
PI4IOE5V6408Component() = default;
|
||||
|
||||
@@ -49,7 +49,7 @@ class PI4IOE5V6408Component : public Component,
|
||||
bool read_gpio_outputs_();
|
||||
};
|
||||
|
||||
class PI4IOE5V6408GPIOPin : public GPIOPin, public Parented<PI4IOE5V6408Component> {
|
||||
class PI4IOE5V6408GPIOPin final : public GPIOPin, public Parented<PI4IOE5V6408Component> {
|
||||
public:
|
||||
void setup() override;
|
||||
void pin_mode(gpio::Flags flags) override;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace esphome::pid {
|
||||
|
||||
class PIDClimate : public climate::Climate, public Component {
|
||||
class PIDClimate final : public climate::Climate, public Component {
|
||||
public:
|
||||
PIDClimate() = default;
|
||||
void setup() override;
|
||||
@@ -108,7 +108,7 @@ class PIDClimate : public climate::Climate, public Component {
|
||||
bool do_publish_ = false;
|
||||
};
|
||||
|
||||
template<typename... Ts> class PIDAutotuneAction : public Action<Ts...> {
|
||||
template<typename... Ts> class PIDAutotuneAction final : public Action<Ts...> {
|
||||
public:
|
||||
PIDAutotuneAction(PIDClimate *parent) : parent_(parent) {}
|
||||
|
||||
@@ -131,7 +131,7 @@ template<typename... Ts> class PIDAutotuneAction : public Action<Ts...> {
|
||||
PIDClimate *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class PIDResetIntegralTermAction : public Action<Ts...> {
|
||||
template<typename... Ts> class PIDResetIntegralTermAction final : public Action<Ts...> {
|
||||
public:
|
||||
PIDResetIntegralTermAction(PIDClimate *parent) : parent_(parent) {}
|
||||
|
||||
@@ -141,7 +141,7 @@ template<typename... Ts> class PIDResetIntegralTermAction : public Action<Ts...>
|
||||
PIDClimate *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class PIDSetControlParametersAction : public Action<Ts...> {
|
||||
template<typename... Ts> class PIDSetControlParametersAction final : public Action<Ts...> {
|
||||
public:
|
||||
PIDSetControlParametersAction(PIDClimate *parent) : parent_(parent) {}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ enum PIDClimateSensorType {
|
||||
PID_SENSOR_TYPE_KD,
|
||||
};
|
||||
|
||||
class PIDClimateSensor : public sensor::Sensor, public Component {
|
||||
class PIDClimateSensor final : public sensor::Sensor, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void set_parent(PIDClimate *parent) { parent_ = parent; }
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace esphome::pipsolar {
|
||||
|
||||
class Pipsolar;
|
||||
|
||||
class PipsolarOutput : public output::FloatOutput {
|
||||
class PipsolarOutput final : public output::FloatOutput {
|
||||
public:
|
||||
PipsolarOutput() {}
|
||||
void set_parent(Pipsolar *parent) { this->parent_ = parent; }
|
||||
@@ -27,7 +27,7 @@ class PipsolarOutput : public output::FloatOutput {
|
||||
std::vector<float> possible_values_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetOutputAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetOutputAction final : public Action<Ts...> {
|
||||
public:
|
||||
SetOutputAction(PipsolarOutput *output) : output_(output) {}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ struct QFLAGValues {
|
||||
PIPSOLAR_ENTITY_(binary_sensor::BinarySensor, name, polling_command)
|
||||
#define PIPSOLAR_TEXT_SENSOR(name, polling_command) PIPSOLAR_ENTITY_(text_sensor::TextSensor, name, polling_command)
|
||||
|
||||
class Pipsolar : public uart::UARTDevice, public PollingComponent {
|
||||
class Pipsolar final : public uart::UARTDevice, public PollingComponent {
|
||||
// QPIGS values
|
||||
PIPSOLAR_SENSOR(grid_voltage, QPIGS)
|
||||
PIPSOLAR_SENSOR(grid_frequency, QPIGS)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::pipsolar {
|
||||
class Pipsolar;
|
||||
class PipsolarSwitch : public switch_::Switch, public Component {
|
||||
class PipsolarSwitch final : public switch_::Switch, public Component {
|
||||
public:
|
||||
void set_parent(Pipsolar *parent) { this->parent_ = parent; }
|
||||
void set_on_command(const char *command) { this->on_command_ = command; }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::pm1006 {
|
||||
|
||||
class PM1006Component : public PollingComponent, public uart::UARTDevice {
|
||||
class PM1006Component final : public PollingComponent, public uart::UARTDevice {
|
||||
public:
|
||||
PM1006Component() = default;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ enum SensorType {
|
||||
PM2105,
|
||||
};
|
||||
|
||||
class PM2005Component : public PollingComponent, public i2c::I2CDevice {
|
||||
class PM2005Component final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void set_sensor_type(SensorType sensor_type) { this->sensor_type_ = sensor_type; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user