mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:25:35 +00:00
Mark user-configurable classes as final (part 14/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 14 of 21, split alphabetically by component (rc522_i2c .. scd4x).
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::rc522_i2c {
|
||||
|
||||
class RC522I2C : public rc522::RC522, public i2c::I2CDevice {
|
||||
class RC522I2C final : public rc522::RC522, public i2c::I2CDevice {
|
||||
public:
|
||||
void dump_config() override;
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
*/
|
||||
namespace esphome::rc522_spi {
|
||||
|
||||
class RC522Spi : public rc522::RC522,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_4MHZ> {
|
||||
class RC522Spi final : public rc522::RC522,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_4MHZ> {
|
||||
public:
|
||||
void setup() override;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ struct TargetSensor {
|
||||
};
|
||||
#endif
|
||||
|
||||
class RD03DComponent : public Component, public uart::UARTDevice {
|
||||
class RD03DComponent final : public Component, public uart::UARTDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void loop() override;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace esphome::rdm6300 {
|
||||
class RDM6300BinarySensor;
|
||||
class RDM6300Trigger;
|
||||
|
||||
class RDM6300Component : public Component, public uart::UARTDevice {
|
||||
class RDM6300Component final : public Component, public uart::UARTDevice {
|
||||
public:
|
||||
void loop() override;
|
||||
|
||||
@@ -28,7 +28,7 @@ class RDM6300Component : public Component, public uart::UARTDevice {
|
||||
uint32_t last_id_{0};
|
||||
};
|
||||
|
||||
class RDM6300BinarySensor : public binary_sensor::BinarySensorInitiallyOff {
|
||||
class RDM6300BinarySensor final : public binary_sensor::BinarySensorInitiallyOff {
|
||||
public:
|
||||
void set_id(uint32_t id) { id_ = id; }
|
||||
|
||||
@@ -46,7 +46,7 @@ class RDM6300BinarySensor : public binary_sensor::BinarySensorInitiallyOff {
|
||||
uint32_t id_;
|
||||
};
|
||||
|
||||
class RDM6300Trigger : public Trigger<uint32_t> {
|
||||
class RDM6300Trigger final : public Trigger<uint32_t> {
|
||||
public:
|
||||
void process(uint32_t uid) { this->trigger(uid); }
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ class RawBinarySensor : public RemoteReceiverBinarySensorBase {
|
||||
size_t len_;
|
||||
};
|
||||
|
||||
class RawTrigger : public Trigger<RawTimings>, public Component, public RemoteReceiverListener {
|
||||
class RawTrigger final : public Trigger<RawTimings>, public Component, public RemoteReceiverListener {
|
||||
protected:
|
||||
bool on_receive(RemoteReceiveData src) override {
|
||||
this->trigger(src.get_raw_data());
|
||||
|
||||
@@ -256,7 +256,7 @@ template<typename T> class RemoteReceiverBinarySensor : public RemoteReceiverBin
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class RemoteReceiverTrigger : public Trigger<typename T::ProtocolData>, public RemoteReceiverListener {
|
||||
class RemoteReceiverTrigger final : public Trigger<typename T::ProtocolData>, public RemoteReceiverListener {
|
||||
protected:
|
||||
bool on_receive(RemoteReceiveData src) override {
|
||||
auto proto = T();
|
||||
|
||||
@@ -55,11 +55,11 @@ struct RemoteReceiverComponentStore {
|
||||
};
|
||||
#endif
|
||||
|
||||
class RemoteReceiverComponent : public remote_base::RemoteReceiverBase,
|
||||
public Component
|
||||
class RemoteReceiverComponent final : public remote_base::RemoteReceiverBase,
|
||||
public Component
|
||||
#if defined(USE_ESP32) && SOC_RMT_SUPPORTED
|
||||
,
|
||||
public remote_base::RemoteRMTChannel
|
||||
public remote_base::RemoteRMTChannel
|
||||
#endif
|
||||
|
||||
{
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
namespace esphome::remote_transmitter {
|
||||
|
||||
template<typename... Ts> class DigitalWriteAction : public Action<Ts...>, public Parented<RemoteTransmitterComponent> {
|
||||
template<typename... Ts>
|
||||
class DigitalWriteAction final : public Action<Ts...>, public Parented<RemoteTransmitterComponent> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, value)
|
||||
void play(const Ts &...x) override { this->parent_->digital_write(this->value_.value(x...)); }
|
||||
|
||||
@@ -33,11 +33,11 @@ struct RemoteTransmitterComponentStore {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase,
|
||||
public Component
|
||||
class RemoteTransmitterComponent final : public remote_base::RemoteTransmitterBase,
|
||||
public Component
|
||||
#if defined(USE_ESP32) && SOC_RMT_SUPPORTED
|
||||
,
|
||||
public remote_base::RemoteRMTChannel
|
||||
public remote_base::RemoteRMTChannel
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace esphome::resampler {
|
||||
|
||||
class ResamplerSpeaker : public Component, public speaker::Speaker {
|
||||
class ResamplerSpeaker final : public Component, public speaker::Speaker {
|
||||
public:
|
||||
float get_setup_priority() const override { return esphome::setup_priority::DATA; }
|
||||
void dump_config() override;
|
||||
|
||||
@@ -10,7 +10,7 @@ enum ResistanceConfiguration {
|
||||
DOWNSTREAM,
|
||||
};
|
||||
|
||||
class ResistanceSensor : public Component, public sensor::Sensor {
|
||||
class ResistanceSensor final : public Component, public sensor::Sensor {
|
||||
public:
|
||||
void set_sensor(Sensor *sensor) { sensor_ = sensor; }
|
||||
void set_configuration(ResistanceConfiguration configuration) { configuration_ = configuration; }
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::restart {
|
||||
|
||||
class RestartSwitch : public switch_::Switch, public Component {
|
||||
class RestartSwitch final : public switch_::Switch, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ struct RFBridgeAdvancedData {
|
||||
std::string code;
|
||||
};
|
||||
|
||||
class RFBridgeComponent : public uart::UARTDevice, public Component {
|
||||
class RFBridgeComponent final : public uart::UARTDevice, public Component {
|
||||
public:
|
||||
void loop() override;
|
||||
void dump_config() override;
|
||||
@@ -76,7 +76,7 @@ class RFBridgeComponent : public uart::UARTDevice, public Component {
|
||||
CallbackManager<void(RFBridgeAdvancedData)> advanced_data_callback_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class RFBridgeSendCodeAction : public Action<Ts...> {
|
||||
template<typename... Ts> class RFBridgeSendCodeAction final : public Action<Ts...> {
|
||||
public:
|
||||
RFBridgeSendCodeAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(uint16_t, sync)
|
||||
@@ -97,7 +97,7 @@ template<typename... Ts> class RFBridgeSendCodeAction : public Action<Ts...> {
|
||||
RFBridgeComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class RFBridgeSendAdvancedCodeAction : public Action<Ts...> {
|
||||
template<typename... Ts> class RFBridgeSendAdvancedCodeAction final : public Action<Ts...> {
|
||||
public:
|
||||
RFBridgeSendAdvancedCodeAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(uint8_t, length)
|
||||
@@ -116,7 +116,7 @@ template<typename... Ts> class RFBridgeSendAdvancedCodeAction : public Action<Ts
|
||||
RFBridgeComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class RFBridgeLearnAction : public Action<Ts...> {
|
||||
template<typename... Ts> class RFBridgeLearnAction final : public Action<Ts...> {
|
||||
public:
|
||||
RFBridgeLearnAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
|
||||
@@ -126,7 +126,7 @@ template<typename... Ts> class RFBridgeLearnAction : public Action<Ts...> {
|
||||
RFBridgeComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class RFBridgeStartAdvancedSniffingAction : public Action<Ts...> {
|
||||
template<typename... Ts> class RFBridgeStartAdvancedSniffingAction final : public Action<Ts...> {
|
||||
public:
|
||||
RFBridgeStartAdvancedSniffingAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
|
||||
@@ -136,7 +136,7 @@ template<typename... Ts> class RFBridgeStartAdvancedSniffingAction : public Acti
|
||||
RFBridgeComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class RFBridgeStopAdvancedSniffingAction : public Action<Ts...> {
|
||||
template<typename... Ts> class RFBridgeStopAdvancedSniffingAction final : public Action<Ts...> {
|
||||
public:
|
||||
RFBridgeStopAdvancedSniffingAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
|
||||
@@ -146,7 +146,7 @@ template<typename... Ts> class RFBridgeStopAdvancedSniffingAction : public Actio
|
||||
RFBridgeComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class RFBridgeStartBucketSniffingAction : public Action<Ts...> {
|
||||
template<typename... Ts> class RFBridgeStartBucketSniffingAction final : public Action<Ts...> {
|
||||
public:
|
||||
RFBridgeStartBucketSniffingAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
|
||||
@@ -156,7 +156,7 @@ template<typename... Ts> class RFBridgeStartBucketSniffingAction : public Action
|
||||
RFBridgeComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class RFBridgeSendRawAction : public Action<Ts...> {
|
||||
template<typename... Ts> class RFBridgeSendRawAction final : public Action<Ts...> {
|
||||
public:
|
||||
RFBridgeSendRawAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(std::string, raw)
|
||||
@@ -167,7 +167,7 @@ template<typename... Ts> class RFBridgeSendRawAction : public Action<Ts...> {
|
||||
RFBridgeComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class RFBridgeBeepAction : public Action<Ts...> {
|
||||
template<typename... Ts> class RFBridgeBeepAction final : public Action<Ts...> {
|
||||
public:
|
||||
RFBridgeBeepAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(uint16_t, duration)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::rgb {
|
||||
|
||||
class RGBLightOutput : public light::LightOutput {
|
||||
class RGBLightOutput final : public light::LightOutput {
|
||||
public:
|
||||
void set_red(output::FloatOutput *red) { red_ = red; }
|
||||
void set_green(output::FloatOutput *green) { green_ = green; }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::rgbct {
|
||||
|
||||
class RGBCTLightOutput : public light::LightOutput {
|
||||
class RGBCTLightOutput final : public light::LightOutput {
|
||||
public:
|
||||
void set_red(output::FloatOutput *red) { red_ = red; }
|
||||
void set_green(output::FloatOutput *green) { green_ = green; }
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::rgbw {
|
||||
|
||||
class RGBWLightOutput : public light::LightOutput {
|
||||
class RGBWLightOutput final : public light::LightOutput {
|
||||
public:
|
||||
void set_red(output::FloatOutput *red) { red_ = red; }
|
||||
void set_green(output::FloatOutput *green) { green_ = green; }
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::rgbww {
|
||||
|
||||
class RGBWWLightOutput : public light::LightOutput {
|
||||
class RGBWWLightOutput final : public light::LightOutput {
|
||||
public:
|
||||
void set_red(output::FloatOutput *red) { red_ = red; }
|
||||
void set_green(output::FloatOutput *green) { green_ = green; }
|
||||
|
||||
@@ -41,7 +41,7 @@ struct RotaryEncoderSensorStore {
|
||||
static void gpio_intr(RotaryEncoderSensorStore *arg);
|
||||
};
|
||||
|
||||
class RotaryEncoderSensor : public sensor::Sensor, public Component {
|
||||
class RotaryEncoderSensor final : public sensor::Sensor, public Component {
|
||||
public:
|
||||
void set_pin_a(InternalGPIOPin *pin_a) { pin_a_ = pin_a; }
|
||||
void set_pin_b(InternalGPIOPin *pin_b) { pin_b_ = pin_b; }
|
||||
@@ -106,7 +106,7 @@ class RotaryEncoderSensor : public sensor::Sensor, public Component {
|
||||
CallbackManager<void(int32_t)> listeners_{};
|
||||
};
|
||||
|
||||
template<typename... Ts> class RotaryEncoderSetValueAction : public Action<Ts...> {
|
||||
template<typename... Ts> class RotaryEncoderSetValueAction final : public Action<Ts...> {
|
||||
public:
|
||||
RotaryEncoderSetValueAction(RotaryEncoderSensor *encoder) : encoder_(encoder) {}
|
||||
TEMPLATABLE_VALUE(int, value)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace esphome::router {
|
||||
|
||||
class Router : public Component, public speaker::Speaker {
|
||||
class Router final : public Component, public speaker::Speaker {
|
||||
public:
|
||||
float get_setup_priority() const override { return setup_priority::DATA; }
|
||||
|
||||
@@ -77,7 +77,7 @@ class Router : public Component, public speaker::Speaker {
|
||||
std::atomic<int8_t> active_output_idx_{0};
|
||||
};
|
||||
|
||||
template<typename... Ts> class SwitchOutputAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SwitchOutputAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SwitchOutputAction(Router *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(speaker::Speaker *, target)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::rp2040 {
|
||||
|
||||
class RP2040GPIOPin : public InternalGPIOPin {
|
||||
class RP2040GPIOPin final : public InternalGPIOPin {
|
||||
public:
|
||||
void set_pin(uint8_t pin) { pin_ = pin; }
|
||||
void set_inverted(bool inverted) { inverted_ = inverted; }
|
||||
|
||||
@@ -18,7 +18,7 @@ enum class BLEComponentState : uint8_t {
|
||||
DISABLED,
|
||||
};
|
||||
|
||||
class RP2040BLE : public Component {
|
||||
class RP2040BLE final : public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void loop() override;
|
||||
|
||||
@@ -57,7 +57,7 @@ inline const char *rgb_order_to_string(RGBOrder order) {
|
||||
|
||||
using init_fn = void (*)(PIO pio, uint sm, uint offset, uint pin, float freq);
|
||||
|
||||
class RP2040PIOLEDStripLightOutput : public light::AddressableLight {
|
||||
class RP2040PIOLEDStripLightOutput final : public light::AddressableLight {
|
||||
public:
|
||||
void setup() override;
|
||||
void write_state(light::LightState *state) override;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace esphome::rp2040_pwm {
|
||||
|
||||
class RP2040PWM : public output::FloatOutput, public Component {
|
||||
class RP2040PWM final : public output::FloatOutput, public Component {
|
||||
public:
|
||||
void set_pin(InternalGPIOPin *pin) { pin_ = pin; }
|
||||
void set_frequency(float frequency) { this->frequency_ = frequency; }
|
||||
@@ -39,7 +39,7 @@ class RP2040PWM : public output::FloatOutput, public Component {
|
||||
bool frequency_changed_{false};
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetFrequencyAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetFrequencyAction final : public Action<Ts...> {
|
||||
public:
|
||||
SetFrequencyAction(RP2040PWM *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(float, frequency);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace esphome::rpi_dpi_rgb {
|
||||
|
||||
constexpr static const char *const TAG = "rpi_dpi_rgb";
|
||||
|
||||
class RpiDpiRgb : public display::Display {
|
||||
class RpiDpiRgb final : public display::Display {
|
||||
public:
|
||||
void update() override { this->do_update_(); }
|
||||
void setup() override;
|
||||
|
||||
@@ -27,7 +27,7 @@ enum class State : uint8_t {
|
||||
STOPPING,
|
||||
};
|
||||
|
||||
class Rtttl : public Component {
|
||||
class Rtttl final : public Component {
|
||||
public:
|
||||
#ifdef USE_OUTPUT
|
||||
void set_output(output::FloatOutput *output) { this->output_ = output; }
|
||||
@@ -116,7 +116,7 @@ class Rtttl : public Component {
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename... Ts> class PlayAction : public Action<Ts...> {
|
||||
template<typename... Ts> class PlayAction final : public Action<Ts...> {
|
||||
public:
|
||||
PlayAction(Rtttl *rtttl) : rtttl_(rtttl) {}
|
||||
TEMPLATABLE_VALUE(std::string, value)
|
||||
@@ -127,12 +127,12 @@ template<typename... Ts> class PlayAction : public Action<Ts...> {
|
||||
Rtttl *rtttl_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class StopAction : public Action<Ts...>, public Parented<Rtttl> {
|
||||
template<typename... Ts> class StopAction final : public Action<Ts...>, public Parented<Rtttl> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->stop(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsPlayingCondition : public Condition<Ts...>, public Parented<Rtttl> {
|
||||
template<typename... Ts> class IsPlayingCondition final : public Condition<Ts...>, public Parented<Rtttl> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_playing(); }
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace runtime_stats {
|
||||
|
||||
static const char *const TAG = "runtime_stats";
|
||||
|
||||
class RuntimeStatsCollector {
|
||||
class RuntimeStatsCollector final {
|
||||
public:
|
||||
RuntimeStatsCollector();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ bool parse_ruuvi_data_byte(uint8_t data_type, const uint8_t *data, uint8_t data_
|
||||
|
||||
optional<RuuviParseResult> parse_ruuvi(const esp32_ble_tracker::ESPBTDevice &device);
|
||||
|
||||
class RuuviListener : public esp32_ble_tracker::ESPBTDeviceListener {
|
||||
class RuuviListener final : public esp32_ble_tracker::ESPBTDeviceListener {
|
||||
public:
|
||||
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace esphome::ruuvitag {
|
||||
|
||||
class RuuviTag : public Component, public esp32_ble_tracker::ESPBTDeviceListener {
|
||||
class RuuviTag final : public Component, public esp32_ble_tracker::ESPBTDeviceListener {
|
||||
public:
|
||||
void set_address(uint64_t address) { address_ = address; }
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::rx8130 {
|
||||
|
||||
class RX8130Component : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
class RX8130Component final : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void update() override;
|
||||
@@ -18,12 +18,12 @@ class RX8130Component : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
void stop_(bool stop);
|
||||
};
|
||||
|
||||
template<typename... Ts> class WriteAction : public Action<Ts...>, public Parented<RX8130Component> {
|
||||
template<typename... Ts> class WriteAction final : public Action<Ts...>, public Parented<RX8130Component> {
|
||||
public:
|
||||
void play(const Ts... x) override { this->parent_->write_time(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class ReadAction : public Action<Ts...>, public Parented<RX8130Component> {
|
||||
template<typename... Ts> class ReadAction final : public Action<Ts...>, public Parented<RX8130Component> {
|
||||
public:
|
||||
void play(const Ts... x) override { this->parent_->read_time(); }
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace esphome::safe_mode {
|
||||
|
||||
template<typename... Ts> class MarkSuccessfulAction : public Action<Ts...>, public Parented<SafeModeComponent> {
|
||||
template<typename... Ts> class MarkSuccessfulAction final : public Action<Ts...>, public Parented<SafeModeComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->mark_successful(); }
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::safe_mode {
|
||||
|
||||
class SafeModeSwitch : public switch_::Switch, public Component {
|
||||
class SafeModeSwitch final : public switch_::Switch, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void set_safe_mode(SafeModeComponent *safe_mode_component);
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
namespace esphome::scd30 {
|
||||
|
||||
template<typename... Ts> class ForceRecalibrationWithReference : public Action<Ts...>, public Parented<SCD30Component> {
|
||||
template<typename... Ts>
|
||||
class ForceRecalibrationWithReference final : public Action<Ts...>, public Parented<SCD30Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override {
|
||||
if (this->value_.has_value()) {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace esphome::scd30 {
|
||||
|
||||
/// This class implements support for the Sensirion scd30 i2c GAS (VOC and CO2eq) sensors.
|
||||
class SCD30Component : public Component, public sensirion_common::SensirionI2CDevice {
|
||||
class SCD30Component final : public Component, public sensirion_common::SensirionI2CDevice {
|
||||
public:
|
||||
void set_co2_sensor(sensor::Sensor *co2) { co2_sensor_ = co2; }
|
||||
void set_humidity_sensor(sensor::Sensor *humidity) { humidity_sensor_ = humidity; }
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
namespace esphome::scd4x {
|
||||
|
||||
template<typename... Ts> class PerformForcedCalibrationAction : public Action<Ts...>, public Parented<SCD4XComponent> {
|
||||
template<typename... Ts>
|
||||
class PerformForcedCalibrationAction final : public Action<Ts...>, public Parented<SCD4XComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override {
|
||||
if (this->value_.has_value()) {
|
||||
@@ -18,7 +19,7 @@ template<typename... Ts> class PerformForcedCalibrationAction : public Action<Ts
|
||||
TEMPLATABLE_VALUE(uint16_t, value)
|
||||
};
|
||||
|
||||
template<typename... Ts> class FactoryResetAction : public Action<Ts...>, public Parented<SCD4XComponent> {
|
||||
template<typename... Ts> class FactoryResetAction final : public Action<Ts...>, public Parented<SCD4XComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->factory_reset(); }
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ enum MeasurementMode : uint8_t {
|
||||
SINGLE_SHOT_RHT_ONLY,
|
||||
};
|
||||
|
||||
class SCD4XComponent : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
class SCD4XComponent final : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
Reference in New Issue
Block a user