mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 13:27:14 +00:00
Mark configurable classes as final (4/21: chsc6x-dfplayer) (#16955)
This commit is contained in:
@@ -17,7 +17,7 @@ static const uint8_t CHSC6X_REG_STATUS_Y_COR = 0x04;
|
|||||||
static const uint8_t CHSC6X_REG_STATUS_LEN = 0x05;
|
static const uint8_t CHSC6X_REG_STATUS_LEN = 0x05;
|
||||||
static const uint8_t CHSC6X_CHIP_ID = 0x2e;
|
static const uint8_t CHSC6X_CHIP_ID = 0x2e;
|
||||||
|
|
||||||
class CHSC6XTouchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice {
|
class CHSC6XTouchscreen final : public touchscreen::Touchscreen, public i2c::I2CDevice {
|
||||||
public:
|
public:
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void update_touches() override;
|
void update_touches() override;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace esphome::climate {
|
|||||||
// (e.g. `const T & &` if Ts already carries a reference, or `const const
|
// (e.g. `const T & &` if Ts already carries a reference, or `const const
|
||||||
// T &` if Ts already carries a const). This keeps trigger args no-copy
|
// T &` if Ts already carries a const). This keeps trigger args no-copy
|
||||||
// regardless of whether the trigger supplies `T`, `T &`, or `const T &`.
|
// regardless of whether the trigger supplies `T`, `T &`, or `const T &`.
|
||||||
template<typename... Ts> class ControlAction : public Action<Ts...> {
|
template<typename... Ts> class ControlAction final : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
using ApplyFn = void (*)(ClimateCall &, const std::remove_cvref_t<Ts> &...);
|
using ApplyFn = void (*)(ClimateCall &, const std::remove_cvref_t<Ts> &...);
|
||||||
ControlAction(Climate *climate, ApplyFn apply) : climate_(climate), apply_(apply) {}
|
ControlAction(Climate *climate, ApplyFn apply) : climate_(climate), apply_(apply) {}
|
||||||
@@ -33,14 +33,14 @@ template<typename... Ts> class ControlAction : public Action<Ts...> {
|
|||||||
ApplyFn apply_;
|
ApplyFn apply_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ControlTrigger : public Trigger<ClimateCall &> {
|
class ControlTrigger final : public Trigger<ClimateCall &> {
|
||||||
public:
|
public:
|
||||||
ControlTrigger(Climate *climate) {
|
ControlTrigger(Climate *climate) {
|
||||||
climate->add_on_control_callback([this](ClimateCall &x) { this->trigger(x); });
|
climate->add_on_control_callback([this](ClimateCall &x) { this->trigger(x); });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class StateTrigger : public Trigger<Climate &> {
|
class StateTrigger final : public Trigger<Climate &> {
|
||||||
public:
|
public:
|
||||||
StateTrigger(Climate *climate) {
|
StateTrigger(Climate *climate) {
|
||||||
climate->add_on_state_callback([this](Climate &x) { this->trigger(x); });
|
climate->add_on_state_callback([this](Climate &x) { this->trigger(x); });
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace esphome::climate_ir_lg {
|
|||||||
const uint8_t TEMP_MIN = 18; // Celsius
|
const uint8_t TEMP_MIN = 18; // Celsius
|
||||||
const uint8_t TEMP_MAX = 30; // Celsius
|
const uint8_t TEMP_MAX = 30; // Celsius
|
||||||
|
|
||||||
class LgIrClimate : public climate_ir::ClimateIR {
|
class LgIrClimate final : public climate_ir::ClimateIR {
|
||||||
public:
|
public:
|
||||||
LgIrClimate()
|
LgIrClimate()
|
||||||
: climate_ir::ClimateIR(TEMP_MIN, TEMP_MAX, 1.0f, true, true,
|
: climate_ir::ClimateIR(TEMP_MIN, TEMP_MAX, 1.0f, true, true,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace esphome::cm1106 {
|
namespace esphome::cm1106 {
|
||||||
|
|
||||||
class CM1106Component : public PollingComponent, public uart::UARTDevice {
|
class CM1106Component final : public PollingComponent, public uart::UARTDevice {
|
||||||
public:
|
public:
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void update() override;
|
void update() override;
|
||||||
@@ -23,7 +23,7 @@ class CM1106Component : public PollingComponent, public uart::UARTDevice {
|
|||||||
bool cm1106_write_command_(const uint8_t *command, size_t command_len, uint8_t *response, size_t response_len);
|
bool cm1106_write_command_(const uint8_t *command, size_t command_len, uint8_t *response, size_t response_len);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class CM1106CalibrateZeroAction : public Action<Ts...> {
|
template<typename... Ts> class CM1106CalibrateZeroAction final : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
CM1106CalibrateZeroAction(CM1106Component *cm1106) : cm1106_(cm1106) {}
|
CM1106CalibrateZeroAction(CM1106Component *cm1106) : cm1106_(cm1106) {}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace esphome::color_temperature {
|
namespace esphome::color_temperature {
|
||||||
|
|
||||||
class CTLightOutput : public light::LightOutput {
|
class CTLightOutput final : public light::LightOutput {
|
||||||
public:
|
public:
|
||||||
void set_color_temperature(output::FloatOutput *color_temperature) { color_temperature_ = color_temperature; }
|
void set_color_temperature(output::FloatOutput *color_temperature) { color_temperature_ = color_temperature; }
|
||||||
void set_brightness(output::FloatOutput *brightness) { brightness_ = brightness; }
|
void set_brightness(output::FloatOutput *brightness) { brightness_ = brightness; }
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class CombinationOneParameterComponent : public CombinationComponent {
|
|||||||
FixedVector<SensorSource> sensor_sources_;
|
FixedVector<SensorSource> sensor_sources_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KalmanCombinationComponent : public CombinationOneParameterComponent {
|
class KalmanCombinationComponent final : public CombinationOneParameterComponent {
|
||||||
public:
|
public:
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
void setup() override;
|
void setup() override;
|
||||||
@@ -85,7 +85,7 @@ class KalmanCombinationComponent : public CombinationOneParameterComponent {
|
|||||||
float variance_{INFINITY};
|
float variance_{INFINITY};
|
||||||
};
|
};
|
||||||
|
|
||||||
class LinearCombinationComponent : public CombinationOneParameterComponent {
|
class LinearCombinationComponent final : public CombinationOneParameterComponent {
|
||||||
public:
|
public:
|
||||||
void dump_config() override { this->log_config_(LOG_STR("linear")); }
|
void dump_config() override { this->log_config_(LOG_STR("linear")); }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
@@ -93,49 +93,49 @@ class LinearCombinationComponent : public CombinationOneParameterComponent {
|
|||||||
void handle_new_value(float value);
|
void handle_new_value(float value);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MaximumCombinationComponent : public CombinationNoParameterComponent {
|
class MaximumCombinationComponent final : public CombinationNoParameterComponent {
|
||||||
public:
|
public:
|
||||||
void dump_config() override { this->log_config_(LOG_STR("max")); }
|
void dump_config() override { this->log_config_(LOG_STR("max")); }
|
||||||
|
|
||||||
void handle_new_value(float value) override;
|
void handle_new_value(float value) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MeanCombinationComponent : public CombinationNoParameterComponent {
|
class MeanCombinationComponent final : public CombinationNoParameterComponent {
|
||||||
public:
|
public:
|
||||||
void dump_config() override { this->log_config_(LOG_STR("mean")); }
|
void dump_config() override { this->log_config_(LOG_STR("mean")); }
|
||||||
|
|
||||||
void handle_new_value(float value) override;
|
void handle_new_value(float value) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MedianCombinationComponent : public CombinationNoParameterComponent {
|
class MedianCombinationComponent final : public CombinationNoParameterComponent {
|
||||||
public:
|
public:
|
||||||
void dump_config() override { this->log_config_(LOG_STR("median")); }
|
void dump_config() override { this->log_config_(LOG_STR("median")); }
|
||||||
|
|
||||||
void handle_new_value(float value) override;
|
void handle_new_value(float value) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MinimumCombinationComponent : public CombinationNoParameterComponent {
|
class MinimumCombinationComponent final : public CombinationNoParameterComponent {
|
||||||
public:
|
public:
|
||||||
void dump_config() override { this->log_config_(LOG_STR("min")); }
|
void dump_config() override { this->log_config_(LOG_STR("min")); }
|
||||||
|
|
||||||
void handle_new_value(float value) override;
|
void handle_new_value(float value) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MostRecentCombinationComponent : public CombinationNoParameterComponent {
|
class MostRecentCombinationComponent final : public CombinationNoParameterComponent {
|
||||||
public:
|
public:
|
||||||
void dump_config() override { this->log_config_(LOG_STR("most_recently_updated")); }
|
void dump_config() override { this->log_config_(LOG_STR("most_recently_updated")); }
|
||||||
|
|
||||||
void handle_new_value(float value) override;
|
void handle_new_value(float value) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RangeCombinationComponent : public CombinationNoParameterComponent {
|
class RangeCombinationComponent final : public CombinationNoParameterComponent {
|
||||||
public:
|
public:
|
||||||
void dump_config() override { this->log_config_(LOG_STR("range")); }
|
void dump_config() override { this->log_config_(LOG_STR("range")); }
|
||||||
|
|
||||||
void handle_new_value(float value) override;
|
void handle_new_value(float value) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SumCombinationComponent : public CombinationNoParameterComponent {
|
class SumCombinationComponent final : public CombinationNoParameterComponent {
|
||||||
public:
|
public:
|
||||||
void dump_config() override { this->log_config_(LOG_STR("sum")); }
|
void dump_config() override { this->log_config_(LOG_STR("sum")); }
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace esphome::coolix {
|
|||||||
const uint8_t COOLIX_TEMP_MIN = 17; // Celsius
|
const uint8_t COOLIX_TEMP_MIN = 17; // Celsius
|
||||||
const uint8_t COOLIX_TEMP_MAX = 30; // Celsius
|
const uint8_t COOLIX_TEMP_MAX = 30; // Celsius
|
||||||
|
|
||||||
class CoolixClimate : public climate_ir::ClimateIR {
|
class CoolixClimate final : public climate_ir::ClimateIR {
|
||||||
public:
|
public:
|
||||||
CoolixClimate()
|
CoolixClimate()
|
||||||
: climate_ir::ClimateIR(COOLIX_TEMP_MIN, COOLIX_TEMP_MAX, 1.0f, true, true,
|
: climate_ir::ClimateIR(COOLIX_TEMP_MIN, COOLIX_TEMP_MAX, 1.0f, true, true,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopyBinarySensor : public binary_sensor::BinarySensor, public Component {
|
class CopyBinarySensor final : public binary_sensor::BinarySensor, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(binary_sensor::BinarySensor *source) { source_ = source; }
|
void set_source(binary_sensor::BinarySensor *source) { source_ = source; }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopyButton : public button::Button, public Component {
|
class CopyButton final : public button::Button, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(button::Button *source) { source_ = source; }
|
void set_source(button::Button *source) { source_ = source; }
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopyCover : public cover::Cover, public Component {
|
class CopyCover final : public cover::Cover, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(cover::Cover *source) { source_ = source; }
|
void set_source(cover::Cover *source) { source_ = source; }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopyFan : public fan::Fan, public Component {
|
class CopyFan final : public fan::Fan, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(fan::Fan *source) { source_ = source; }
|
void set_source(fan::Fan *source) { source_ = source; }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopyLock : public lock::Lock, public Component {
|
class CopyLock final : public lock::Lock, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(lock::Lock *source) { source_ = source; }
|
void set_source(lock::Lock *source) { source_ = source; }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopyNumber : public number::Number, public Component {
|
class CopyNumber final : public number::Number, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(number::Number *source) { source_ = source; }
|
void set_source(number::Number *source) { source_ = source; }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopySelect : public select::Select, public Component {
|
class CopySelect final : public select::Select, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(select::Select *source) { source_ = source; }
|
void set_source(select::Select *source) { source_ = source; }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopySensor : public sensor::Sensor, public Component {
|
class CopySensor final : public sensor::Sensor, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(sensor::Sensor *source) { source_ = source; }
|
void set_source(sensor::Sensor *source) { source_ = source; }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopySwitch : public switch_::Switch, public Component {
|
class CopySwitch final : public switch_::Switch, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(switch_::Switch *source) { source_ = source; }
|
void set_source(switch_::Switch *source) { source_ = source; }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopyText : public text::Text, public Component {
|
class CopyText final : public text::Text, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(text::Text *source) { source_ = source; }
|
void set_source(text::Text *source) { source_ = source; }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::copy {
|
namespace esphome::copy {
|
||||||
|
|
||||||
class CopyTextSensor : public text_sensor::TextSensor, public Component {
|
class CopyTextSensor final : public text_sensor::TextSensor, public Component {
|
||||||
public:
|
public:
|
||||||
void set_source(text_sensor::TextSensor *source) { source_ = source; }
|
void set_source(text_sensor::TextSensor *source) { source_ = source; }
|
||||||
void setup() override;
|
void setup() override;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace esphome::cover {
|
namespace esphome::cover {
|
||||||
|
|
||||||
template<typename... Ts> class OpenAction : public Action<Ts...> {
|
template<typename... Ts> class OpenAction final : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
explicit OpenAction(Cover *cover) : cover_(cover) {}
|
explicit OpenAction(Cover *cover) : cover_(cover) {}
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ template<typename... Ts> class OpenAction : public Action<Ts...> {
|
|||||||
Cover *cover_;
|
Cover *cover_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class CloseAction : public Action<Ts...> {
|
template<typename... Ts> class CloseAction final : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
explicit CloseAction(Cover *cover) : cover_(cover) {}
|
explicit CloseAction(Cover *cover) : cover_(cover) {}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ template<typename... Ts> class CloseAction : public Action<Ts...> {
|
|||||||
Cover *cover_;
|
Cover *cover_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class StopAction : public Action<Ts...> {
|
template<typename... Ts> class StopAction final : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
explicit StopAction(Cover *cover) : cover_(cover) {}
|
explicit StopAction(Cover *cover) : cover_(cover) {}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ template<typename... Ts> class StopAction : public Action<Ts...> {
|
|||||||
Cover *cover_;
|
Cover *cover_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
template<typename... Ts> class ToggleAction final : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
explicit ToggleAction(Cover *cover) : cover_(cover) {}
|
explicit ToggleAction(Cover *cover) : cover_(cover) {}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
|||||||
// T &` if Ts already carries a const). This keeps trigger args no-copy
|
// T &` if Ts already carries a const). This keeps trigger args no-copy
|
||||||
// regardless of whether the trigger supplies `T`, `T &`, or `const T &`.
|
// regardless of whether the trigger supplies `T`, `T &`, or `const T &`.
|
||||||
|
|
||||||
template<typename... Ts> class ControlAction : public Action<Ts...> {
|
template<typename... Ts> class ControlAction final : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
using ApplyFn = void (*)(CoverCall &, const std::remove_cvref_t<Ts> &...);
|
using ApplyFn = void (*)(CoverCall &, const std::remove_cvref_t<Ts> &...);
|
||||||
ControlAction(Cover *cover, ApplyFn apply) : cover_(cover), apply_(apply) {}
|
ControlAction(Cover *cover, ApplyFn apply) : cover_(cover), apply_(apply) {}
|
||||||
@@ -75,7 +75,7 @@ template<typename... Ts> class ControlAction : public Action<Ts...> {
|
|||||||
ApplyFn apply_;
|
ApplyFn apply_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class CoverPublishAction : public Action<Ts...> {
|
template<typename... Ts> class CoverPublishAction final : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
using ApplyFn = void (*)(Cover *, const std::remove_cvref_t<Ts> &...);
|
using ApplyFn = void (*)(Cover *, const std::remove_cvref_t<Ts> &...);
|
||||||
CoverPublishAction(Cover *cover, ApplyFn apply) : cover_(cover), apply_(apply) {}
|
CoverPublishAction(Cover *cover, ApplyFn apply) : cover_(cover), apply_(apply) {}
|
||||||
@@ -90,7 +90,7 @@ template<typename... Ts> class CoverPublishAction : public Action<Ts...> {
|
|||||||
ApplyFn apply_;
|
ApplyFn apply_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<bool OPEN, typename... Ts> class CoverPositionCondition : public Condition<Ts...> {
|
template<bool OPEN, typename... Ts> class CoverPositionCondition final : public Condition<Ts...> {
|
||||||
public:
|
public:
|
||||||
CoverPositionCondition(Cover *cover) : cover_(cover) {}
|
CoverPositionCondition(Cover *cover) : cover_(cover) {}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ template<bool OPEN, typename... Ts> class CoverPositionCondition : public Condit
|
|||||||
template<typename... Ts> using CoverIsOpenCondition = CoverPositionCondition<true, Ts...>;
|
template<typename... Ts> using CoverIsOpenCondition = CoverPositionCondition<true, Ts...>;
|
||||||
template<typename... Ts> using CoverIsClosedCondition = CoverPositionCondition<false, Ts...>;
|
template<typename... Ts> using CoverIsClosedCondition = CoverPositionCondition<false, Ts...>;
|
||||||
|
|
||||||
template<bool OPEN> class CoverPositionTrigger : public Trigger<> {
|
template<bool OPEN> class CoverPositionTrigger final : public Trigger<> {
|
||||||
public:
|
public:
|
||||||
CoverPositionTrigger(Cover *a_cover) : cover_(a_cover) {
|
CoverPositionTrigger(Cover *a_cover) : cover_(a_cover) {
|
||||||
a_cover->add_on_state_callback([this]() {
|
a_cover->add_on_state_callback([this]() {
|
||||||
@@ -123,7 +123,7 @@ template<bool OPEN> class CoverPositionTrigger : public Trigger<> {
|
|||||||
using CoverOpenedTrigger = CoverPositionTrigger<true>;
|
using CoverOpenedTrigger = CoverPositionTrigger<true>;
|
||||||
using CoverClosedTrigger = CoverPositionTrigger<false>;
|
using CoverClosedTrigger = CoverPositionTrigger<false>;
|
||||||
|
|
||||||
template<CoverOperation OP> class CoverTrigger : public Trigger<> {
|
template<CoverOperation OP> class CoverTrigger final : public Trigger<> {
|
||||||
public:
|
public:
|
||||||
CoverTrigger(Cover *a_cover) : cover_(a_cover) {
|
CoverTrigger(Cover *a_cover) : cover_(a_cover) {
|
||||||
a_cover->add_on_state_callback([this]() {
|
a_cover->add_on_state_callback([this]() {
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ enum CS5460APGAGain {
|
|||||||
CS5460A_PGA_GAIN_50X = 0b1,
|
CS5460A_PGA_GAIN_50X = 0b1,
|
||||||
};
|
};
|
||||||
|
|
||||||
class CS5460AComponent : public Component,
|
class CS5460AComponent final : public Component,
|
||||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ> {
|
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ> {
|
||||||
public:
|
public:
|
||||||
void set_samples(uint32_t samples) { samples_ = samples; }
|
void set_samples(uint32_t samples) { samples_ = samples; }
|
||||||
void set_phase_offset(int8_t phase_offset) { phase_offset_ = phase_offset; }
|
void set_phase_offset(int8_t phase_offset) { phase_offset_ = phase_offset; }
|
||||||
@@ -108,7 +108,7 @@ class CS5460AComponent : public Component,
|
|||||||
uint32_t prev_raw_energy_{0};
|
uint32_t prev_raw_energy_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class CS5460ARestartAction : public Action<Ts...> {
|
template<typename... Ts> class CS5460ARestartAction final : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
CS5460ARestartAction(CS5460AComponent *cs5460a) : cs5460a_(cs5460a) {}
|
CS5460ARestartAction(CS5460AComponent *cs5460a) : cs5460a_(cs5460a) {}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ struct CSE7761DataStruct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// This class implements support for the CSE7761 UART power sensor.
|
/// This class implements support for the CSE7761 UART power sensor.
|
||||||
class CSE7761Component : public PollingComponent, public uart::UARTDevice {
|
class CSE7761Component final : public PollingComponent, public uart::UARTDevice {
|
||||||
public:
|
public:
|
||||||
void set_voltage_sensor(sensor::Sensor *voltage_sensor) { voltage_sensor_ = voltage_sensor; }
|
void set_voltage_sensor(sensor::Sensor *voltage_sensor) { voltage_sensor_ = voltage_sensor; }
|
||||||
void set_active_power_1_sensor(sensor::Sensor *power_sensor_1) { power_sensor_1_ = power_sensor_1; }
|
void set_active_power_1_sensor(sensor::Sensor *power_sensor_1) { power_sensor_1_ = power_sensor_1; }
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace esphome::cse7766 {
|
|||||||
|
|
||||||
static constexpr size_t CSE7766_RAW_DATA_SIZE = 24;
|
static constexpr size_t CSE7766_RAW_DATA_SIZE = 24;
|
||||||
|
|
||||||
class CSE7766Component : public Component, public uart::UARTDevice {
|
class CSE7766Component final : public Component, public uart::UARTDevice {
|
||||||
public:
|
public:
|
||||||
void set_voltage_sensor(sensor::Sensor *voltage_sensor) { voltage_sensor_ = voltage_sensor; }
|
void set_voltage_sensor(sensor::Sensor *voltage_sensor) { voltage_sensor_ = voltage_sensor; }
|
||||||
void set_current_sensor(sensor::Sensor *current_sensor) { current_sensor_ = current_sensor; }
|
void set_current_sensor(sensor::Sensor *current_sensor) { current_sensor_ = current_sensor; }
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
namespace esphome::cst226 {
|
namespace esphome::cst226 {
|
||||||
|
|
||||||
class CST226Button : public binary_sensor::BinarySensor,
|
class CST226Button final : public binary_sensor::BinarySensor,
|
||||||
public Component,
|
public Component,
|
||||||
public CST226ButtonListener,
|
public CST226ButtonListener,
|
||||||
public Parented<CST226Touchscreen> {
|
public Parented<CST226Touchscreen> {
|
||||||
public:
|
public:
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class CST226ButtonListener {
|
|||||||
virtual void update_button(bool state) = 0;
|
virtual void update_button(bool state) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CST226Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice {
|
class CST226Touchscreen final : public touchscreen::Touchscreen, public i2c::I2CDevice {
|
||||||
public:
|
public:
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void update_touches() override;
|
void update_touches() override;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class CST816ButtonListener {
|
|||||||
virtual void update_button(bool state) = 0;
|
virtual void update_button(bool state) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CST816Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice {
|
class CST816Touchscreen final : public touchscreen::Touchscreen, public i2c::I2CDevice {
|
||||||
public:
|
public:
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void update_touches() override;
|
void update_touches() override;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace esphome::ct_clamp {
|
namespace esphome::ct_clamp {
|
||||||
|
|
||||||
class CTClampSensor : public sensor::Sensor, public PollingComponent {
|
class CTClampSensor final : public sensor::Sensor, public PollingComponent {
|
||||||
public:
|
public:
|
||||||
void update() override;
|
void update() override;
|
||||||
void loop() override;
|
void loop() override;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace esphome::current_based {
|
namespace esphome::current_based {
|
||||||
|
|
||||||
class CurrentBasedCover : public cover::Cover, public Component {
|
class CurrentBasedCover final : public cover::Cover, public Component {
|
||||||
public:
|
public:
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void loop() override;
|
void loop() override;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace esphome::cwww {
|
namespace esphome::cwww {
|
||||||
|
|
||||||
class CWWWLightOutput : public light::LightOutput {
|
class CWWWLightOutput final : public light::LightOutput {
|
||||||
public:
|
public:
|
||||||
void set_cold_white(output::FloatOutput *cold_white) { cold_white_ = cold_white; }
|
void set_cold_white(output::FloatOutput *cold_white) { cold_white_ = cold_white; }
|
||||||
void set_warm_white(output::FloatOutput *warm_white) { warm_white_ = warm_white; }
|
void set_warm_white(output::FloatOutput *warm_white) { warm_white_ = warm_white; }
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace esphome::dac7678 {
|
|||||||
|
|
||||||
class DAC7678Output;
|
class DAC7678Output;
|
||||||
|
|
||||||
class DAC7678Channel : public output::FloatOutput, public Parented<DAC7678Output> {
|
class DAC7678Channel final : public output::FloatOutput, public Parented<DAC7678Output> {
|
||||||
public:
|
public:
|
||||||
void set_channel(uint8_t channel) { channel_ = channel; }
|
void set_channel(uint8_t channel) { channel_ = channel; }
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ class DAC7678Channel : public output::FloatOutput, public Parented<DAC7678Output
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// DAC7678 float output component.
|
/// DAC7678 float output component.
|
||||||
class DAC7678Output : public Component, public i2c::I2CDevice {
|
class DAC7678Output final : public Component, public i2c::I2CDevice {
|
||||||
public:
|
public:
|
||||||
DAC7678Output() {}
|
DAC7678Output() {}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const uint32_t DAIKIN_MESSAGE_SPACE = 32300;
|
|||||||
// State Frame size
|
// State Frame size
|
||||||
const uint8_t DAIKIN_STATE_FRAME_SIZE = 19;
|
const uint8_t DAIKIN_STATE_FRAME_SIZE = 19;
|
||||||
|
|
||||||
class DaikinClimate : public climate_ir::ClimateIR {
|
class DaikinClimate final : public climate_ir::ClimateIR {
|
||||||
public:
|
public:
|
||||||
DaikinClimate()
|
DaikinClimate()
|
||||||
: climate_ir::ClimateIR(DAIKIN_TEMP_MIN, DAIKIN_TEMP_MAX, 1.0f, true, true,
|
: climate_ir::ClimateIR(DAIKIN_TEMP_MIN, DAIKIN_TEMP_MAX, 1.0f, true, true,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const uint8_t DAIKIN_DBG_TOLERANCE = 25;
|
|||||||
// State Frame size
|
// State Frame size
|
||||||
const uint8_t DAIKIN_STATE_FRAME_SIZE = 19;
|
const uint8_t DAIKIN_STATE_FRAME_SIZE = 19;
|
||||||
|
|
||||||
class DaikinArcClimate : public climate_ir::ClimateIR {
|
class DaikinArcClimate final : public climate_ir::ClimateIR {
|
||||||
public:
|
public:
|
||||||
DaikinArcClimate()
|
DaikinArcClimate()
|
||||||
: climate_ir::ClimateIR(DAIKIN_TEMP_MIN, DAIKIN_TEMP_MAX, 0.5f, true, true,
|
: climate_ir::ClimateIR(DAIKIN_TEMP_MIN, DAIKIN_TEMP_MAX, 0.5f, true, true,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const uint8_t DAIKIN_BRC_PREAMBLE_SIZE = 7;
|
|||||||
// Transmit Frame size - includes a preamble
|
// Transmit Frame size - includes a preamble
|
||||||
const uint8_t DAIKIN_BRC_TRANSMIT_FRAME_SIZE = DAIKIN_BRC_PREAMBLE_SIZE + DAIKIN_BRC_STATE_FRAME_SIZE;
|
const uint8_t DAIKIN_BRC_TRANSMIT_FRAME_SIZE = DAIKIN_BRC_PREAMBLE_SIZE + DAIKIN_BRC_STATE_FRAME_SIZE;
|
||||||
|
|
||||||
class DaikinBrcClimate : public climate_ir::ClimateIR {
|
class DaikinBrcClimate final : public climate_ir::ClimateIR {
|
||||||
public:
|
public:
|
||||||
DaikinBrcClimate()
|
DaikinBrcClimate()
|
||||||
: climate_ir::ClimateIR(DAIKIN_BRC_TEMP_MIN_C, DAIKIN_BRC_TEMP_MAX_C, 0.5f, true, true,
|
: climate_ir::ClimateIR(DAIKIN_BRC_TEMP_MIN_C, DAIKIN_BRC_TEMP_MAX_C, 0.5f, true, true,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace esphome::dallas_temp {
|
namespace esphome::dallas_temp {
|
||||||
|
|
||||||
class DallasTemperatureSensor : public PollingComponent, public sensor::Sensor, public one_wire::OneWireDevice {
|
class DallasTemperatureSensor final : public PollingComponent, public sensor::Sensor, public one_wire::OneWireDevice {
|
||||||
public:
|
public:
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void update() override;
|
void update() override;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
namespace esphome::daly_bms {
|
namespace esphome::daly_bms {
|
||||||
|
|
||||||
class DalyBmsComponent : public PollingComponent, public uart::UARTDevice {
|
class DalyBmsComponent final : public PollingComponent, public uart::UARTDevice {
|
||||||
public:
|
public:
|
||||||
DalyBmsComponent() = default;
|
DalyBmsComponent() = default;
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class DateCall {
|
|||||||
optional<uint8_t> day_;
|
optional<uint8_t> day_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class DateSetAction : public Action<Ts...>, public Parented<DateEntity> {
|
template<typename... Ts> class DateSetAction final : public Action<Ts...>, public Parented<DateEntity> {
|
||||||
public:
|
public:
|
||||||
TEMPLATABLE_VALUE(ESPTime, date)
|
TEMPLATABLE_VALUE(ESPTime, date)
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class DateTimeBase : public EntityBase {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class DateTimeStateTrigger : public Trigger<ESPTime> {
|
class DateTimeStateTrigger final : public Trigger<ESPTime> {
|
||||||
public:
|
public:
|
||||||
explicit DateTimeStateTrigger(DateTimeBase *parent) : parent_(parent) {
|
explicit DateTimeStateTrigger(DateTimeBase *parent) : parent_(parent) {
|
||||||
parent->add_on_state_callback([this]() { this->trigger(this->parent_->state_as_esptime()); });
|
parent->add_on_state_callback([this]() { this->trigger(this->parent_->state_as_esptime()); });
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class DateTimeCall {
|
|||||||
optional<uint8_t> second_;
|
optional<uint8_t> second_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class DateTimeSetAction : public Action<Ts...>, public Parented<DateTimeEntity> {
|
template<typename... Ts> class DateTimeSetAction final : public Action<Ts...>, public Parented<DateTimeEntity> {
|
||||||
public:
|
public:
|
||||||
TEMPLATABLE_VALUE(ESPTime, datetime)
|
TEMPLATABLE_VALUE(ESPTime, datetime)
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ template<typename... Ts> class DateTimeSetAction : public Action<Ts...>, public
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USE_TIME
|
#ifdef USE_TIME
|
||||||
class OnDateTimeTrigger : public Trigger<>, public Component, public Parented<DateTimeEntity> {
|
class OnDateTimeTrigger final : public Trigger<>, public Component, public Parented<DateTimeEntity> {
|
||||||
public:
|
public:
|
||||||
void loop() override;
|
void loop() override;
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class TimeCall {
|
|||||||
optional<uint8_t> second_;
|
optional<uint8_t> second_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class TimeSetAction : public Action<Ts...>, public Parented<TimeEntity> {
|
template<typename... Ts> class TimeSetAction final : public Action<Ts...>, public Parented<TimeEntity> {
|
||||||
public:
|
public:
|
||||||
TEMPLATABLE_VALUE(ESPTime, time)
|
TEMPLATABLE_VALUE(ESPTime, time)
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ template<typename... Ts> class TimeSetAction : public Action<Ts...>, public Pare
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USE_TIME
|
#ifdef USE_TIME
|
||||||
class OnTimeTrigger : public Trigger<>, public Component, public Parented<TimeEntity> {
|
class OnTimeTrigger final : public Trigger<>, public Component, public Parented<TimeEntity> {
|
||||||
public:
|
public:
|
||||||
void loop() override;
|
void loop() override;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ static constexpr size_t WAKEUP_CAUSE_BUFFER_SIZE = 128;
|
|||||||
|
|
||||||
// buf_append_printf is now provided by esphome/core/helpers.h
|
// buf_append_printf is now provided by esphome/core/helpers.h
|
||||||
|
|
||||||
class DebugComponent : public PollingComponent {
|
class DebugComponent final : public PollingComponent {
|
||||||
public:
|
public:
|
||||||
void loop() override;
|
void loop() override;
|
||||||
void update() override;
|
void update() override;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ template<typename... Ts> class PreventDeepSleepAction;
|
|||||||
* and set_run_duration, then set how long the deep sleep should last using set_sleep_duration and optionally
|
* and set_run_duration, then set how long the deep sleep should last using set_sleep_duration and optionally
|
||||||
* on the ESP32 set_wakeup_pin.
|
* on the ESP32 set_wakeup_pin.
|
||||||
*/
|
*/
|
||||||
class DeepSleepComponent : public Component {
|
class DeepSleepComponent final : public Component {
|
||||||
public:
|
public:
|
||||||
/// Set the duration in ms the component should sleep once it's in deep sleep mode.
|
/// Set the duration in ms the component should sleep once it's in deep sleep mode.
|
||||||
void set_sleep_duration(uint32_t time_ms);
|
void set_sleep_duration(uint32_t time_ms);
|
||||||
@@ -161,7 +161,7 @@ class DeepSleepComponent : public Component {
|
|||||||
|
|
||||||
extern bool global_has_deep_sleep; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
extern bool global_has_deep_sleep; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
|
|
||||||
template<typename... Ts> class EnterDeepSleepAction : public Action<Ts...> {
|
template<typename... Ts> class EnterDeepSleepAction final : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
EnterDeepSleepAction(DeepSleepComponent *deep_sleep) : deep_sleep_(deep_sleep) {}
|
EnterDeepSleepAction(DeepSleepComponent *deep_sleep) : deep_sleep_(deep_sleep) {}
|
||||||
TEMPLATABLE_VALUE(uint32_t, sleep_duration);
|
TEMPLATABLE_VALUE(uint32_t, sleep_duration);
|
||||||
@@ -233,12 +233,13 @@ template<typename... Ts> class EnterDeepSleepAction : public Action<Ts...> {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class PreventDeepSleepAction : public Action<Ts...>, public Parented<DeepSleepComponent> {
|
template<typename... Ts>
|
||||||
|
class PreventDeepSleepAction final : public Action<Ts...>, public Parented<DeepSleepComponent> {
|
||||||
public:
|
public:
|
||||||
void play(const Ts &...x) override { this->parent_->prevent_deep_sleep(); }
|
void play(const Ts &...x) override { this->parent_->prevent_deep_sleep(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class AllowDeepSleepAction : public Action<Ts...>, public Parented<DeepSleepComponent> {
|
template<typename... Ts> class AllowDeepSleepAction final : public Action<Ts...>, public Parented<DeepSleepComponent> {
|
||||||
public:
|
public:
|
||||||
void play(const Ts &...x) override { this->parent_->allow_deep_sleep(); }
|
void play(const Ts &...x) override { this->parent_->allow_deep_sleep(); }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const uint32_t DELONGHI_ZERO_SPACE = 670;
|
|||||||
// State Frame size
|
// State Frame size
|
||||||
const uint8_t DELONGHI_STATE_FRAME_SIZE = 8;
|
const uint8_t DELONGHI_STATE_FRAME_SIZE = 8;
|
||||||
|
|
||||||
class DelonghiClimate : public climate_ir::ClimateIR {
|
class DelonghiClimate final : public climate_ir::ClimateIR {
|
||||||
public:
|
public:
|
||||||
DelonghiClimate()
|
DelonghiClimate()
|
||||||
: climate_ir::ClimateIR(DELONGHI_TEMP_MIN, DELONGHI_TEMP_MAX, 1.0f, true, true,
|
: climate_ir::ClimateIR(DELONGHI_TEMP_MIN, DELONGHI_TEMP_MAX, 1.0f, true, true,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ enum class DemoAlarmControlPanelType {
|
|||||||
TYPE_3,
|
TYPE_3,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DemoAlarmControlPanel : public AlarmControlPanel, public Component {
|
class DemoAlarmControlPanel final : public AlarmControlPanel, public Component {
|
||||||
public:
|
public:
|
||||||
void setup() override {}
|
void setup() override {}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoBinarySensor : public binary_sensor::BinarySensor, public PollingComponent {
|
class DemoBinarySensor final : public binary_sensor::BinarySensor, public PollingComponent {
|
||||||
public:
|
public:
|
||||||
void setup() override { this->publish_initial_state(false); }
|
void setup() override { this->publish_initial_state(false); }
|
||||||
void update() override {
|
void update() override {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoButton : public button::Button {
|
class DemoButton final : public button::Button {
|
||||||
protected:
|
protected:
|
||||||
void press_action() override {}
|
void press_action() override {}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ enum class DemoClimateType {
|
|||||||
TYPE_3,
|
TYPE_3,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DemoClimate : public climate::Climate, public Component {
|
class DemoClimate final : public climate::Climate, public Component {
|
||||||
public:
|
public:
|
||||||
void set_type(DemoClimateType type) { type_ = type; }
|
void set_type(DemoClimateType type) { type_ = type; }
|
||||||
void setup() override {
|
void setup() override {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ enum class DemoCoverType {
|
|||||||
TYPE_4,
|
TYPE_4,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DemoCover : public cover::Cover, public Component {
|
class DemoCover final : public cover::Cover, public Component {
|
||||||
public:
|
public:
|
||||||
void set_type(DemoCoverType type) { type_ = type; }
|
void set_type(DemoCoverType type) { type_ = type; }
|
||||||
void setup() override {
|
void setup() override {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoDate : public datetime::DateEntity, public Component {
|
class DemoDate final : public datetime::DateEntity, public Component {
|
||||||
public:
|
public:
|
||||||
void setup() override {
|
void setup() override {
|
||||||
this->year_ = 2038;
|
this->year_ = 2038;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoDateTime : public datetime::DateTimeEntity, public Component {
|
class DemoDateTime final : public datetime::DateTimeEntity, public Component {
|
||||||
public:
|
public:
|
||||||
void setup() override {
|
void setup() override {
|
||||||
this->year_ = 2038;
|
this->year_ = 2038;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ enum class DemoFanType {
|
|||||||
TYPE_4,
|
TYPE_4,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DemoFan : public fan::Fan, public Component {
|
class DemoFan final : public fan::Fan, public Component {
|
||||||
public:
|
public:
|
||||||
void set_type(DemoFanType type) { type_ = type; }
|
void set_type(DemoFanType type) { type_ = type; }
|
||||||
fan::FanTraits get_traits() override {
|
fan::FanTraits get_traits() override {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ enum class DemoLightType {
|
|||||||
TYPE_7,
|
TYPE_7,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DemoLight : public light::LightOutput, public Component {
|
class DemoLight final : public light::LightOutput, public Component {
|
||||||
public:
|
public:
|
||||||
void set_type(DemoLightType type) { type_ = type; }
|
void set_type(DemoLightType type) { type_ = type; }
|
||||||
light::LightTraits get_traits() override {
|
light::LightTraits get_traits() override {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoLock : public lock::Lock {
|
class DemoLock final : public lock::Lock {
|
||||||
protected:
|
protected:
|
||||||
void control(const lock::LockCall &call) override {
|
void control(const lock::LockCall &call) override {
|
||||||
auto state = call.get_state();
|
auto state = call.get_state();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ enum class DemoNumberType {
|
|||||||
TYPE_3,
|
TYPE_3,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DemoNumber : public number::Number, public Component {
|
class DemoNumber final : public number::Number, public Component {
|
||||||
public:
|
public:
|
||||||
void set_type(DemoNumberType type) { type_ = type; }
|
void set_type(DemoNumberType type) { type_ = type; }
|
||||||
void setup() override {
|
void setup() override {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoSelect : public select::Select, public Component {
|
class DemoSelect final : public select::Select, public Component {
|
||||||
protected:
|
protected:
|
||||||
void control(size_t index) override { this->publish_state(index); }
|
void control(size_t index) override { this->publish_state(index); }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoSensor : public sensor::Sensor, public PollingComponent {
|
class DemoSensor final : public sensor::Sensor, public PollingComponent {
|
||||||
public:
|
public:
|
||||||
void update() override {
|
void update() override {
|
||||||
float val = random_float();
|
float val = random_float();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoSwitch : public switch_::Switch, public Component {
|
class DemoSwitch final : public switch_::Switch, public Component {
|
||||||
public:
|
public:
|
||||||
void setup() override {
|
void setup() override {
|
||||||
bool initial = random_float() < 0.5;
|
bool initial = random_float() < 0.5;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoText : public text::Text, public Component {
|
class DemoText final : public text::Text, public Component {
|
||||||
public:
|
public:
|
||||||
void setup() override { this->publish_state("I am a text entity"); }
|
void setup() override { this->publish_state("I am a text entity"); }
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoTextSensor : public text_sensor::TextSensor, public PollingComponent {
|
class DemoTextSensor final : public text_sensor::TextSensor, public PollingComponent {
|
||||||
public:
|
public:
|
||||||
void update() override {
|
void update() override {
|
||||||
float val = random_float();
|
float val = random_float();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace esphome::demo {
|
namespace esphome::demo {
|
||||||
|
|
||||||
class DemoTime : public datetime::TimeEntity, public Component {
|
class DemoTime final : public datetime::TimeEntity, public Component {
|
||||||
public:
|
public:
|
||||||
void setup() override {
|
void setup() override {
|
||||||
this->hour_ = 3;
|
this->hour_ = 3;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ enum class DemoValveType {
|
|||||||
TYPE_2,
|
TYPE_2,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DemoValve : public valve::Valve {
|
class DemoValve final : public valve::Valve {
|
||||||
public:
|
public:
|
||||||
valve::ValveTraits get_traits() override {
|
valve::ValveTraits get_traits() override {
|
||||||
valve::ValveTraits traits;
|
valve::ValveTraits traits;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace esphome::dew_point {
|
namespace esphome::dew_point {
|
||||||
|
|
||||||
class DewPointComponent : public Component, public sensor::Sensor {
|
class DewPointComponent final : public Component, public sensor::Sensor {
|
||||||
public:
|
public:
|
||||||
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { this->temperature_sensor_ = temperature_sensor; }
|
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { this->temperature_sensor_ = temperature_sensor; }
|
||||||
void set_humidity_sensor(sensor::Sensor *humidity_sensor) { this->humidity_sensor_ = humidity_sensor; }
|
void set_humidity_sensor(sensor::Sensor *humidity_sensor) { this->humidity_sensor_ = humidity_sensor; }
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ enum Device {
|
|||||||
|
|
||||||
// See the datasheet here:
|
// See the datasheet here:
|
||||||
// https://github.com/DFRobot/DFRobotDFPlayerMini/blob/master/doc/FN-M16P%2BEmbedded%2BMP3%2BAudio%2BModule%2BDatasheet.pdf
|
// https://github.com/DFRobot/DFRobotDFPlayerMini/blob/master/doc/FN-M16P%2BEmbedded%2BMP3%2BAudio%2BModule%2BDatasheet.pdf
|
||||||
class DFPlayer : public uart::UARTDevice, public Component {
|
class DFPlayer final : public uart::UARTDevice, public Component {
|
||||||
public:
|
public:
|
||||||
void loop() override;
|
void loop() override;
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ class DFPlayer : public uart::UARTDevice, public Component {
|
|||||||
DFPLAYER_SIMPLE_ACTION(NextAction, next)
|
DFPLAYER_SIMPLE_ACTION(NextAction, next)
|
||||||
DFPLAYER_SIMPLE_ACTION(PreviousAction, previous)
|
DFPLAYER_SIMPLE_ACTION(PreviousAction, previous)
|
||||||
|
|
||||||
template<typename... Ts> class PlayMp3Action : public Action<Ts...>, public Parented<DFPlayer> {
|
template<typename... Ts> class PlayMp3Action final : public Action<Ts...>, public Parented<DFPlayer> {
|
||||||
public:
|
public:
|
||||||
TEMPLATABLE_VALUE(uint16_t, file)
|
TEMPLATABLE_VALUE(uint16_t, file)
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ template<typename... Ts> class PlayMp3Action : public Action<Ts...>, public Pare
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class PlayFileAction : public Action<Ts...>, public Parented<DFPlayer> {
|
template<typename... Ts> class PlayFileAction final : public Action<Ts...>, public Parented<DFPlayer> {
|
||||||
public:
|
public:
|
||||||
TEMPLATABLE_VALUE(uint16_t, file)
|
TEMPLATABLE_VALUE(uint16_t, file)
|
||||||
TEMPLATABLE_VALUE(bool, loop)
|
TEMPLATABLE_VALUE(bool, loop)
|
||||||
@@ -108,7 +108,7 @@ template<typename... Ts> class PlayFileAction : public Action<Ts...>, public Par
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class PlayFolderAction : public Action<Ts...>, public Parented<DFPlayer> {
|
template<typename... Ts> class PlayFolderAction final : public Action<Ts...>, public Parented<DFPlayer> {
|
||||||
public:
|
public:
|
||||||
TEMPLATABLE_VALUE(uint16_t, folder)
|
TEMPLATABLE_VALUE(uint16_t, folder)
|
||||||
TEMPLATABLE_VALUE(uint16_t, file)
|
TEMPLATABLE_VALUE(uint16_t, file)
|
||||||
@@ -126,7 +126,7 @@ template<typename... Ts> class PlayFolderAction : public Action<Ts...>, public P
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class SetDeviceAction : public Action<Ts...>, public Parented<DFPlayer> {
|
template<typename... Ts> class SetDeviceAction final : public Action<Ts...>, public Parented<DFPlayer> {
|
||||||
public:
|
public:
|
||||||
TEMPLATABLE_VALUE(Device, device)
|
TEMPLATABLE_VALUE(Device, device)
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ template<typename... Ts> class SetDeviceAction : public Action<Ts...>, public Pa
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class SetVolumeAction : public Action<Ts...>, public Parented<DFPlayer> {
|
template<typename... Ts> class SetVolumeAction final : public Action<Ts...>, public Parented<DFPlayer> {
|
||||||
public:
|
public:
|
||||||
TEMPLATABLE_VALUE(uint8_t, volume)
|
TEMPLATABLE_VALUE(uint8_t, volume)
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ template<typename... Ts> class SetVolumeAction : public Action<Ts...>, public Pa
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class SetEqAction : public Action<Ts...>, public Parented<DFPlayer> {
|
template<typename... Ts> class SetEqAction final : public Action<Ts...>, public Parented<DFPlayer> {
|
||||||
public:
|
public:
|
||||||
TEMPLATABLE_VALUE(EqPreset, eq)
|
TEMPLATABLE_VALUE(EqPreset, eq)
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ DFPLAYER_SIMPLE_ACTION(RandomAction, random)
|
|||||||
DFPLAYER_SIMPLE_ACTION(VolumeUpAction, volume_up)
|
DFPLAYER_SIMPLE_ACTION(VolumeUpAction, volume_up)
|
||||||
DFPLAYER_SIMPLE_ACTION(VolumeDownAction, volume_down)
|
DFPLAYER_SIMPLE_ACTION(VolumeDownAction, volume_down)
|
||||||
|
|
||||||
template<typename... Ts> class DFPlayerIsPlayingCondition : public Condition<Ts...>, public Parented<DFPlayer> {
|
template<typename... Ts> class DFPlayerIsPlayingCondition final : public Condition<Ts...>, public Parented<DFPlayer> {
|
||||||
public:
|
public:
|
||||||
bool check(const Ts &...x) override { return this->parent_->is_playing(); }
|
bool check(const Ts &...x) override { return this->parent_->is_playing(); }
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user