mirror of
https://github.com/esphome/esphome.git
synced 2025-11-05 17:41:49 +00:00
Compare commits
1 Commits
dev
...
remote_bas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
358296a57e |
@@ -105,7 +105,7 @@ template<typename... Ts> class AGS10NewI2cAddressAction : public Action<Ts...>,
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, new_address)
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->new_i2c_address(this->new_address_.value(x...)); }
|
||||
void play(Ts... x) override { this->parent_->new_i2c_address(this->new_address_.value(x...)); }
|
||||
};
|
||||
|
||||
enum AGS10SetZeroPointActionMode {
|
||||
@@ -122,7 +122,7 @@ template<typename... Ts> class AGS10SetZeroPointAction : public Action<Ts...>, p
|
||||
TEMPLATABLE_VALUE(uint16_t, value)
|
||||
TEMPLATABLE_VALUE(AGS10SetZeroPointActionMode, mode)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
switch (this->mode_.value(x...)) {
|
||||
case FACTORY_DEFAULT:
|
||||
this->parent_->set_zero_point_with_factory_defaults();
|
||||
|
||||
@@ -13,7 +13,7 @@ template<typename... Ts> class SetAutoMuteAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(uint8_t, auto_mute_mode)
|
||||
|
||||
void play(const Ts &...x) override { this->aic3204_->set_auto_mute_mode(this->auto_mute_mode_.value(x...)); }
|
||||
void play(Ts... x) override { this->aic3204_->set_auto_mute_mode(this->auto_mute_mode_.value(x...)); }
|
||||
|
||||
protected:
|
||||
AIC3204 *aic3204_;
|
||||
|
||||
@@ -89,7 +89,7 @@ template<typename... Ts> class ArmAwayAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(std::string, code)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->alarm_control_panel_->make_call();
|
||||
auto code = this->code_.optional_value(x...);
|
||||
if (code.has_value()) {
|
||||
@@ -109,7 +109,7 @@ template<typename... Ts> class ArmHomeAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(std::string, code)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->alarm_control_panel_->make_call();
|
||||
auto code = this->code_.optional_value(x...);
|
||||
if (code.has_value()) {
|
||||
@@ -129,7 +129,7 @@ template<typename... Ts> class ArmNightAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(std::string, code)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->alarm_control_panel_->make_call();
|
||||
auto code = this->code_.optional_value(x...);
|
||||
if (code.has_value()) {
|
||||
@@ -149,7 +149,7 @@ template<typename... Ts> class DisarmAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(std::string, code)
|
||||
|
||||
void play(const Ts &...x) override { this->alarm_control_panel_->disarm(this->code_.optional_value(x...)); }
|
||||
void play(Ts... x) override { this->alarm_control_panel_->disarm(this->code_.optional_value(x...)); }
|
||||
|
||||
protected:
|
||||
AlarmControlPanel *alarm_control_panel_;
|
||||
@@ -159,7 +159,7 @@ template<typename... Ts> class PendingAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit PendingAction(AlarmControlPanel *alarm_control_panel) : alarm_control_panel_(alarm_control_panel) {}
|
||||
|
||||
void play(const Ts &...x) override { this->alarm_control_panel_->make_call().pending().perform(); }
|
||||
void play(Ts... x) override { this->alarm_control_panel_->make_call().pending().perform(); }
|
||||
|
||||
protected:
|
||||
AlarmControlPanel *alarm_control_panel_;
|
||||
@@ -169,7 +169,7 @@ template<typename... Ts> class TriggeredAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit TriggeredAction(AlarmControlPanel *alarm_control_panel) : alarm_control_panel_(alarm_control_panel) {}
|
||||
|
||||
void play(const Ts &...x) override { this->alarm_control_panel_->make_call().triggered().perform(); }
|
||||
void play(Ts... x) override { this->alarm_control_panel_->make_call().triggered().perform(); }
|
||||
|
||||
protected:
|
||||
AlarmControlPanel *alarm_control_panel_;
|
||||
@@ -178,7 +178,7 @@ template<typename... Ts> class TriggeredAction : public Action<Ts...> {
|
||||
template<typename... Ts> class AlarmControlPanelCondition : public Condition<Ts...> {
|
||||
public:
|
||||
AlarmControlPanelCondition(AlarmControlPanel *parent) : parent_(parent) {}
|
||||
bool check(const Ts &...x) override {
|
||||
bool check(Ts... x) override {
|
||||
return this->parent_->is_state_armed(this->parent_->get_state()) ||
|
||||
this->parent_->get_state() == ACP_STATE_PENDING || this->parent_->get_state() == ACP_STATE_TRIGGERED;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class Animation : public image::Image {
|
||||
template<typename... Ts> class AnimationNextFrameAction : public Action<Ts...> {
|
||||
public:
|
||||
AnimationNextFrameAction(Animation *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) override { this->parent_->next_frame(); }
|
||||
void play(Ts... x) override { this->parent_->next_frame(); }
|
||||
|
||||
protected:
|
||||
Animation *parent_;
|
||||
@@ -48,7 +48,7 @@ template<typename... Ts> class AnimationNextFrameAction : public Action<Ts...> {
|
||||
template<typename... Ts> class AnimationPrevFrameAction : public Action<Ts...> {
|
||||
public:
|
||||
AnimationPrevFrameAction(Animation *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) override { this->parent_->prev_frame(); }
|
||||
void play(Ts... x) override { this->parent_->prev_frame(); }
|
||||
|
||||
protected:
|
||||
Animation *parent_;
|
||||
@@ -58,7 +58,7 @@ template<typename... Ts> class AnimationSetFrameAction : public Action<Ts...> {
|
||||
public:
|
||||
AnimationSetFrameAction(Animation *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(uint16_t, frame)
|
||||
void play(const Ts &...x) override { this->parent_->set_frame(this->frame_.value(x...)); }
|
||||
void play(Ts... x) override { this->parent_->set_frame(this->frame_.value(x...)); }
|
||||
|
||||
protected:
|
||||
Animation *parent_;
|
||||
|
||||
@@ -237,7 +237,7 @@ extern APIServer *global_api_server; // NOLINT(cppcoreguidelines-avoid-non-cons
|
||||
|
||||
template<typename... Ts> class APIConnectedCondition : public Condition<Ts...> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return global_api_server->is_connected(); }
|
||||
bool check(Ts... x) override { return global_api_server->is_connected(); }
|
||||
};
|
||||
|
||||
} // namespace esphome::api
|
||||
|
||||
@@ -133,7 +133,7 @@ template<typename... Ts> class HomeAssistantServiceCallAction : public Action<Ts
|
||||
Trigger<std::string, Ts...> *get_error_trigger() const { return this->error_trigger_; }
|
||||
#endif // USE_API_HOMEASSISTANT_ACTION_RESPONSES
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
HomeassistantActionRequest resp;
|
||||
std::string service_value = this->service_.value(x...);
|
||||
resp.set_service(StringRef(service_value));
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace at581x {
|
||||
|
||||
template<typename... Ts> class AT581XResetAction : public Action<Ts...>, public Parented<AT581XComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) { this->parent_->reset_hardware_frontend(); }
|
||||
void play(Ts... x) { this->parent_->reset_hardware_frontend(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class AT581XSettingsAction : public Action<Ts...>, public Parented<AT581XComponent> {
|
||||
@@ -25,7 +25,7 @@ template<typename... Ts> class AT581XSettingsAction : public Action<Ts...>, publ
|
||||
TEMPLATABLE_VALUE(int, trigger_keep)
|
||||
TEMPLATABLE_VALUE(int, stage_gain)
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
if (this->frequency_.has_value()) {
|
||||
int v = this->frequency_.value(x...);
|
||||
this->parent_->set_frequency(v);
|
||||
|
||||
@@ -13,7 +13,7 @@ template<typename... Ts> class SetMicGainAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(float, mic_gain)
|
||||
|
||||
void play(const Ts &...x) override { this->audio_adc_->set_mic_gain(this->mic_gain_.value(x...)); }
|
||||
void play(Ts... x) override { this->audio_adc_->set_mic_gain(this->mic_gain_.value(x...)); }
|
||||
|
||||
protected:
|
||||
AudioAdc *audio_adc_;
|
||||
|
||||
@@ -11,7 +11,7 @@ template<typename... Ts> class MuteOffAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit MuteOffAction(AudioDac *audio_dac) : audio_dac_(audio_dac) {}
|
||||
|
||||
void play(const Ts &...x) override { this->audio_dac_->set_mute_off(); }
|
||||
void play(Ts... x) override { this->audio_dac_->set_mute_off(); }
|
||||
|
||||
protected:
|
||||
AudioDac *audio_dac_;
|
||||
@@ -21,7 +21,7 @@ template<typename... Ts> class MuteOnAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit MuteOnAction(AudioDac *audio_dac) : audio_dac_(audio_dac) {}
|
||||
|
||||
void play(const Ts &...x) override { this->audio_dac_->set_mute_on(); }
|
||||
void play(Ts... x) override { this->audio_dac_->set_mute_on(); }
|
||||
|
||||
protected:
|
||||
AudioDac *audio_dac_;
|
||||
@@ -33,7 +33,7 @@ template<typename... Ts> class SetVolumeAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(float, volume)
|
||||
|
||||
void play(const Ts &...x) override { this->audio_dac_->set_volume(this->volume_.value(x...)); }
|
||||
void play(Ts... x) override { this->audio_dac_->set_volume(this->volume_.value(x...)); }
|
||||
|
||||
protected:
|
||||
AudioDac *audio_dac_;
|
||||
|
||||
@@ -141,7 +141,7 @@ class StateChangeTrigger : public Trigger<optional<bool>, optional<bool> > {
|
||||
template<typename... Ts> class BinarySensorCondition : public Condition<Ts...> {
|
||||
public:
|
||||
BinarySensorCondition(BinarySensor *parent, bool state) : parent_(parent), state_(state) {}
|
||||
bool check(const Ts &...x) override { return this->parent_->state == this->state_; }
|
||||
bool check(Ts... x) override { return this->parent_->state == this->state_; }
|
||||
|
||||
protected:
|
||||
BinarySensor *parent_;
|
||||
@@ -153,7 +153,7 @@ template<typename... Ts> class BinarySensorPublishAction : public Action<Ts...>
|
||||
explicit BinarySensorPublishAction(BinarySensor *sensor) : sensor_(sensor) {}
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto val = this->state_.value(x...);
|
||||
this->sensor_->publish_state(val);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ template<typename... Ts> class BinarySensorInvalidateAction : public Action<Ts..
|
||||
public:
|
||||
explicit BinarySensorInvalidateAction(BinarySensor *sensor) : sensor_(sensor) {}
|
||||
|
||||
void play(const Ts &...x) override { this->sensor_->invalidate_state(); }
|
||||
void play(Ts... x) override { this->sensor_->invalidate_state(); }
|
||||
|
||||
protected:
|
||||
BinarySensor *sensor_;
|
||||
|
||||
@@ -89,7 +89,7 @@ class BL0906 : public PollingComponent, public uart::UARTDevice {
|
||||
|
||||
template<typename... Ts> class ResetEnergyAction : public Action<Ts...>, public Parented<BL0906> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->enqueue_action_(&BL0906::reset_energy_); }
|
||||
void play(Ts... x) override { this->parent_->enqueue_action_(&BL0906::reset_energy_); }
|
||||
};
|
||||
|
||||
} // namespace bl0906
|
||||
|
||||
@@ -123,9 +123,9 @@ template<typename... Ts> class BLEClientWriteAction : public Action<Ts...>, publ
|
||||
this->has_simple_value_ = true;
|
||||
}
|
||||
|
||||
void play(const Ts &...x) override {}
|
||||
void play(Ts... x) override {}
|
||||
|
||||
void play_complex(const Ts &...x) override {
|
||||
void play_complex(Ts... x) override {
|
||||
this->num_running_++;
|
||||
this->var_ = std::make_tuple(x...);
|
||||
auto value = this->has_simple_value_ ? this->value_.simple : this->value_.template_func(x...);
|
||||
@@ -229,7 +229,7 @@ template<typename... Ts> class BLEClientPasskeyReplyAction : public Action<Ts...
|
||||
public:
|
||||
BLEClientPasskeyReplyAction(BLEClient *ble_client) { parent_ = ble_client; }
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
uint32_t passkey;
|
||||
if (has_simple_value_) {
|
||||
passkey = this->value_.simple;
|
||||
@@ -266,7 +266,7 @@ template<typename... Ts> class BLEClientNumericComparisonReplyAction : public Ac
|
||||
public:
|
||||
BLEClientNumericComparisonReplyAction(BLEClient *ble_client) { parent_ = ble_client; }
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
esp_bd_addr_t remote_bda;
|
||||
memcpy(remote_bda, parent_->get_remote_bda(), sizeof(esp_bd_addr_t));
|
||||
if (has_simple_value_) {
|
||||
@@ -299,7 +299,7 @@ template<typename... Ts> class BLEClientRemoveBondAction : public Action<Ts...>
|
||||
public:
|
||||
BLEClientRemoveBondAction(BLEClient *ble_client) { parent_ = ble_client; }
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
esp_bd_addr_t remote_bda;
|
||||
memcpy(remote_bda, parent_->get_remote_bda(), sizeof(esp_bd_addr_t));
|
||||
esp_ble_remove_bond_device(remote_bda);
|
||||
@@ -334,9 +334,9 @@ template<typename... Ts> class BLEClientConnectAction : public Action<Ts...>, pu
|
||||
}
|
||||
|
||||
// not used since we override play_complex_
|
||||
void play(const Ts &...x) override {}
|
||||
void play(Ts... x) override {}
|
||||
|
||||
void play_complex(const Ts &...x) override {
|
||||
void play_complex(Ts... x) override {
|
||||
// it makes no sense to have multiple instances of this running at the same time.
|
||||
// this would occur only if the same automation was re-triggered while still
|
||||
// running. So just cancel the second chain if this is detected.
|
||||
@@ -379,9 +379,9 @@ template<typename... Ts> class BLEClientDisconnectAction : public Action<Ts...>,
|
||||
}
|
||||
|
||||
// not used since we override play_complex_
|
||||
void play(const Ts &...x) override {}
|
||||
void play(Ts... x) override {}
|
||||
|
||||
void play_complex(const Ts &...x) override {
|
||||
void play_complex(Ts... x) override {
|
||||
this->num_running_++;
|
||||
if (this->node_state == espbt::ClientState::IDLE) {
|
||||
this->play_next_(x...);
|
||||
|
||||
@@ -11,7 +11,7 @@ template<typename... Ts> class PressAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit PressAction(Button *button) : button_(button) {}
|
||||
|
||||
void play(const Ts &...x) override { this->button_->press(); }
|
||||
void play(Ts... x) override { this->button_->press(); }
|
||||
|
||||
protected:
|
||||
Button *button_;
|
||||
|
||||
@@ -129,7 +129,7 @@ template<typename... Ts> class CanbusSendAction : public Action<Ts...>, public P
|
||||
this->remote_transmission_request_ = remote_transmission_request;
|
||||
}
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto can_id = this->can_id_.has_value() ? *this->can_id_ : this->parent_->can_id_;
|
||||
auto use_extended_id =
|
||||
this->use_extended_id_.has_value() ? *this->use_extended_id_ : this->parent_->use_extended_id_;
|
||||
|
||||
@@ -22,7 +22,7 @@ template<typename... Ts> class ControlAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(std::string, custom_preset)
|
||||
TEMPLATABLE_VALUE(ClimateSwingMode, swing_mode)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->climate_->make_call();
|
||||
call.set_mode(this->mode_.optional_value(x...));
|
||||
call.set_target_temperature(this->target_temperature_.optional_value(x...));
|
||||
|
||||
@@ -30,7 +30,7 @@ template<typename... Ts> class CM1106CalibrateZeroAction : public Action<Ts...>
|
||||
public:
|
||||
CM1106CalibrateZeroAction(CM1106Component *cm1106) : cm1106_(cm1106) {}
|
||||
|
||||
void play(const Ts &...x) override { this->cm1106_->calibrate_zero(400); }
|
||||
void play(Ts... x) override { this->cm1106_->calibrate_zero(400); }
|
||||
|
||||
protected:
|
||||
CM1106Component *cm1106_;
|
||||
|
||||
@@ -11,7 +11,7 @@ template<typename... Ts> class OpenAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit OpenAction(Cover *cover) : cover_(cover) {}
|
||||
|
||||
void play(const Ts &...x) override { this->cover_->make_call().set_command_open().perform(); }
|
||||
void play(Ts... x) override { this->cover_->make_call().set_command_open().perform(); }
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
@@ -21,7 +21,7 @@ template<typename... Ts> class CloseAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit CloseAction(Cover *cover) : cover_(cover) {}
|
||||
|
||||
void play(const Ts &...x) override { this->cover_->make_call().set_command_close().perform(); }
|
||||
void play(Ts... x) override { this->cover_->make_call().set_command_close().perform(); }
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
@@ -31,7 +31,7 @@ template<typename... Ts> class StopAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit StopAction(Cover *cover) : cover_(cover) {}
|
||||
|
||||
void play(const Ts &...x) override { this->cover_->make_call().set_command_stop().perform(); }
|
||||
void play(Ts... x) override { this->cover_->make_call().set_command_stop().perform(); }
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
@@ -41,7 +41,7 @@ template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit ToggleAction(Cover *cover) : cover_(cover) {}
|
||||
|
||||
void play(const Ts &...x) override { this->cover_->make_call().set_command_toggle().perform(); }
|
||||
void play(Ts... x) override { this->cover_->make_call().set_command_toggle().perform(); }
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
@@ -55,7 +55,7 @@ template<typename... Ts> class ControlAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(float, position)
|
||||
TEMPLATABLE_VALUE(float, tilt)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->cover_->make_call();
|
||||
if (this->stop_.has_value())
|
||||
call.set_stop(this->stop_.value(x...));
|
||||
@@ -77,7 +77,7 @@ template<typename... Ts> class CoverPublishAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(float, tilt)
|
||||
TEMPLATABLE_VALUE(CoverOperation, current_operation)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
if (this->position_.has_value())
|
||||
this->cover_->position = this->position_.value(x...);
|
||||
if (this->tilt_.has_value())
|
||||
@@ -94,7 +94,7 @@ template<typename... Ts> class CoverPublishAction : public Action<Ts...> {
|
||||
template<typename... Ts> class CoverIsOpenCondition : public Condition<Ts...> {
|
||||
public:
|
||||
CoverIsOpenCondition(Cover *cover) : cover_(cover) {}
|
||||
bool check(const Ts &...x) override { return this->cover_->is_fully_open(); }
|
||||
bool check(Ts... x) override { return this->cover_->is_fully_open(); }
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
@@ -103,7 +103,7 @@ template<typename... Ts> class CoverIsOpenCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class CoverIsClosedCondition : public Condition<Ts...> {
|
||||
public:
|
||||
CoverIsClosedCondition(Cover *cover) : cover_(cover) {}
|
||||
bool check(const Ts &...x) override { return this->cover_->is_fully_closed(); }
|
||||
bool check(Ts... x) override { return this->cover_->is_fully_closed(); }
|
||||
|
||||
protected:
|
||||
Cover *cover_;
|
||||
|
||||
@@ -114,7 +114,7 @@ template<typename... Ts> class CS5460ARestartAction : public Action<Ts...> {
|
||||
public:
|
||||
CS5460ARestartAction(CS5460AComponent *cs5460a) : cs5460a_(cs5460a) {}
|
||||
|
||||
void play(const Ts &...x) override { cs5460a_->restart(); }
|
||||
void play(Ts... x) override { cs5460a_->restart(); }
|
||||
|
||||
protected:
|
||||
CS5460AComponent *cs5460a_;
|
||||
|
||||
@@ -101,7 +101,7 @@ template<typename... Ts> class DateSetAction : public Action<Ts...>, public Pare
|
||||
public:
|
||||
TEMPLATABLE_VALUE(ESPTime, date)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->parent_->make_call();
|
||||
|
||||
if (this->date_.has_value()) {
|
||||
|
||||
@@ -124,7 +124,7 @@ template<typename... Ts> class DateTimeSetAction : public Action<Ts...>, public
|
||||
public:
|
||||
TEMPLATABLE_VALUE(ESPTime, datetime)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->parent_->make_call();
|
||||
|
||||
if (this->datetime_.has_value()) {
|
||||
|
||||
@@ -103,7 +103,7 @@ template<typename... Ts> class TimeSetAction : public Action<Ts...>, public Pare
|
||||
public:
|
||||
TEMPLATABLE_VALUE(ESPTime, time)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->parent_->make_call();
|
||||
|
||||
if (this->time_.has_value()) {
|
||||
|
||||
@@ -148,7 +148,7 @@ template<typename... Ts> class EnterDeepSleepAction : public Action<Ts...> {
|
||||
void set_time(time::RealTimeClock *time) { this->time_ = time; }
|
||||
#endif
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
if (this->sleep_duration_.has_value()) {
|
||||
this->deep_sleep_->set_sleep_duration(this->sleep_duration_.value(x...));
|
||||
}
|
||||
@@ -207,12 +207,12 @@ template<typename... Ts> class EnterDeepSleepAction : public Action<Ts...> {
|
||||
|
||||
template<typename... Ts> class PreventDeepSleepAction : public Action<Ts...>, public Parented<DeepSleepComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->prevent_deep_sleep(); }
|
||||
void play(Ts... x) override { this->parent_->prevent_deep_sleep(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class AllowDeepSleepAction : public Action<Ts...>, public Parented<DeepSleepComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->allow_deep_sleep(); }
|
||||
void play(Ts... x) override { this->parent_->allow_deep_sleep(); }
|
||||
};
|
||||
|
||||
} // namespace deep_sleep
|
||||
|
||||
@@ -77,7 +77,7 @@ class DFPlayer : public uart::UARTDevice, public Component {
|
||||
class ACTION_CLASS : /* NOLINT */ \
|
||||
public Action<Ts...>, \
|
||||
public Parented<DFPlayer> { \
|
||||
void play(const Ts &...x) override { this->parent_->ACTION_METHOD(); } \
|
||||
void play(Ts... x) override { this->parent_->ACTION_METHOD(); } \
|
||||
};
|
||||
|
||||
DFPLAYER_SIMPLE_ACTION(NextAction, next)
|
||||
@@ -87,7 +87,7 @@ template<typename... Ts> class PlayMp3Action : public Action<Ts...>, public Pare
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint16_t, file)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto file = this->file_.value(x...);
|
||||
this->parent_->play_mp3(file);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ template<typename... Ts> class PlayFileAction : public Action<Ts...>, public Par
|
||||
TEMPLATABLE_VALUE(uint16_t, file)
|
||||
TEMPLATABLE_VALUE(bool, loop)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto file = this->file_.value(x...);
|
||||
auto loop = this->loop_.value(x...);
|
||||
if (loop) {
|
||||
@@ -115,7 +115,7 @@ template<typename... Ts> class PlayFolderAction : public Action<Ts...>, public P
|
||||
TEMPLATABLE_VALUE(uint16_t, file)
|
||||
TEMPLATABLE_VALUE(bool, loop)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto folder = this->folder_.value(x...);
|
||||
auto file = this->file_.value(x...);
|
||||
auto loop = this->loop_.value(x...);
|
||||
@@ -131,7 +131,7 @@ template<typename... Ts> class SetDeviceAction : public Action<Ts...>, public Pa
|
||||
public:
|
||||
TEMPLATABLE_VALUE(Device, device)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto device = this->device_.value(x...);
|
||||
this->parent_->set_device(device);
|
||||
}
|
||||
@@ -141,7 +141,7 @@ template<typename... Ts> class SetVolumeAction : public Action<Ts...>, public Pa
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, volume)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto volume = this->volume_.value(x...);
|
||||
this->parent_->set_volume(volume);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ template<typename... Ts> class SetEqAction : public Action<Ts...>, public Parent
|
||||
public:
|
||||
TEMPLATABLE_VALUE(EqPreset, eq)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto eq = this->eq_.value(x...);
|
||||
this->parent_->set_eq(eq);
|
||||
}
|
||||
@@ -168,7 +168,7 @@ DFPLAYER_SIMPLE_ACTION(VolumeDownAction, volume_down)
|
||||
|
||||
template<typename... Ts> class DFPlayerIsPlayingCondition : public Condition<Ts...>, public Parented<DFPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_playing(); }
|
||||
bool check(Ts... x) override { return this->parent_->is_playing(); }
|
||||
};
|
||||
|
||||
class DFPlayerFinishedPlaybackTrigger : public Trigger<> {
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace dfrobot_sen0395 {
|
||||
template<typename... Ts>
|
||||
class DfrobotSen0395ResetAction : public Action<Ts...>, public Parented<DfrobotSen0395Component> {
|
||||
public:
|
||||
void play(const Ts &...x) { this->parent_->enqueue(make_unique<ResetSystemCommand>()); }
|
||||
void play(Ts... x) { this->parent_->enqueue(make_unique<ResetSystemCommand>()); }
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
@@ -33,7 +33,7 @@ class DfrobotSen0395SettingsAction : public Action<Ts...>, public Parented<Dfrob
|
||||
TEMPLATABLE_VALUE(float, det_min4)
|
||||
TEMPLATABLE_VALUE(float, det_max4)
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
this->parent_->enqueue(make_unique<PowerCommand>(0));
|
||||
if (this->factory_reset_.has_value() && this->factory_reset_.value(x...) == true) {
|
||||
this->parent_->enqueue(make_unique<FactoryResetCommand>());
|
||||
|
||||
@@ -819,7 +819,7 @@ template<typename... Ts> class DisplayPageShowAction : public Action<Ts...> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(DisplayPage *, page)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto *page = this->page_.value(x...);
|
||||
if (page != nullptr) {
|
||||
page->show();
|
||||
@@ -831,7 +831,7 @@ template<typename... Ts> class DisplayPageShowNextAction : public Action<Ts...>
|
||||
public:
|
||||
DisplayPageShowNextAction(Display *buffer) : buffer_(buffer) {}
|
||||
|
||||
void play(const Ts &...x) override { this->buffer_->show_next_page(); }
|
||||
void play(Ts... x) override { this->buffer_->show_next_page(); }
|
||||
|
||||
Display *buffer_;
|
||||
};
|
||||
@@ -840,7 +840,7 @@ template<typename... Ts> class DisplayPageShowPrevAction : public Action<Ts...>
|
||||
public:
|
||||
DisplayPageShowPrevAction(Display *buffer) : buffer_(buffer) {}
|
||||
|
||||
void play(const Ts &...x) override { this->buffer_->show_prev_page(); }
|
||||
void play(Ts... x) override { this->buffer_->show_prev_page(); }
|
||||
|
||||
Display *buffer_;
|
||||
};
|
||||
@@ -850,7 +850,7 @@ template<typename... Ts> class DisplayIsDisplayingPageCondition : public Conditi
|
||||
DisplayIsDisplayingPageCondition(Display *parent) : parent_(parent) {}
|
||||
|
||||
void set_page(DisplayPage *page) { this->page_ = page; }
|
||||
bool check(const Ts &...x) override { return this->parent_->get_active_page() == this->page_; }
|
||||
bool check(Ts... x) override { return this->parent_->get_active_page() == this->page_; }
|
||||
|
||||
protected:
|
||||
Display *parent_;
|
||||
|
||||
@@ -10,7 +10,7 @@ template<typename... Ts> class UpAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit UpAction(DisplayMenuComponent *menu) : menu_(menu) {}
|
||||
|
||||
void play(const Ts &...x) override { this->menu_->up(); }
|
||||
void play(Ts... x) override { this->menu_->up(); }
|
||||
|
||||
protected:
|
||||
DisplayMenuComponent *menu_;
|
||||
@@ -20,7 +20,7 @@ template<typename... Ts> class DownAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit DownAction(DisplayMenuComponent *menu) : menu_(menu) {}
|
||||
|
||||
void play(const Ts &...x) override { this->menu_->down(); }
|
||||
void play(Ts... x) override { this->menu_->down(); }
|
||||
|
||||
protected:
|
||||
DisplayMenuComponent *menu_;
|
||||
@@ -30,7 +30,7 @@ template<typename... Ts> class LeftAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit LeftAction(DisplayMenuComponent *menu) : menu_(menu) {}
|
||||
|
||||
void play(const Ts &...x) override { this->menu_->left(); }
|
||||
void play(Ts... x) override { this->menu_->left(); }
|
||||
|
||||
protected:
|
||||
DisplayMenuComponent *menu_;
|
||||
@@ -40,7 +40,7 @@ template<typename... Ts> class RightAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit RightAction(DisplayMenuComponent *menu) : menu_(menu) {}
|
||||
|
||||
void play(const Ts &...x) override { this->menu_->right(); }
|
||||
void play(Ts... x) override { this->menu_->right(); }
|
||||
|
||||
protected:
|
||||
DisplayMenuComponent *menu_;
|
||||
@@ -50,7 +50,7 @@ template<typename... Ts> class EnterAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit EnterAction(DisplayMenuComponent *menu) : menu_(menu) {}
|
||||
|
||||
void play(const Ts &...x) override { this->menu_->enter(); }
|
||||
void play(Ts... x) override { this->menu_->enter(); }
|
||||
|
||||
protected:
|
||||
DisplayMenuComponent *menu_;
|
||||
@@ -60,7 +60,7 @@ template<typename... Ts> class ShowAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit ShowAction(DisplayMenuComponent *menu) : menu_(menu) {}
|
||||
|
||||
void play(const Ts &...x) override { this->menu_->show(); }
|
||||
void play(Ts... x) override { this->menu_->show(); }
|
||||
|
||||
protected:
|
||||
DisplayMenuComponent *menu_;
|
||||
@@ -70,7 +70,7 @@ template<typename... Ts> class HideAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit HideAction(DisplayMenuComponent *menu) : menu_(menu) {}
|
||||
|
||||
void play(const Ts &...x) override { this->menu_->hide(); }
|
||||
void play(Ts... x) override { this->menu_->hide(); }
|
||||
|
||||
protected:
|
||||
DisplayMenuComponent *menu_;
|
||||
@@ -80,7 +80,7 @@ template<typename... Ts> class ShowMainAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit ShowMainAction(DisplayMenuComponent *menu) : menu_(menu) {}
|
||||
|
||||
void play(const Ts &...x) override { this->menu_->show_main(); }
|
||||
void play(Ts... x) override { this->menu_->show_main(); }
|
||||
|
||||
protected:
|
||||
DisplayMenuComponent *menu_;
|
||||
@@ -88,7 +88,7 @@ template<typename... Ts> class ShowMainAction : public Action<Ts...> {
|
||||
template<typename... Ts> class IsActiveCondition : public Condition<Ts...> {
|
||||
public:
|
||||
explicit IsActiveCondition(DisplayMenuComponent *menu) : menu_(menu) {}
|
||||
bool check(const Ts &...x) override { return this->menu_->is_active(); }
|
||||
bool check(Ts... x) override { return this->menu_->is_active(); }
|
||||
|
||||
protected:
|
||||
DisplayMenuComponent *menu_;
|
||||
|
||||
@@ -59,12 +59,12 @@ class DS1307Component : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
|
||||
template<typename... Ts> class WriteAction : public Action<Ts...>, public Parented<DS1307Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->write_time(); }
|
||||
void play(Ts... x) override { this->parent_->write_time(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class ReadAction : public Action<Ts...>, public Parented<DS1307Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->read_time(); }
|
||||
void play(Ts... x) override { this->parent_->read_time(); }
|
||||
};
|
||||
} // namespace ds1307
|
||||
} // namespace esphome
|
||||
|
||||
@@ -51,15 +51,15 @@ class DutyTimeSensor : public sensor::Sensor, public PollingComponent {
|
||||
template<typename... Ts> class BaseAction : public Action<Ts...>, public Parented<DutyTimeSensor> {};
|
||||
|
||||
template<typename... Ts> class StartAction : public BaseAction<Ts...> {
|
||||
void play(const Ts &...x) override { this->parent_->start(); }
|
||||
void play(Ts... x) override { this->parent_->start(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class StopAction : public BaseAction<Ts...> {
|
||||
void play(const Ts &...x) override { this->parent_->stop(); }
|
||||
void play(Ts... x) override { this->parent_->stop(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class ResetAction : public BaseAction<Ts...> {
|
||||
void play(const Ts &...x) override { this->parent_->reset(); }
|
||||
void play(Ts... x) override { this->parent_->reset(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class RunningCondition : public Condition<Ts...>, public Parented<DutyTimeSensor> {
|
||||
@@ -67,7 +67,7 @@ template<typename... Ts> class RunningCondition : public Condition<Ts...>, publi
|
||||
explicit RunningCondition(DutyTimeSensor *parent, bool state) : Parented(parent), state_(state) {}
|
||||
|
||||
protected:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_running() == this->state_; }
|
||||
bool check(Ts... x) override { return this->parent_->is_running() == this->state_; }
|
||||
bool state_;
|
||||
};
|
||||
|
||||
|
||||
@@ -214,17 +214,17 @@ extern ESP32BLE *global_ble;
|
||||
|
||||
template<typename... Ts> class BLEEnabledCondition : public Condition<Ts...> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return global_ble->is_active(); }
|
||||
bool check(Ts... x) override { return global_ble->is_active(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class BLEEnableAction : public Action<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { global_ble->enable(); }
|
||||
void play(Ts... x) override { global_ble->enable(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class BLEDisableAction : public Action<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { global_ble->disable(); }
|
||||
void play(Ts... x) override { global_ble->disable(); }
|
||||
};
|
||||
|
||||
} // namespace esphome::esp32_ble
|
||||
|
||||
@@ -71,7 +71,7 @@ template<typename... Ts> class BLECharacteristicSetValueAction : public Action<T
|
||||
BLECharacteristicSetValueAction(BLECharacteristic *characteristic) : parent_(characteristic) {}
|
||||
TEMPLATABLE_VALUE(std::vector<uint8_t>, buffer)
|
||||
void set_buffer(ByteBuffer buffer) { this->set_buffer(buffer.get_data()); }
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
// If the listener is already set, do nothing
|
||||
if (BLECharacteristicSetValueActionManager::get_instance()->has_listener(this->parent_))
|
||||
return;
|
||||
@@ -96,7 +96,7 @@ template<typename... Ts> class BLECharacteristicSetValueAction : public Action<T
|
||||
template<typename... Ts> class BLECharacteristicNotifyAction : public Action<Ts...> {
|
||||
public:
|
||||
BLECharacteristicNotifyAction(BLECharacteristic *characteristic) : parent_(characteristic) {}
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
#ifdef USE_ESP32_BLE_SERVER_SET_VALUE_ACTION
|
||||
// Call the pre-notify event
|
||||
BLECharacteristicSetValueActionManager::get_instance()->emit_pre_notify(this->parent_);
|
||||
@@ -116,7 +116,7 @@ template<typename... Ts> class BLEDescriptorSetValueAction : public Action<Ts...
|
||||
BLEDescriptorSetValueAction(BLEDescriptor *descriptor) : parent_(descriptor) {}
|
||||
TEMPLATABLE_VALUE(std::vector<uint8_t>, buffer)
|
||||
void set_buffer(ByteBuffer buffer) { this->set_buffer(buffer.get_data()); }
|
||||
void play(const Ts &...x) override { this->parent_->set_value(this->buffer_.value(x...)); }
|
||||
void play(Ts... x) override { this->parent_->set_value(this->buffer_.value(x...)); }
|
||||
|
||||
protected:
|
||||
BLEDescriptor *parent_;
|
||||
|
||||
@@ -96,7 +96,7 @@ template<typename... Ts> class ESP32BLEStartScanAction : public Action<Ts...> {
|
||||
public:
|
||||
ESP32BLEStartScanAction(ESP32BLETracker *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(bool, continuous)
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->set_scan_continuous(this->continuous_.value(x...));
|
||||
this->parent_->start_scan();
|
||||
}
|
||||
@@ -107,7 +107,7 @@ template<typename... Ts> class ESP32BLEStartScanAction : public Action<Ts...> {
|
||||
|
||||
template<typename... Ts> class ESP32BLEStopScanAction : public Action<Ts...>, public Parented<ESP32BLETracker> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->stop_scan(); }
|
||||
void play(Ts... x) override { this->parent_->stop_scan(); }
|
||||
};
|
||||
|
||||
} // namespace esphome::esp32_ble_tracker
|
||||
|
||||
@@ -40,7 +40,7 @@ template<typename... Ts> class SetFrequencyAction : public Action<Ts...> {
|
||||
SetFrequencyAction(ESP8266PWM *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(float, frequency);
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
float freq = this->frequency_.value(x...);
|
||||
this->parent_->update_frequency(freq);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ template<typename... Ts> class AdjustAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(float, voltage)
|
||||
|
||||
void play(const Ts &...x) override { this->ldo_->adjust_voltage(this->voltage_.value(x...)); }
|
||||
void play(Ts... x) override { this->ldo_->adjust_voltage(this->voltage_.value(x...)); }
|
||||
|
||||
protected:
|
||||
EspLdo *ldo_;
|
||||
|
||||
@@ -36,7 +36,7 @@ template<typename... Ts> class SendAction : public Action<Ts...>, public Parente
|
||||
void set_wait_for_sent(bool wait_for_sent) { this->flags_.wait_for_sent = wait_for_sent; }
|
||||
void set_continue_on_error(bool continue_on_error) { this->flags_.continue_on_error = continue_on_error; }
|
||||
|
||||
void play_complex(const Ts &...x) override {
|
||||
void play_complex(Ts... x) override {
|
||||
this->num_running_++;
|
||||
send_callback_t send_callback = [this, x...](esp_err_t status) {
|
||||
if (status == ESP_OK) {
|
||||
@@ -67,7 +67,7 @@ template<typename... Ts> class SendAction : public Action<Ts...>, public Parente
|
||||
}
|
||||
}
|
||||
|
||||
void play(const Ts &...x) override { /* ignore - see play_complex */
|
||||
void play(Ts... x) override { /* ignore - see play_complex */
|
||||
}
|
||||
|
||||
void stop() override {
|
||||
@@ -90,7 +90,7 @@ template<typename... Ts> class AddPeerAction : public Action<Ts...>, public Pare
|
||||
TEMPLATABLE_VALUE(peer_address_t, address);
|
||||
|
||||
public:
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
peer_address_t address = this->address_.value(x...);
|
||||
this->parent_->add_peer(address.data());
|
||||
}
|
||||
@@ -100,7 +100,7 @@ template<typename... Ts> class DeletePeerAction : public Action<Ts...>, public P
|
||||
TEMPLATABLE_VALUE(peer_address_t, address);
|
||||
|
||||
public:
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
peer_address_t address = this->address_.value(x...);
|
||||
this->parent_->del_peer(address.data());
|
||||
}
|
||||
@@ -109,7 +109,7 @@ template<typename... Ts> class DeletePeerAction : public Action<Ts...>, public P
|
||||
template<typename... Ts> class SetChannelAction : public Action<Ts...>, public Parented<ESPNowComponent> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, channel)
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
if (this->parent_->is_wifi_enabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ template<typename... Ts> class TriggerEventAction : public Action<Ts...>, public
|
||||
public:
|
||||
TEMPLATABLE_VALUE(std::string, event_type)
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->trigger(this->event_type_.value(x...)); }
|
||||
void play(Ts... x) override { this->parent_->trigger(this->event_type_.value(x...)); }
|
||||
};
|
||||
|
||||
class EventTrigger : public Trigger<std::string> {
|
||||
|
||||
@@ -17,35 +17,35 @@ class LedTrigger : public Trigger<bool> {
|
||||
class CustomTrigger : public Trigger<std::string> {
|
||||
public:
|
||||
explicit CustomTrigger(EZOSensor *ezo) {
|
||||
ezo->add_custom_callback([this](const std::string &value) { this->trigger(value); });
|
||||
ezo->add_custom_callback([this](std::string value) { this->trigger(std::move(value)); });
|
||||
}
|
||||
};
|
||||
|
||||
class TTrigger : public Trigger<std::string> {
|
||||
public:
|
||||
explicit TTrigger(EZOSensor *ezo) {
|
||||
ezo->add_t_callback([this](const std::string &value) { this->trigger(value); });
|
||||
ezo->add_t_callback([this](std::string value) { this->trigger(std::move(value)); });
|
||||
}
|
||||
};
|
||||
|
||||
class CalibrationTrigger : public Trigger<std::string> {
|
||||
public:
|
||||
explicit CalibrationTrigger(EZOSensor *ezo) {
|
||||
ezo->add_calibration_callback([this](const std::string &value) { this->trigger(value); });
|
||||
ezo->add_calibration_callback([this](std::string value) { this->trigger(std::move(value)); });
|
||||
}
|
||||
};
|
||||
|
||||
class SlopeTrigger : public Trigger<std::string> {
|
||||
public:
|
||||
explicit SlopeTrigger(EZOSensor *ezo) {
|
||||
ezo->add_slope_callback([this](const std::string &value) { this->trigger(value); });
|
||||
ezo->add_slope_callback([this](std::string value) { this->trigger(std::move(value)); });
|
||||
}
|
||||
};
|
||||
|
||||
class DeviceInformationTrigger : public Trigger<std::string> {
|
||||
public:
|
||||
explicit DeviceInformationTrigger(EZOSensor *ezo) {
|
||||
ezo->add_device_infomation_callback([this](const std::string &value) { this->trigger(value); });
|
||||
ezo->add_device_infomation_callback([this](std::string value) { this->trigger(std::move(value)); });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ template<typename... Ts> class EzoPMPFindAction : public Action<Ts...> {
|
||||
public:
|
||||
EzoPMPFindAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override { this->ezopmp_->find(); }
|
||||
void play(Ts... x) override { this->ezopmp_->find(); }
|
||||
|
||||
protected:
|
||||
EzoPMP *ezopmp_;
|
||||
@@ -129,7 +129,7 @@ template<typename... Ts> class EzoPMPDoseContinuouslyAction : public Action<Ts..
|
||||
public:
|
||||
EzoPMPDoseContinuouslyAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override { this->ezopmp_->dose_continuously(); }
|
||||
void play(Ts... x) override { this->ezopmp_->dose_continuously(); }
|
||||
|
||||
protected:
|
||||
EzoPMP *ezopmp_;
|
||||
@@ -139,7 +139,7 @@ template<typename... Ts> class EzoPMPDoseVolumeAction : public Action<Ts...> {
|
||||
public:
|
||||
EzoPMPDoseVolumeAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override { this->ezopmp_->dose_volume(this->volume_.value(x...)); }
|
||||
void play(Ts... x) override { this->ezopmp_->dose_volume(this->volume_.value(x...)); }
|
||||
TEMPLATABLE_VALUE(double, volume)
|
||||
|
||||
protected:
|
||||
@@ -150,7 +150,7 @@ template<typename... Ts> class EzoPMPDoseVolumeOverTimeAction : public Action<Ts
|
||||
public:
|
||||
EzoPMPDoseVolumeOverTimeAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->ezopmp_->dose_volume_over_time(this->volume_.value(x...), this->duration_.value(x...));
|
||||
}
|
||||
TEMPLATABLE_VALUE(double, volume)
|
||||
@@ -164,7 +164,7 @@ template<typename... Ts> class EzoPMPDoseWithConstantFlowRateAction : public Act
|
||||
public:
|
||||
EzoPMPDoseWithConstantFlowRateAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->ezopmp_->dose_with_constant_flow_rate(this->volume_.value(x...), this->duration_.value(x...));
|
||||
}
|
||||
TEMPLATABLE_VALUE(double, volume)
|
||||
@@ -178,7 +178,7 @@ template<typename... Ts> class EzoPMPSetCalibrationVolumeAction : public Action<
|
||||
public:
|
||||
EzoPMPSetCalibrationVolumeAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override { this->ezopmp_->set_calibration_volume(this->volume_.value(x...)); }
|
||||
void play(Ts... x) override { this->ezopmp_->set_calibration_volume(this->volume_.value(x...)); }
|
||||
TEMPLATABLE_VALUE(double, volume)
|
||||
|
||||
protected:
|
||||
@@ -189,7 +189,7 @@ template<typename... Ts> class EzoPMPClearTotalVolumeDispensedAction : public Ac
|
||||
public:
|
||||
EzoPMPClearTotalVolumeDispensedAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override { this->ezopmp_->clear_total_volume_dosed(); }
|
||||
void play(Ts... x) override { this->ezopmp_->clear_total_volume_dosed(); }
|
||||
|
||||
protected:
|
||||
EzoPMP *ezopmp_;
|
||||
@@ -199,7 +199,7 @@ template<typename... Ts> class EzoPMPClearCalibrationAction : public Action<Ts..
|
||||
public:
|
||||
EzoPMPClearCalibrationAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override { this->ezopmp_->clear_calibration(); }
|
||||
void play(Ts... x) override { this->ezopmp_->clear_calibration(); }
|
||||
|
||||
protected:
|
||||
EzoPMP *ezopmp_;
|
||||
@@ -209,7 +209,7 @@ template<typename... Ts> class EzoPMPPauseDosingAction : public Action<Ts...> {
|
||||
public:
|
||||
EzoPMPPauseDosingAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override { this->ezopmp_->pause_dosing(); }
|
||||
void play(Ts... x) override { this->ezopmp_->pause_dosing(); }
|
||||
|
||||
protected:
|
||||
EzoPMP *ezopmp_;
|
||||
@@ -219,7 +219,7 @@ template<typename... Ts> class EzoPMPStopDosingAction : public Action<Ts...> {
|
||||
public:
|
||||
EzoPMPStopDosingAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override { this->ezopmp_->stop_dosing(); }
|
||||
void play(Ts... x) override { this->ezopmp_->stop_dosing(); }
|
||||
|
||||
protected:
|
||||
EzoPMP *ezopmp_;
|
||||
@@ -229,7 +229,7 @@ template<typename... Ts> class EzoPMPChangeI2CAddressAction : public Action<Ts..
|
||||
public:
|
||||
EzoPMPChangeI2CAddressAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override { this->ezopmp_->change_i2c_address(this->address_.value(x...)); }
|
||||
void play(Ts... x) override { this->ezopmp_->change_i2c_address(this->address_.value(x...)); }
|
||||
TEMPLATABLE_VALUE(int, address)
|
||||
|
||||
protected:
|
||||
@@ -240,7 +240,7 @@ template<typename... Ts> class EzoPMPArbitraryCommandAction : public Action<Ts..
|
||||
public:
|
||||
EzoPMPArbitraryCommandAction(EzoPMP *ezopmp) : ezopmp_(ezopmp) {}
|
||||
|
||||
void play(const Ts &...x) override { this->ezopmp_->exec_arbitrary_command(this->command_.value(x...)); }
|
||||
void play(Ts... x) override { this->ezopmp_->exec_arbitrary_command(this->command_.value(x...)); }
|
||||
TEMPLATABLE_VALUE(std::string, command)
|
||||
|
||||
protected:
|
||||
|
||||
@@ -15,7 +15,7 @@ template<typename... Ts> class TurnOnAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(int, speed)
|
||||
TEMPLATABLE_VALUE(FanDirection, direction)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->state_->turn_on();
|
||||
if (this->oscillating_.has_value()) {
|
||||
call.set_oscillating(this->oscillating_.value(x...));
|
||||
@@ -36,7 +36,7 @@ template<typename... Ts> class TurnOffAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit TurnOffAction(Fan *state) : state_(state) {}
|
||||
|
||||
void play(const Ts &...x) override { this->state_->turn_off().perform(); }
|
||||
void play(Ts... x) override { this->state_->turn_off().perform(); }
|
||||
|
||||
Fan *state_;
|
||||
};
|
||||
@@ -45,7 +45,7 @@ template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit ToggleAction(Fan *state) : state_(state) {}
|
||||
|
||||
void play(const Ts &...x) override { this->state_->toggle().perform(); }
|
||||
void play(Ts... x) override { this->state_->toggle().perform(); }
|
||||
|
||||
Fan *state_;
|
||||
};
|
||||
@@ -56,7 +56,7 @@ template<typename... Ts> class CycleSpeedAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(bool, no_off_cycle)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
// check to see if fan supports speeds and is on
|
||||
if (this->state_->get_traits().supported_speed_count()) {
|
||||
if (this->state_->state) {
|
||||
@@ -97,7 +97,7 @@ template<typename... Ts> class CycleSpeedAction : public Action<Ts...> {
|
||||
template<typename... Ts> class FanIsOnCondition : public Condition<Ts...> {
|
||||
public:
|
||||
explicit FanIsOnCondition(Fan *state) : state_(state) {}
|
||||
bool check(const Ts &...x) override { return this->state_->state; }
|
||||
bool check(Ts... x) override { return this->state_->state; }
|
||||
|
||||
protected:
|
||||
Fan *state_;
|
||||
@@ -105,7 +105,7 @@ template<typename... Ts> class FanIsOnCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class FanIsOffCondition : public Condition<Ts...> {
|
||||
public:
|
||||
explicit FanIsOffCondition(Fan *state) : state_(state) {}
|
||||
bool check(const Ts &...x) override { return !this->state_->state; }
|
||||
bool check(Ts... x) override { return !this->state_->state; }
|
||||
|
||||
protected:
|
||||
Fan *state_;
|
||||
|
||||
@@ -273,7 +273,7 @@ template<typename... Ts> class EnrollmentAction : public Action<Ts...>, public P
|
||||
TEMPLATABLE_VALUE(uint16_t, finger_id)
|
||||
TEMPLATABLE_VALUE(uint8_t, num_scans)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto finger_id = this->finger_id_.value(x...);
|
||||
auto num_scans = this->num_scans_.value(x...);
|
||||
if (num_scans) {
|
||||
@@ -287,14 +287,14 @@ template<typename... Ts> class EnrollmentAction : public Action<Ts...>, public P
|
||||
template<typename... Ts>
|
||||
class CancelEnrollmentAction : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->finish_enrollment(1); }
|
||||
void play(Ts... x) override { this->parent_->finish_enrollment(1); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class DeleteAction : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint16_t, finger_id)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto finger_id = this->finger_id_.value(x...);
|
||||
this->parent_->delete_fingerprint(finger_id);
|
||||
}
|
||||
@@ -302,14 +302,14 @@ template<typename... Ts> class DeleteAction : public Action<Ts...>, public Paren
|
||||
|
||||
template<typename... Ts> class DeleteAllAction : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->delete_all_fingerprints(); }
|
||||
void play(Ts... x) override { this->parent_->delete_all_fingerprints(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class LEDControlAction : public Action<Ts...>, public Parented<FingerprintGrowComponent> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto state = this->state_.value(x...);
|
||||
this->parent_->led_control(state);
|
||||
}
|
||||
@@ -322,7 +322,7 @@ template<typename... Ts> class AuraLEDControlAction : public Action<Ts...>, publ
|
||||
TEMPLATABLE_VALUE(uint8_t, color)
|
||||
TEMPLATABLE_VALUE(uint8_t, count)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto state = this->state_.value(x...);
|
||||
auto speed = this->speed_.value(x...);
|
||||
auto color = this->color_.value(x...);
|
||||
|
||||
@@ -134,7 +134,7 @@ template<class C, typename... Ts> class GlobalVarSetAction : public Action<Ts...
|
||||
|
||||
TEMPLATABLE_VALUE(T, value);
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->value() = this->value_.value(x...); }
|
||||
void play(Ts... x) override { this->parent_->value() = this->value_.value(x...); }
|
||||
|
||||
protected:
|
||||
C *parent_;
|
||||
|
||||
@@ -168,7 +168,7 @@ class GROVETB6612FNGMotorRunAction : public Action<Ts...>, public Parented<Grove
|
||||
TEMPLATABLE_VALUE(uint8_t, channel)
|
||||
TEMPLATABLE_VALUE(uint16_t, speed)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto channel = this->channel_.value(x...);
|
||||
auto speed = this->speed_.value(x...);
|
||||
this->parent_->dc_motor_run(channel, speed);
|
||||
@@ -180,7 +180,7 @@ class GROVETB6612FNGMotorBrakeAction : public Action<Ts...>, public Parented<Gro
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, channel)
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->dc_motor_brake(this->channel_.value(x...)); }
|
||||
void play(Ts... x) override { this->parent_->dc_motor_brake(this->channel_.value(x...)); }
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
@@ -188,19 +188,19 @@ class GROVETB6612FNGMotorStopAction : public Action<Ts...>, public Parented<Grov
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, channel)
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->dc_motor_stop(this->channel_.value(x...)); }
|
||||
void play(Ts... x) override { this->parent_->dc_motor_stop(this->channel_.value(x...)); }
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
class GROVETB6612FNGMotorStandbyAction : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->standby(); }
|
||||
void play(Ts... x) override { this->parent_->standby(); }
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
class GROVETB6612FNGMotorNoStandbyAction : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->not_standby(); }
|
||||
void play(Ts... x) override { this->parent_->not_standby(); }
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
@@ -208,7 +208,7 @@ class GROVETB6612FNGMotorChangeAddressAction : public Action<Ts...>, public Pare
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, address)
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->set_i2c_addr(this->address_.value(x...)); }
|
||||
void play(Ts... x) override { this->parent_->set_i2c_addr(this->address_.value(x...)); }
|
||||
};
|
||||
|
||||
} // namespace grove_tb6612fng
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace haier {
|
||||
template<typename... Ts> class DisplayOnAction : public Action<Ts...> {
|
||||
public:
|
||||
DisplayOnAction(HaierClimateBase *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->set_display_state(true); }
|
||||
void play(Ts... x) { this->parent_->set_display_state(true); }
|
||||
|
||||
protected:
|
||||
HaierClimateBase *parent_;
|
||||
@@ -19,7 +19,7 @@ template<typename... Ts> class DisplayOnAction : public Action<Ts...> {
|
||||
template<typename... Ts> class DisplayOffAction : public Action<Ts...> {
|
||||
public:
|
||||
DisplayOffAction(HaierClimateBase *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->set_display_state(false); }
|
||||
void play(Ts... x) { this->parent_->set_display_state(false); }
|
||||
|
||||
protected:
|
||||
HaierClimateBase *parent_;
|
||||
@@ -28,7 +28,7 @@ template<typename... Ts> class DisplayOffAction : public Action<Ts...> {
|
||||
template<typename... Ts> class BeeperOnAction : public Action<Ts...> {
|
||||
public:
|
||||
BeeperOnAction(HonClimate *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->set_beeper_state(true); }
|
||||
void play(Ts... x) { this->parent_->set_beeper_state(true); }
|
||||
|
||||
protected:
|
||||
HonClimate *parent_;
|
||||
@@ -37,7 +37,7 @@ template<typename... Ts> class BeeperOnAction : public Action<Ts...> {
|
||||
template<typename... Ts> class BeeperOffAction : public Action<Ts...> {
|
||||
public:
|
||||
BeeperOffAction(HonClimate *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->set_beeper_state(false); }
|
||||
void play(Ts... x) { this->parent_->set_beeper_state(false); }
|
||||
|
||||
protected:
|
||||
HonClimate *parent_;
|
||||
@@ -47,7 +47,7 @@ template<typename... Ts> class VerticalAirflowAction : public Action<Ts...> {
|
||||
public:
|
||||
VerticalAirflowAction(HonClimate *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(hon_protocol::VerticalSwingMode, direction)
|
||||
void play(const Ts &...x) { this->parent_->set_vertical_airflow(this->direction_.value(x...)); }
|
||||
void play(Ts... x) { this->parent_->set_vertical_airflow(this->direction_.value(x...)); }
|
||||
|
||||
protected:
|
||||
HonClimate *parent_;
|
||||
@@ -57,7 +57,7 @@ template<typename... Ts> class HorizontalAirflowAction : public Action<Ts...> {
|
||||
public:
|
||||
HorizontalAirflowAction(HonClimate *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(hon_protocol::HorizontalSwingMode, direction)
|
||||
void play(const Ts &...x) { this->parent_->set_horizontal_airflow(this->direction_.value(x...)); }
|
||||
void play(Ts... x) { this->parent_->set_horizontal_airflow(this->direction_.value(x...)); }
|
||||
|
||||
protected:
|
||||
HonClimate *parent_;
|
||||
@@ -66,7 +66,7 @@ template<typename... Ts> class HorizontalAirflowAction : public Action<Ts...> {
|
||||
template<typename... Ts> class HealthOnAction : public Action<Ts...> {
|
||||
public:
|
||||
HealthOnAction(HaierClimateBase *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->set_health_mode(true); }
|
||||
void play(Ts... x) { this->parent_->set_health_mode(true); }
|
||||
|
||||
protected:
|
||||
HaierClimateBase *parent_;
|
||||
@@ -75,7 +75,7 @@ template<typename... Ts> class HealthOnAction : public Action<Ts...> {
|
||||
template<typename... Ts> class HealthOffAction : public Action<Ts...> {
|
||||
public:
|
||||
HealthOffAction(HaierClimateBase *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->set_health_mode(false); }
|
||||
void play(Ts... x) { this->parent_->set_health_mode(false); }
|
||||
|
||||
protected:
|
||||
HaierClimateBase *parent_;
|
||||
@@ -84,7 +84,7 @@ template<typename... Ts> class HealthOffAction : public Action<Ts...> {
|
||||
template<typename... Ts> class StartSelfCleaningAction : public Action<Ts...> {
|
||||
public:
|
||||
StartSelfCleaningAction(HonClimate *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->start_self_cleaning(); }
|
||||
void play(Ts... x) { this->parent_->start_self_cleaning(); }
|
||||
|
||||
protected:
|
||||
HonClimate *parent_;
|
||||
@@ -93,7 +93,7 @@ template<typename... Ts> class StartSelfCleaningAction : public Action<Ts...> {
|
||||
template<typename... Ts> class StartSteriCleaningAction : public Action<Ts...> {
|
||||
public:
|
||||
StartSteriCleaningAction(HonClimate *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->start_steri_cleaning(); }
|
||||
void play(Ts... x) { this->parent_->start_steri_cleaning(); }
|
||||
|
||||
protected:
|
||||
HonClimate *parent_;
|
||||
@@ -102,7 +102,7 @@ template<typename... Ts> class StartSteriCleaningAction : public Action<Ts...> {
|
||||
template<typename... Ts> class PowerOnAction : public Action<Ts...> {
|
||||
public:
|
||||
PowerOnAction(HaierClimateBase *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->send_power_on_command(); }
|
||||
void play(Ts... x) { this->parent_->send_power_on_command(); }
|
||||
|
||||
protected:
|
||||
HaierClimateBase *parent_;
|
||||
@@ -111,7 +111,7 @@ template<typename... Ts> class PowerOnAction : public Action<Ts...> {
|
||||
template<typename... Ts> class PowerOffAction : public Action<Ts...> {
|
||||
public:
|
||||
PowerOffAction(HaierClimateBase *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->send_power_off_command(); }
|
||||
void play(Ts... x) { this->parent_->send_power_off_command(); }
|
||||
|
||||
protected:
|
||||
HaierClimateBase *parent_;
|
||||
@@ -120,7 +120,7 @@ template<typename... Ts> class PowerOffAction : public Action<Ts...> {
|
||||
template<typename... Ts> class PowerToggleAction : public Action<Ts...> {
|
||||
public:
|
||||
PowerToggleAction(HaierClimateBase *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) { this->parent_->toggle_power(); }
|
||||
void play(Ts... x) { this->parent_->toggle_power(); }
|
||||
|
||||
protected:
|
||||
HaierClimateBase *parent_;
|
||||
|
||||
@@ -49,7 +49,7 @@ template<typename... Ts> class BrakeAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit BrakeAction(HBridgeFan *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->brake(); }
|
||||
void play(Ts... x) override { this->parent_->brake(); }
|
||||
|
||||
HBridgeFan *parent_;
|
||||
};
|
||||
|
||||
@@ -113,8 +113,8 @@ class HttpContainer : public Parented<HttpRequestComponent> {
|
||||
|
||||
class HttpRequestResponseTrigger : public Trigger<std::shared_ptr<HttpContainer>, std::string &> {
|
||||
public:
|
||||
void process(const std::shared_ptr<HttpContainer> &container, std::string &response_body) {
|
||||
this->trigger(container, response_body);
|
||||
void process(std::shared_ptr<HttpContainer> container, std::string &response_body) {
|
||||
this->trigger(std::move(container), response_body);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -210,7 +210,7 @@ template<typename... Ts> class HttpRequestSendAction : public Action<Ts...> {
|
||||
this->max_response_buffer_size_ = max_response_buffer_size;
|
||||
}
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
std::string body;
|
||||
if (this->body_.has_value()) {
|
||||
body = this->body_.value(x...);
|
||||
|
||||
@@ -15,7 +15,7 @@ template<typename... Ts> class OtaHttpRequestComponentFlashAction : public Actio
|
||||
TEMPLATABLE_VALUE(std::string, url)
|
||||
TEMPLATABLE_VALUE(std::string, username)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
if (this->md5_url_.has_value()) {
|
||||
this->parent_->set_md5_url(this->md5_url_.value(x...));
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ template<typename... Ts> class SetHeaterLevelAction : public Action<Ts...>, publ
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, level)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto level = this->level_.value(x...);
|
||||
|
||||
this->parent_->set_heater_level(level);
|
||||
@@ -52,7 +52,7 @@ template<typename... Ts> class SetHeaterAction : public Action<Ts...>, public Pa
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, status)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto status = this->status_.value(x...);
|
||||
|
||||
this->parent_->set_heater(status);
|
||||
|
||||
@@ -75,7 +75,7 @@ template<typename... Ts> class ResetAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit ResetAction(IntegrationSensor *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->reset(); }
|
||||
void play(Ts... x) override { this->parent_->reset(); }
|
||||
|
||||
protected:
|
||||
IntegrationSensor *parent_;
|
||||
|
||||
@@ -52,11 +52,11 @@ class KeyCollector : public Component {
|
||||
};
|
||||
|
||||
template<typename... Ts> class EnableAction : public Action<Ts...>, public Parented<KeyCollector> {
|
||||
void play(const Ts &...x) override { this->parent_->set_enabled(true); }
|
||||
void play(Ts... x) override { this->parent_->set_enabled(true); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class DisableAction : public Action<Ts...>, public Parented<KeyCollector> {
|
||||
void play(const Ts &...x) override { this->parent_->set_enabled(false); }
|
||||
void play(Ts... x) override { this->parent_->set_enabled(false); }
|
||||
};
|
||||
|
||||
} // namespace key_collector
|
||||
|
||||
@@ -12,7 +12,7 @@ template<typename... Ts> class BluetoothPasswordSetAction : public Action<Ts...>
|
||||
explicit BluetoothPasswordSetAction(LD2410Component *ld2410_comp) : ld2410_comp_(ld2410_comp) {}
|
||||
TEMPLATABLE_VALUE(std::string, password)
|
||||
|
||||
void play(const Ts &...x) override { this->ld2410_comp_->set_bluetooth_password(this->password_.value(x...)); }
|
||||
void play(Ts... x) override { this->ld2410_comp_->set_bluetooth_password(this->password_.value(x...)); }
|
||||
|
||||
protected:
|
||||
LD2410Component *ld2410_comp_;
|
||||
|
||||
@@ -174,7 +174,7 @@ static uint8_t calc_checksum(void *data, size_t size) {
|
||||
static int get_firmware_int(const char *version_string) {
|
||||
std::string version_str = version_string;
|
||||
if (version_str[0] == 'v') {
|
||||
version_str.erase(0, 1);
|
||||
version_str = version_str.substr(1);
|
||||
}
|
||||
version_str.erase(remove(version_str.begin(), version_str.end(), '.'), version_str.end());
|
||||
int version_integer = stoi(version_str);
|
||||
|
||||
@@ -47,7 +47,7 @@ template<typename... Ts> class SetFrequencyAction : public Action<Ts...> {
|
||||
SetFrequencyAction(LEDCOutput *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(float, frequency);
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
float freq = this->frequency_.value(x...);
|
||||
this->parent_->update_frequency(freq);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ template<typename... Ts> class SetFrequencyAction : public Action<Ts...> {
|
||||
SetFrequencyAction(LibreTinyPWM *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(float, frequency);
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
float freq = this->frequency_.value(x...);
|
||||
this->parent_->update_frequency(freq);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(uint32_t, transition_length)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->state_->toggle();
|
||||
call.set_transition_length(this->transition_length_.optional_value(x...));
|
||||
call.perform();
|
||||
@@ -44,7 +44,7 @@ template<typename... Ts> class LightControlAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(float, warm_white)
|
||||
TEMPLATABLE_VALUE(std::string, effect)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->parent_->make_call();
|
||||
call.set_color_mode(this->color_mode_.optional_value(x...));
|
||||
call.set_state(this->state_.optional_value(x...));
|
||||
@@ -74,7 +74,7 @@ template<typename... Ts> class DimRelativeAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(float, relative_brightness)
|
||||
TEMPLATABLE_VALUE(uint32_t, transition_length)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->parent_->make_call();
|
||||
float rel = this->relative_brightness_.value(x...);
|
||||
float cur;
|
||||
@@ -107,7 +107,7 @@ template<typename... Ts> class DimRelativeAction : public Action<Ts...> {
|
||||
template<typename... Ts> class LightIsOnCondition : public Condition<Ts...> {
|
||||
public:
|
||||
explicit LightIsOnCondition(LightState *state) : state_(state) {}
|
||||
bool check(const Ts &...x) override { return this->state_->current_values.is_on(); }
|
||||
bool check(Ts... x) override { return this->state_->current_values.is_on(); }
|
||||
|
||||
protected:
|
||||
LightState *state_;
|
||||
@@ -115,7 +115,7 @@ template<typename... Ts> class LightIsOnCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class LightIsOffCondition : public Condition<Ts...> {
|
||||
public:
|
||||
explicit LightIsOffCondition(LightState *state) : state_(state) {}
|
||||
bool check(const Ts &...x) override { return !this->state_->current_values.is_on(); }
|
||||
bool check(Ts... x) override { return !this->state_->current_values.is_on(); }
|
||||
|
||||
protected:
|
||||
LightState *state_;
|
||||
@@ -179,7 +179,7 @@ template<typename... Ts> class AddressableSet : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(float, blue)
|
||||
TEMPLATABLE_VALUE(float, white)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto *out = (AddressableLight *) this->parent_->get_output();
|
||||
int32_t range_from = interpret_index(this->range_from_.value_or(x..., 0), out->size());
|
||||
if (range_from < 0 || range_from >= out->size())
|
||||
|
||||
@@ -51,7 +51,7 @@ template<typename... Ts> class SendRawAction : public Action<Ts...> {
|
||||
void set_pulse_length(const int &data) { pulse_length_ = data; }
|
||||
void set_data(const std::vector<uint8_t> &data) { code_ = data; }
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
int repeats = this->repeat_.value(x...);
|
||||
int inverted = this->inverted_.value(x...);
|
||||
int pulse_length = this->pulse_length_.value(x...);
|
||||
|
||||
@@ -11,7 +11,7 @@ template<typename... Ts> class LockAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit LockAction(Lock *a_lock) : lock_(a_lock) {}
|
||||
|
||||
void play(const Ts &...x) override { this->lock_->lock(); }
|
||||
void play(Ts... x) override { this->lock_->lock(); }
|
||||
|
||||
protected:
|
||||
Lock *lock_;
|
||||
@@ -21,7 +21,7 @@ template<typename... Ts> class UnlockAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit UnlockAction(Lock *a_lock) : lock_(a_lock) {}
|
||||
|
||||
void play(const Ts &...x) override { this->lock_->unlock(); }
|
||||
void play(Ts... x) override { this->lock_->unlock(); }
|
||||
|
||||
protected:
|
||||
Lock *lock_;
|
||||
@@ -31,7 +31,7 @@ template<typename... Ts> class OpenAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit OpenAction(Lock *a_lock) : lock_(a_lock) {}
|
||||
|
||||
void play(const Ts &...x) override { this->lock_->open(); }
|
||||
void play(Ts... x) override { this->lock_->open(); }
|
||||
|
||||
protected:
|
||||
Lock *lock_;
|
||||
@@ -40,7 +40,7 @@ template<typename... Ts> class OpenAction : public Action<Ts...> {
|
||||
template<typename... Ts> class LockCondition : public Condition<Ts...> {
|
||||
public:
|
||||
LockCondition(Lock *parent, bool state) : parent_(parent), state_(state) {}
|
||||
bool check(const Ts &...x) override {
|
||||
bool check(Ts... x) override {
|
||||
auto check_state = this->state_ ? LockState::LOCK_STATE_LOCKED : LockState::LOCK_STATE_UNLOCKED;
|
||||
return this->parent_->state == check_state;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ template<typename... Ts> class ObjUpdateAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit ObjUpdateAction(std::function<void(Ts...)> &&lamb) : lamb_(std::move(lamb)) {}
|
||||
|
||||
void play(const Ts &...x) override { this->lamb_(x...); }
|
||||
void play(Ts... x) override { this->lamb_(x...); }
|
||||
|
||||
protected:
|
||||
std::function<void(Ts...)> lamb_;
|
||||
@@ -263,7 +263,7 @@ class IdleTrigger : public Trigger<> {
|
||||
template<typename... Ts> class LvglAction : public Action<Ts...>, public Parented<LvglComponent> {
|
||||
public:
|
||||
explicit LvglAction(std::function<void(LvglComponent *)> &&lamb) : action_(std::move(lamb)) {}
|
||||
void play(const Ts &...x) override { this->action_(this->parent_); }
|
||||
void play(Ts... x) override { this->action_(this->parent_); }
|
||||
|
||||
protected:
|
||||
std::function<void(LvglComponent *)> action_{};
|
||||
@@ -272,7 +272,7 @@ template<typename... Ts> class LvglAction : public Action<Ts...>, public Parente
|
||||
template<typename Tc, typename... Ts> class LvglCondition : public Condition<Ts...>, public Parented<Tc> {
|
||||
public:
|
||||
LvglCondition(std::function<bool(Tc *)> &&condition_lambda) : condition_lambda_(std::move(condition_lambda)) {}
|
||||
bool check(const Ts &...x) override { return this->condition_lambda_(this->parent_); }
|
||||
bool check(Ts... x) override { return this->condition_lambda_(this->parent_); }
|
||||
|
||||
protected:
|
||||
std::function<bool(Tc *)> condition_lambda_{};
|
||||
|
||||
@@ -59,8 +59,8 @@ class LVGLSelect : public select::Select, public Component {
|
||||
const auto &opts = this->widget_->get_options();
|
||||
FixedVector<const char *> opt_ptrs;
|
||||
opt_ptrs.init(opts.size());
|
||||
for (const auto &opt : opts) {
|
||||
opt_ptrs.push_back(opt.c_str());
|
||||
for (size_t i = 0; i < opts.size(); i++) {
|
||||
opt_ptrs[i] = opts[i].c_str();
|
||||
}
|
||||
this->traits.set_options(opt_ptrs);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ template<typename... Ts> class SleepAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit SleepAction(MAX17043Component *max17043) : max17043_(max17043) {}
|
||||
|
||||
void play(const Ts &...x) override { this->max17043_->sleep_mode(); }
|
||||
void play(Ts... x) override { this->max17043_->sleep_mode(); }
|
||||
|
||||
protected:
|
||||
MAX17043Component *max17043_;
|
||||
|
||||
@@ -13,7 +13,7 @@ template<typename... Ts> class SetCurrentGlobalAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(uint8_t, brightness_global)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->max6956_->set_brightness_global(this->brightness_global_.value(x...));
|
||||
this->max6956_->write_brightness_global();
|
||||
}
|
||||
@@ -28,7 +28,7 @@ template<typename... Ts> class SetCurrentModeAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(max6956::MAX6956CURRENTMODE, brightness_mode)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->max6956_->set_brightness_mode(this->brightness_mode_.value(x...));
|
||||
this->max6956_->write_brightness_mode();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ template<typename... Ts> class DisplayInvertAction : public Action<Ts...>, publi
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
bool state = this->state_.value(x...);
|
||||
this->parent_->invert_on_off(state);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ template<typename... Ts> class DisplayVisibilityAction : public Action<Ts...>, p
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
bool state = this->state_.value(x...);
|
||||
this->parent_->turn_on_off(state);
|
||||
}
|
||||
@@ -32,7 +32,7 @@ template<typename... Ts> class DisplayReverseAction : public Action<Ts...>, publ
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
bool state = this->state_.value(x...);
|
||||
this->parent_->set_reverse(state);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ template<typename... Ts> class DisplayIntensityAction : public Action<Ts...>, pu
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, state)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
uint8_t state = this->state_.value(x...);
|
||||
this->parent_->set_intensity(state);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ template<MediaPlayerCommand Command, typename... Ts>
|
||||
class MediaPlayerCommandAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, announcement);
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->make_call().set_command(Command).set_announcement(this->announcement_.value(x...)).perform();
|
||||
}
|
||||
};
|
||||
@@ -36,7 +36,7 @@ using TurnOffAction = MediaPlayerCommandAction<MediaPlayerCommand::MEDIA_PLAYER_
|
||||
template<typename... Ts> class PlayMediaAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
TEMPLATABLE_VALUE(std::string, media_url)
|
||||
TEMPLATABLE_VALUE(bool, announcement)
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->make_call()
|
||||
.set_media_url(this->media_url_.value(x...))
|
||||
.set_announcement(this->announcement_.value(x...))
|
||||
@@ -46,7 +46,7 @@ template<typename... Ts> class PlayMediaAction : public Action<Ts...>, public Pa
|
||||
|
||||
template<typename... Ts> class VolumeSetAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
TEMPLATABLE_VALUE(float, volume)
|
||||
void play(const Ts &...x) override { this->parent_->make_call().set_volume(this->volume_.value(x...)).perform(); }
|
||||
void play(Ts... x) override { this->parent_->make_call().set_volume(this->volume_.value(x...)).perform(); }
|
||||
};
|
||||
|
||||
class StateTrigger : public Trigger<> {
|
||||
@@ -75,34 +75,32 @@ using OffTrigger = MediaPlayerStateTrigger<MediaPlayerState::MEDIA_PLAYER_STATE_
|
||||
|
||||
template<typename... Ts> class IsIdleCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_IDLE; }
|
||||
bool check(Ts... x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_IDLE; }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsPlayingCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_PLAYING; }
|
||||
bool check(Ts... x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_PLAYING; }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsPausedCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_PAUSED; }
|
||||
bool check(Ts... x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_PAUSED; }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsAnnouncingCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override {
|
||||
return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_ANNOUNCING;
|
||||
}
|
||||
bool check(Ts... x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_ANNOUNCING; }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsOnCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_ON; }
|
||||
bool check(Ts... x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_ON; }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsOffCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_OFF; }
|
||||
bool check(Ts... x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_OFF; }
|
||||
};
|
||||
|
||||
} // namespace media_player
|
||||
|
||||
@@ -40,7 +40,7 @@ template<typename... Ts> class MHZ19CalibrateZeroAction : public Action<Ts...> {
|
||||
public:
|
||||
MHZ19CalibrateZeroAction(MHZ19Component *mhz19) : mhz19_(mhz19) {}
|
||||
|
||||
void play(const Ts &...x) override { this->mhz19_->calibrate_zero(); }
|
||||
void play(Ts... x) override { this->mhz19_->calibrate_zero(); }
|
||||
|
||||
protected:
|
||||
MHZ19Component *mhz19_;
|
||||
@@ -50,7 +50,7 @@ template<typename... Ts> class MHZ19ABCEnableAction : public Action<Ts...> {
|
||||
public:
|
||||
MHZ19ABCEnableAction(MHZ19Component *mhz19) : mhz19_(mhz19) {}
|
||||
|
||||
void play(const Ts &...x) override { this->mhz19_->abc_enable(); }
|
||||
void play(Ts... x) override { this->mhz19_->abc_enable(); }
|
||||
|
||||
protected:
|
||||
MHZ19Component *mhz19_;
|
||||
@@ -60,7 +60,7 @@ template<typename... Ts> class MHZ19ABCDisableAction : public Action<Ts...> {
|
||||
public:
|
||||
MHZ19ABCDisableAction(MHZ19Component *mhz19) : mhz19_(mhz19) {}
|
||||
|
||||
void play(const Ts &...x) override { this->mhz19_->abc_disable(); }
|
||||
void play(Ts... x) override { this->mhz19_->abc_disable(); }
|
||||
|
||||
protected:
|
||||
MHZ19Component *mhz19_;
|
||||
|
||||
@@ -9,23 +9,23 @@ namespace micro_wake_word {
|
||||
|
||||
template<typename... Ts> class StartAction : public Action<Ts...>, public Parented<MicroWakeWord> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->start(); }
|
||||
void play(Ts... x) override { this->parent_->start(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class StopAction : public Action<Ts...>, public Parented<MicroWakeWord> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->stop(); }
|
||||
void play(Ts... x) override { this->parent_->stop(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsRunningCondition : public Condition<Ts...>, public Parented<MicroWakeWord> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_running(); }
|
||||
bool check(Ts... x) override { return this->parent_->is_running(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class EnableModelAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit EnableModelAction(WakeWordModel *wake_word_model) : wake_word_model_(wake_word_model) {}
|
||||
void play(const Ts &...x) override { this->wake_word_model_->enable(); }
|
||||
void play(Ts... x) override { this->wake_word_model_->enable(); }
|
||||
|
||||
protected:
|
||||
WakeWordModel *wake_word_model_;
|
||||
@@ -34,7 +34,7 @@ template<typename... Ts> class EnableModelAction : public Action<Ts...> {
|
||||
template<typename... Ts> class DisableModelAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit DisableModelAction(WakeWordModel *wake_word_model) : wake_word_model_(wake_word_model) {}
|
||||
void play(const Ts &...x) override { this->wake_word_model_->disable(); }
|
||||
void play(Ts... x) override { this->wake_word_model_->disable(); }
|
||||
|
||||
protected:
|
||||
WakeWordModel *wake_word_model_;
|
||||
@@ -43,7 +43,7 @@ template<typename... Ts> class DisableModelAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ModelIsEnabledCondition : public Condition<Ts...> {
|
||||
public:
|
||||
explicit ModelIsEnabledCondition(WakeWordModel *wake_word_model) : wake_word_model_(wake_word_model) {}
|
||||
bool check(const Ts &...x) override { return this->wake_word_model_->is_enabled(); }
|
||||
bool check(Ts... x) override { return this->wake_word_model_->is_enabled(); }
|
||||
|
||||
protected:
|
||||
WakeWordModel *wake_word_model_;
|
||||
|
||||
@@ -9,18 +9,18 @@ namespace esphome {
|
||||
namespace microphone {
|
||||
|
||||
template<typename... Ts> class CaptureAction : public Action<Ts...>, public Parented<Microphone> {
|
||||
void play(const Ts &...x) override { this->parent_->start(); }
|
||||
void play(Ts... x) override { this->parent_->start(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class StopCaptureAction : public Action<Ts...>, public Parented<Microphone> {
|
||||
void play(const Ts &...x) override { this->parent_->stop(); }
|
||||
void play(Ts... x) override { this->parent_->stop(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class MuteAction : public Action<Ts...>, public Parented<Microphone> {
|
||||
void play(const Ts &...x) override { this->parent_->set_mute_state(true); }
|
||||
void play(Ts... x) override { this->parent_->set_mute_state(true); }
|
||||
};
|
||||
template<typename... Ts> class UnmuteAction : public Action<Ts...>, public Parented<Microphone> {
|
||||
void play(const Ts &...x) override { this->parent_->set_mute_state(false); }
|
||||
void play(Ts... x) override { this->parent_->set_mute_state(false); }
|
||||
};
|
||||
|
||||
class DataTrigger : public Trigger<const std::vector<uint8_t> &> {
|
||||
@@ -32,12 +32,12 @@ class DataTrigger : public Trigger<const std::vector<uint8_t> &> {
|
||||
|
||||
template<typename... Ts> class IsCapturingCondition : public Condition<Ts...>, public Parented<Microphone> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_running(); }
|
||||
bool check(Ts... x) override { return this->parent_->is_running(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsMutedCondition : public Condition<Ts...>, public Parented<Microphone> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->get_mute_state(); }
|
||||
bool check(Ts... x) override { return this->parent_->get_mute_state(); }
|
||||
};
|
||||
|
||||
} // namespace microphone
|
||||
|
||||
@@ -22,7 +22,7 @@ template<typename... Ts> class FollowMeAction : public MideaActionBase<Ts...> {
|
||||
TEMPLATABLE_VALUE(bool, use_fahrenheit)
|
||||
TEMPLATABLE_VALUE(bool, beeper)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->do_follow_me(this->temperature_.value(x...), this->use_fahrenheit_.value(x...),
|
||||
this->beeper_.value(x...));
|
||||
}
|
||||
@@ -30,37 +30,37 @@ template<typename... Ts> class FollowMeAction : public MideaActionBase<Ts...> {
|
||||
|
||||
template<typename... Ts> class SwingStepAction : public MideaActionBase<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->do_swing_step(); }
|
||||
void play(Ts... x) override { this->parent_->do_swing_step(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class DisplayToggleAction : public MideaActionBase<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->do_display_toggle(); }
|
||||
void play(Ts... x) override { this->parent_->do_display_toggle(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class BeeperOnAction : public MideaActionBase<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->do_beeper_on(); }
|
||||
void play(Ts... x) override { this->parent_->do_beeper_on(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class BeeperOffAction : public MideaActionBase<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->do_beeper_off(); }
|
||||
void play(Ts... x) override { this->parent_->do_beeper_off(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class PowerOnAction : public MideaActionBase<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->do_power_on(); }
|
||||
void play(Ts... x) override { this->parent_->do_power_on(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class PowerOffAction : public MideaActionBase<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->do_power_off(); }
|
||||
void play(Ts... x) override { this->parent_->do_power_off(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class PowerToggleAction : public MideaActionBase<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->do_power_toggle(); }
|
||||
void play(Ts... x) override { this->parent_->do_power_toggle(); }
|
||||
};
|
||||
|
||||
} // namespace ac
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace mixer_speaker {
|
||||
template<typename... Ts> class DuckingApplyAction : public Action<Ts...>, public Parented<SourceSpeaker> {
|
||||
TEMPLATABLE_VALUE(uint8_t, decibel_reduction)
|
||||
TEMPLATABLE_VALUE(uint32_t, duration)
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->apply_ducking(this->decibel_reduction_.value(x...), this->duration_.value(x...));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -389,7 +389,7 @@ template<typename... Ts> class MQTTPublishAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(uint8_t, qos)
|
||||
TEMPLATABLE_VALUE(bool, retain)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->publish(this->topic_.value(x...), this->payload_.value(x...), this->qos_.value(x...),
|
||||
this->retain_.value(x...));
|
||||
}
|
||||
@@ -407,7 +407,7 @@ template<typename... Ts> class MQTTPublishJsonAction : public Action<Ts...> {
|
||||
|
||||
void set_payload(std::function<void(Ts..., JsonObject)> payload) { this->payload_ = payload; }
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto f = std::bind(&MQTTPublishJsonAction<Ts...>::encode_, this, x..., std::placeholders::_1);
|
||||
auto topic = this->topic_.value(x...);
|
||||
auto qos = this->qos_.value(x...);
|
||||
@@ -424,7 +424,7 @@ template<typename... Ts> class MQTTPublishJsonAction : public Action<Ts...> {
|
||||
template<typename... Ts> class MQTTConnectedCondition : public Condition<Ts...> {
|
||||
public:
|
||||
MQTTConnectedCondition(MQTTClientComponent *parent) : parent_(parent) {}
|
||||
bool check(const Ts &...x) override { return this->parent_->is_connected(); }
|
||||
bool check(Ts... x) override { return this->parent_->is_connected(); }
|
||||
|
||||
protected:
|
||||
MQTTClientComponent *parent_;
|
||||
@@ -434,7 +434,7 @@ template<typename... Ts> class MQTTEnableAction : public Action<Ts...> {
|
||||
public:
|
||||
MQTTEnableAction(MQTTClientComponent *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->enable(); }
|
||||
void play(Ts... x) override { this->parent_->enable(); }
|
||||
|
||||
protected:
|
||||
MQTTClientComponent *parent_;
|
||||
@@ -444,7 +444,7 @@ template<typename... Ts> class MQTTDisableAction : public Action<Ts...> {
|
||||
public:
|
||||
MQTTDisableAction(MQTTClientComponent *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->disable(); }
|
||||
void play(Ts... x) override { this->parent_->disable(); }
|
||||
|
||||
protected:
|
||||
MQTTClientComponent *parent_;
|
||||
|
||||
@@ -101,18 +101,18 @@ class NAU7802Sensor : public sensor::Sensor, public PollingComponent, public i2c
|
||||
template<typename... Ts>
|
||||
class NAU7802CalbrateExternalOffsetAction : public Action<Ts...>, public Parented<NAU7802Sensor> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->calibrate_external_offset(); }
|
||||
void play(Ts... x) override { this->parent_->calibrate_external_offset(); }
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
class NAU7802CalbrateInternalOffsetAction : public Action<Ts...>, public Parented<NAU7802Sensor> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->calibrate_internal_offset(); }
|
||||
void play(Ts... x) override { this->parent_->calibrate_internal_offset(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class NAU7802CalbrateGainAction : public Action<Ts...>, public Parented<NAU7802Sensor> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->calibrate_gain(); }
|
||||
void play(Ts... x) override { this->parent_->calibrate_gain(); }
|
||||
};
|
||||
|
||||
} // namespace nau7802
|
||||
|
||||
@@ -55,7 +55,7 @@ template<typename... Ts> class NextionSetBrightnessAction : public Action<Ts...>
|
||||
|
||||
TEMPLATABLE_VALUE(float, brightness)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->component_->set_brightness(this->brightness_.value(x...));
|
||||
this->component_->set_backlight_brightness(this->brightness_.value(x...));
|
||||
}
|
||||
@@ -74,7 +74,7 @@ template<typename... Ts> class NextionPublishFloatAction : public Action<Ts...>
|
||||
TEMPLATABLE_VALUE(bool, publish_state)
|
||||
TEMPLATABLE_VALUE(bool, send_to_nextion)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->component_->set_state(this->state_.value(x...), this->publish_state_.value(x...),
|
||||
this->send_to_nextion_.value(x...));
|
||||
}
|
||||
@@ -97,7 +97,7 @@ template<typename... Ts> class NextionPublishTextAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(bool, publish_state)
|
||||
TEMPLATABLE_VALUE(bool, send_to_nextion)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->component_->set_state(this->state_.value(x...), this->publish_state_.value(x...),
|
||||
this->send_to_nextion_.value(x...));
|
||||
}
|
||||
@@ -120,7 +120,7 @@ template<typename... Ts> class NextionPublishBoolAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(bool, publish_state)
|
||||
TEMPLATABLE_VALUE(bool, send_to_nextion)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->component_->set_state(this->state_.value(x...), this->publish_state_.value(x...),
|
||||
this->send_to_nextion_.value(x...));
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ template<typename... Ts> class NumberSetAction : public Action<Ts...> {
|
||||
NumberSetAction(Number *number) : number_(number) {}
|
||||
TEMPLATABLE_VALUE(float, value)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->number_->make_call();
|
||||
call.set_value(this->value_.value(x...));
|
||||
call.perform();
|
||||
@@ -35,7 +35,7 @@ template<typename... Ts> class NumberOperationAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(NumberOperation, operation)
|
||||
TEMPLATABLE_VALUE(bool, cycle)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->number_->make_call();
|
||||
call.with_operation(this->operation_.value(x...));
|
||||
if (this->cycle_.has_value()) {
|
||||
@@ -74,7 +74,7 @@ template<typename... Ts> class NumberInRangeCondition : public Condition<Ts...>
|
||||
|
||||
void set_min(float min) { this->min_ = min; }
|
||||
void set_max(float max) { this->max_ = max; }
|
||||
bool check(const Ts &...x) override {
|
||||
bool check(Ts... x) override {
|
||||
const float state = this->parent_->state;
|
||||
if (std::isnan(this->min_)) {
|
||||
return state <= this->max_;
|
||||
|
||||
@@ -207,7 +207,7 @@ template<typename... Ts> class OnlineImageSetUrlAction : public Action<Ts...> {
|
||||
OnlineImageSetUrlAction(OnlineImage *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(std::string, url)
|
||||
TEMPLATABLE_VALUE(bool, update)
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->set_url(this->url_.value(x...));
|
||||
if (this->update_.value(x...)) {
|
||||
this->parent_->update();
|
||||
@@ -221,7 +221,7 @@ template<typename... Ts> class OnlineImageSetUrlAction : public Action<Ts...> {
|
||||
template<typename... Ts> class OnlineImageReleaseAction : public Action<Ts...> {
|
||||
public:
|
||||
OnlineImageReleaseAction(OnlineImage *parent) : parent_(parent) {}
|
||||
void play(const Ts &...x) override { this->parent_->release(); }
|
||||
void play(Ts... x) override { this->parent_->release(); }
|
||||
|
||||
protected:
|
||||
OnlineImage *parent_;
|
||||
|
||||
@@ -12,7 +12,7 @@ template<typename... Ts> class TurnOffAction : public Action<Ts...> {
|
||||
public:
|
||||
TurnOffAction(BinaryOutput *output) : output_(output) {}
|
||||
|
||||
void play(const Ts &...x) override { this->output_->turn_off(); }
|
||||
void play(Ts... x) override { this->output_->turn_off(); }
|
||||
|
||||
protected:
|
||||
BinaryOutput *output_;
|
||||
@@ -22,7 +22,7 @@ template<typename... Ts> class TurnOnAction : public Action<Ts...> {
|
||||
public:
|
||||
TurnOnAction(BinaryOutput *output) : output_(output) {}
|
||||
|
||||
void play(const Ts &...x) override { this->output_->turn_on(); }
|
||||
void play(Ts... x) override { this->output_->turn_on(); }
|
||||
|
||||
protected:
|
||||
BinaryOutput *output_;
|
||||
@@ -34,7 +34,7 @@ template<typename... Ts> class SetLevelAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(float, level)
|
||||
|
||||
void play(const Ts &...x) override { this->output_->set_level(this->level_.value(x...)); }
|
||||
void play(Ts... x) override { this->output_->set_level(this->level_.value(x...)); }
|
||||
|
||||
protected:
|
||||
FloatOutput *output_;
|
||||
@@ -46,7 +46,7 @@ template<typename... Ts> class SetMinPowerAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(float, min_power)
|
||||
|
||||
void play(const Ts &...x) override { this->output_->set_min_power(this->min_power_.value(x...)); }
|
||||
void play(Ts... x) override { this->output_->set_min_power(this->min_power_.value(x...)); }
|
||||
|
||||
protected:
|
||||
FloatOutput *output_;
|
||||
@@ -58,7 +58,7 @@ template<typename... Ts> class SetMaxPowerAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(float, max_power)
|
||||
|
||||
void play(const Ts &...x) override { this->output_->set_max_power(this->max_power_.value(x...)); }
|
||||
void play(Ts... x) override { this->output_->set_max_power(this->max_power_.value(x...)); }
|
||||
|
||||
protected:
|
||||
FloatOutput *output_;
|
||||
|
||||
@@ -85,12 +85,12 @@ class PCF85063Component : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
|
||||
template<typename... Ts> class WriteAction : public Action<Ts...>, public Parented<PCF85063Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->write_time(); }
|
||||
void play(Ts... x) override { this->parent_->write_time(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class ReadAction : public Action<Ts...>, public Parented<PCF85063Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->read_time(); }
|
||||
void play(Ts... x) override { this->parent_->read_time(); }
|
||||
};
|
||||
} // namespace pcf85063
|
||||
} // namespace esphome
|
||||
|
||||
@@ -113,12 +113,12 @@ class PCF8563Component : public time::RealTimeClock, public i2c::I2CDevice {
|
||||
|
||||
template<typename... Ts> class WriteAction : public Action<Ts...>, public Parented<PCF8563Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->write_time(); }
|
||||
void play(Ts... x) override { this->parent_->write_time(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class ReadAction : public Action<Ts...>, public Parented<PCF8563Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->read_time(); }
|
||||
void play(Ts... x) override { this->parent_->read_time(); }
|
||||
};
|
||||
} // namespace pcf8563
|
||||
} // namespace esphome
|
||||
|
||||
@@ -109,7 +109,7 @@ template<typename... Ts> class PIDAutotuneAction : public Action<Ts...> {
|
||||
void set_positive_output(float positive_output) { positive_output_ = positive_output; }
|
||||
void set_negative_output(float negative_output) { negative_output_ = negative_output; }
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
auto tuner = make_unique<PIDAutotuner>();
|
||||
tuner->set_noiseband(this->noiseband_);
|
||||
tuner->set_output_negative(this->negative_output_);
|
||||
@@ -128,7 +128,7 @@ template<typename... Ts> class PIDResetIntegralTermAction : public Action<Ts...>
|
||||
public:
|
||||
PIDResetIntegralTermAction(PIDClimate *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) { this->parent_->reset_integral_term(); }
|
||||
void play(Ts... x) { this->parent_->reset_integral_term(); }
|
||||
|
||||
protected:
|
||||
PIDClimate *parent_;
|
||||
@@ -138,7 +138,7 @@ template<typename... Ts> class PIDSetControlParametersAction : public Action<Ts.
|
||||
public:
|
||||
PIDSetControlParametersAction(PIDClimate *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
auto kp = this->kp_.value(x...);
|
||||
auto ki = this->ki_.value(x...);
|
||||
auto kd = this->kd_.value(x...);
|
||||
|
||||
@@ -32,7 +32,7 @@ template<typename... Ts> class SetOutputAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(float, level)
|
||||
|
||||
void play(const Ts &...x) override { this->output_->set_value(this->level_.value(x...)); }
|
||||
void play(Ts... x) override { this->output_->set_value(this->level_.value(x...)); }
|
||||
|
||||
protected:
|
||||
PipsolarOutput *output_;
|
||||
|
||||
@@ -38,7 +38,7 @@ template<typename... Ts> class PMWCS3AirCalibrationAction : public Action<Ts...>
|
||||
public:
|
||||
PMWCS3AirCalibrationAction(PMWCS3Component *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->air_calibration(); }
|
||||
void play(Ts... x) override { this->parent_->air_calibration(); }
|
||||
|
||||
protected:
|
||||
PMWCS3Component *parent_;
|
||||
@@ -48,7 +48,7 @@ template<typename... Ts> class PMWCS3WaterCalibrationAction : public Action<Ts..
|
||||
public:
|
||||
PMWCS3WaterCalibrationAction(PMWCS3Component *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->water_calibration(); }
|
||||
void play(Ts... x) override { this->parent_->water_calibration(); }
|
||||
|
||||
protected:
|
||||
PMWCS3Component *parent_;
|
||||
@@ -59,7 +59,7 @@ template<typename... Ts> class PMWCS3NewI2cAddressAction : public Action<Ts...>
|
||||
PMWCS3NewI2cAddressAction(PMWCS3Component *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(int, new_address)
|
||||
|
||||
void play(const Ts &...x) override { this->parent_->new_i2c_address(this->new_address_.value(x...)); }
|
||||
void play(Ts... x) override { this->parent_->new_i2c_address(this->new_address_.value(x...)); }
|
||||
|
||||
protected:
|
||||
PMWCS3Component *parent_;
|
||||
|
||||
@@ -143,7 +143,7 @@ class PN532OnFinishedWriteTrigger : public Trigger<> {
|
||||
|
||||
template<typename... Ts> class PN532IsWritingCondition : public Condition<Ts...>, public Parented<PN532> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_writing(); }
|
||||
bool check(Ts... x) override { return this->parent_->is_writing(); }
|
||||
};
|
||||
|
||||
} // namespace pn532
|
||||
|
||||
@@ -23,42 +23,42 @@ class PN7150OnFinishedWriteTrigger : public Trigger<> {
|
||||
|
||||
template<typename... Ts> class PN7150IsWritingCondition : public Condition<Ts...>, public Parented<PN7150> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_writing(); }
|
||||
bool check(Ts... x) override { return this->parent_->is_writing(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class EmulationOffAction : public Action<Ts...>, public Parented<PN7150> {
|
||||
void play(const Ts &...x) override { this->parent_->set_tag_emulation_off(); }
|
||||
void play(Ts... x) override { this->parent_->set_tag_emulation_off(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class EmulationOnAction : public Action<Ts...>, public Parented<PN7150> {
|
||||
void play(const Ts &...x) override { this->parent_->set_tag_emulation_on(); }
|
||||
void play(Ts... x) override { this->parent_->set_tag_emulation_on(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class PollingOffAction : public Action<Ts...>, public Parented<PN7150> {
|
||||
void play(const Ts &...x) override { this->parent_->set_polling_off(); }
|
||||
void play(Ts... x) override { this->parent_->set_polling_off(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class PollingOnAction : public Action<Ts...>, public Parented<PN7150> {
|
||||
void play(const Ts &...x) override { this->parent_->set_polling_on(); }
|
||||
void play(Ts... x) override { this->parent_->set_polling_on(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetCleanModeAction : public Action<Ts...>, public Parented<PN7150> {
|
||||
void play(const Ts &...x) override { this->parent_->clean_mode(); }
|
||||
void play(Ts... x) override { this->parent_->clean_mode(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetFormatModeAction : public Action<Ts...>, public Parented<PN7150> {
|
||||
void play(const Ts &...x) override { this->parent_->format_mode(); }
|
||||
void play(Ts... x) override { this->parent_->format_mode(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetReadModeAction : public Action<Ts...>, public Parented<PN7150> {
|
||||
void play(const Ts &...x) override { this->parent_->read_mode(); }
|
||||
void play(Ts... x) override { this->parent_->read_mode(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetEmulationMessageAction : public Action<Ts...>, public Parented<PN7150> {
|
||||
TEMPLATABLE_VALUE(std::string, message)
|
||||
TEMPLATABLE_VALUE(bool, include_android_app_record)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->set_tag_emulation_message(this->message_.optional_value(x...),
|
||||
this->include_android_app_record_.optional_value(x...));
|
||||
}
|
||||
@@ -68,14 +68,14 @@ template<typename... Ts> class SetWriteMessageAction : public Action<Ts...>, pub
|
||||
TEMPLATABLE_VALUE(std::string, message)
|
||||
TEMPLATABLE_VALUE(bool, include_android_app_record)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->set_tag_write_message(this->message_.optional_value(x...),
|
||||
this->include_android_app_record_.optional_value(x...));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetWriteModeAction : public Action<Ts...>, public Parented<PN7150> {
|
||||
void play(const Ts &...x) override { this->parent_->write_mode(); }
|
||||
void play(Ts... x) override { this->parent_->write_mode(); }
|
||||
};
|
||||
|
||||
} // namespace pn7150
|
||||
|
||||
@@ -23,42 +23,42 @@ class PN7160OnFinishedWriteTrigger : public Trigger<> {
|
||||
|
||||
template<typename... Ts> class PN7160IsWritingCondition : public Condition<Ts...>, public Parented<PN7160> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_writing(); }
|
||||
bool check(Ts... x) override { return this->parent_->is_writing(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class EmulationOffAction : public Action<Ts...>, public Parented<PN7160> {
|
||||
void play(const Ts &...x) override { this->parent_->set_tag_emulation_off(); }
|
||||
void play(Ts... x) override { this->parent_->set_tag_emulation_off(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class EmulationOnAction : public Action<Ts...>, public Parented<PN7160> {
|
||||
void play(const Ts &...x) override { this->parent_->set_tag_emulation_on(); }
|
||||
void play(Ts... x) override { this->parent_->set_tag_emulation_on(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class PollingOffAction : public Action<Ts...>, public Parented<PN7160> {
|
||||
void play(const Ts &...x) override { this->parent_->set_polling_off(); }
|
||||
void play(Ts... x) override { this->parent_->set_polling_off(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class PollingOnAction : public Action<Ts...>, public Parented<PN7160> {
|
||||
void play(const Ts &...x) override { this->parent_->set_polling_on(); }
|
||||
void play(Ts... x) override { this->parent_->set_polling_on(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetCleanModeAction : public Action<Ts...>, public Parented<PN7160> {
|
||||
void play(const Ts &...x) override { this->parent_->clean_mode(); }
|
||||
void play(Ts... x) override { this->parent_->clean_mode(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetFormatModeAction : public Action<Ts...>, public Parented<PN7160> {
|
||||
void play(const Ts &...x) override { this->parent_->format_mode(); }
|
||||
void play(Ts... x) override { this->parent_->format_mode(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetReadModeAction : public Action<Ts...>, public Parented<PN7160> {
|
||||
void play(const Ts &...x) override { this->parent_->read_mode(); }
|
||||
void play(Ts... x) override { this->parent_->read_mode(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetEmulationMessageAction : public Action<Ts...>, public Parented<PN7160> {
|
||||
TEMPLATABLE_VALUE(std::string, message)
|
||||
TEMPLATABLE_VALUE(bool, include_android_app_record)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->set_tag_emulation_message(this->message_.optional_value(x...),
|
||||
this->include_android_app_record_.optional_value(x...));
|
||||
}
|
||||
@@ -68,14 +68,14 @@ template<typename... Ts> class SetWriteMessageAction : public Action<Ts...>, pub
|
||||
TEMPLATABLE_VALUE(std::string, message)
|
||||
TEMPLATABLE_VALUE(bool, include_android_app_record)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
this->parent_->set_tag_write_message(this->message_.optional_value(x...),
|
||||
this->include_android_app_record_.optional_value(x...));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetWriteModeAction : public Action<Ts...>, public Parented<PN7160> {
|
||||
void play(const Ts &...x) override { this->parent_->write_mode(); }
|
||||
void play(Ts... x) override { this->parent_->write_mode(); }
|
||||
};
|
||||
|
||||
} // namespace pn7160
|
||||
|
||||
@@ -14,7 +14,7 @@ template<typename... Ts> class SetTotalPulsesAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(uint32_t, total_pulses)
|
||||
|
||||
void play(const Ts &...x) override { this->pulse_counter_->set_total_pulses(this->total_pulses_.value(x...)); }
|
||||
void play(Ts... x) override { this->pulse_counter_->set_total_pulses(this->total_pulses_.value(x...)); }
|
||||
|
||||
protected:
|
||||
PulseCounterSensor *pulse_counter_;
|
||||
|
||||
@@ -14,7 +14,7 @@ template<typename... Ts> class SetTotalPulsesAction : public Action<Ts...> {
|
||||
|
||||
TEMPLATABLE_VALUE(uint32_t, total_pulses)
|
||||
|
||||
void play(const Ts &...x) override { this->pulse_meter_->set_total_pulses(this->total_pulses_.value(x...)); }
|
||||
void play(Ts... x) override { this->pulse_meter_->set_total_pulses(this->total_pulses_.value(x...)); }
|
||||
|
||||
protected:
|
||||
PulseMeterSensor *pulse_meter_;
|
||||
|
||||
@@ -43,7 +43,7 @@ template<typename... Ts> class ResetEnergyAction : public Action<Ts...> {
|
||||
public:
|
||||
ResetEnergyAction(PZEMAC *pzemac) : pzemac_(pzemac) {}
|
||||
|
||||
void play(const Ts &...x) override { this->pzemac_->reset_energy_(); }
|
||||
void play(Ts... x) override { this->pzemac_->reset_energy_(); }
|
||||
|
||||
protected:
|
||||
PZEMAC *pzemac_;
|
||||
|
||||
@@ -36,7 +36,7 @@ template<typename... Ts> class ResetEnergyAction : public Action<Ts...> {
|
||||
public:
|
||||
ResetEnergyAction(PZEMDC *pzemdc) : pzemdc_(pzemdc) {}
|
||||
|
||||
void play(const Ts &...x) override { this->pzemdc_->reset_energy(); }
|
||||
void play(Ts... x) override { this->pzemdc_->reset_energy(); }
|
||||
|
||||
protected:
|
||||
PZEMDC *pzemdc_;
|
||||
|
||||
@@ -71,6 +71,7 @@ static const uint16_t FALLBACK_FREQUENCY = 64767U; // To use with frequency = 0
|
||||
static const uint32_t MICROSECONDS_IN_SECONDS = 1000000UL;
|
||||
static const uint16_t PRONTO_DEFAULT_GAP = 45000;
|
||||
static const uint16_t MARK_EXCESS_MICROS = 20;
|
||||
static constexpr size_t PRONTO_LOG_CHUNK_SIZE = 230;
|
||||
|
||||
static uint16_t to_frequency_k_hz(uint16_t code) {
|
||||
if (code == 0)
|
||||
@@ -225,18 +226,17 @@ optional<ProntoData> ProntoProtocol::decode(RemoteReceiveData src) {
|
||||
}
|
||||
|
||||
void ProntoProtocol::dump(const ProntoData &data) {
|
||||
std::string rest;
|
||||
|
||||
rest = data.data;
|
||||
std::string rest = data.data;
|
||||
ESP_LOGI(TAG, "Received Pronto: data=");
|
||||
while (true) {
|
||||
ESP_LOGI(TAG, "%s", rest.substr(0, 230).c_str());
|
||||
if (rest.size() > 230) {
|
||||
rest = rest.substr(230);
|
||||
do {
|
||||
size_t chunk_size = rest.size() > PRONTO_LOG_CHUNK_SIZE ? PRONTO_LOG_CHUNK_SIZE : rest.size();
|
||||
ESP_LOGI(TAG, "%.*s", (int) chunk_size, rest.c_str());
|
||||
if (rest.size() > PRONTO_LOG_CHUNK_SIZE) {
|
||||
rest.erase(0, PRONTO_LOG_CHUNK_SIZE);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
} // namespace remote_base
|
||||
|
||||
@@ -276,7 +276,7 @@ template<typename... Ts> class RemoteTransmitterActionBase : public RemoteTransm
|
||||
TEMPLATABLE_VALUE(uint32_t, send_wait)
|
||||
|
||||
protected:
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->transmitter_->transmit();
|
||||
this->encode(call.get_data(), x...);
|
||||
call.set_send_times(this->send_times_.value_or(x..., 1));
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace remote_transmitter {
|
||||
template<typename... Ts> class DigitalWriteAction : 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...)); }
|
||||
void play(Ts... x) override { this->parent_->digital_write(this->value_.value(x...)); }
|
||||
};
|
||||
|
||||
} // namespace remote_transmitter
|
||||
|
||||
@@ -98,7 +98,7 @@ template<typename... Ts> class RFBridgeSendCodeAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(uint16_t, high)
|
||||
TEMPLATABLE_VALUE(uint32_t, code)
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
RFBridgeData data{};
|
||||
data.sync = this->sync_.value(x...);
|
||||
data.low = this->low_.value(x...);
|
||||
@@ -118,7 +118,7 @@ template<typename... Ts> class RFBridgeSendAdvancedCodeAction : public Action<Ts
|
||||
TEMPLATABLE_VALUE(uint8_t, protocol)
|
||||
TEMPLATABLE_VALUE(std::string, code)
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
RFBridgeAdvancedData data{};
|
||||
data.length = this->length_.value(x...);
|
||||
data.protocol = this->protocol_.value(x...);
|
||||
@@ -134,7 +134,7 @@ template<typename... Ts> class RFBridgeLearnAction : public Action<Ts...> {
|
||||
public:
|
||||
RFBridgeLearnAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) { this->parent_->learn(); }
|
||||
void play(Ts... x) { this->parent_->learn(); }
|
||||
|
||||
protected:
|
||||
RFBridgeComponent *parent_;
|
||||
@@ -144,7 +144,7 @@ template<typename... Ts> class RFBridgeStartAdvancedSniffingAction : public Acti
|
||||
public:
|
||||
RFBridgeStartAdvancedSniffingAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) { this->parent_->start_advanced_sniffing(); }
|
||||
void play(Ts... x) { this->parent_->start_advanced_sniffing(); }
|
||||
|
||||
protected:
|
||||
RFBridgeComponent *parent_;
|
||||
@@ -154,7 +154,7 @@ template<typename... Ts> class RFBridgeStopAdvancedSniffingAction : public Actio
|
||||
public:
|
||||
RFBridgeStopAdvancedSniffingAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) { this->parent_->stop_advanced_sniffing(); }
|
||||
void play(Ts... x) { this->parent_->stop_advanced_sniffing(); }
|
||||
|
||||
protected:
|
||||
RFBridgeComponent *parent_;
|
||||
@@ -164,7 +164,7 @@ template<typename... Ts> class RFBridgeStartBucketSniffingAction : public Action
|
||||
public:
|
||||
RFBridgeStartBucketSniffingAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
|
||||
void play(const Ts &...x) { this->parent_->start_bucket_sniffing(); }
|
||||
void play(Ts... x) { this->parent_->start_bucket_sniffing(); }
|
||||
|
||||
protected:
|
||||
RFBridgeComponent *parent_;
|
||||
@@ -175,7 +175,7 @@ template<typename... Ts> class RFBridgeSendRawAction : public Action<Ts...> {
|
||||
RFBridgeSendRawAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(std::string, raw)
|
||||
|
||||
void play(const Ts &...x) { this->parent_->send_raw(this->raw_.value(x...)); }
|
||||
void play(Ts... x) { this->parent_->send_raw(this->raw_.value(x...)); }
|
||||
|
||||
protected:
|
||||
RFBridgeComponent *parent_;
|
||||
@@ -186,7 +186,7 @@ template<typename... Ts> class RFBridgeBeepAction : public Action<Ts...> {
|
||||
RFBridgeBeepAction(RFBridgeComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(uint16_t, duration)
|
||||
|
||||
void play(const Ts &...x) { this->parent_->beep(this->duration_.value(x...)); }
|
||||
void play(Ts... x) { this->parent_->beep(this->duration_.value(x...)); }
|
||||
|
||||
protected:
|
||||
RFBridgeComponent *parent_;
|
||||
|
||||
@@ -114,7 +114,7 @@ template<typename... Ts> class RotaryEncoderSetValueAction : public Action<Ts...
|
||||
RotaryEncoderSetValueAction(RotaryEncoderSensor *encoder) : encoder_(encoder) {}
|
||||
TEMPLATABLE_VALUE(int, value)
|
||||
|
||||
void play(const Ts &...x) override { this->encoder_->set_value(this->value_.value(x...)); }
|
||||
void play(Ts... x) override { this->encoder_->set_value(this->value_.value(x...)); }
|
||||
|
||||
protected:
|
||||
RotaryEncoderSensor *encoder_;
|
||||
|
||||
@@ -45,7 +45,7 @@ template<typename... Ts> class SetFrequencyAction : public Action<Ts...> {
|
||||
SetFrequencyAction(RP2040PWM *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(float, frequency);
|
||||
|
||||
void play(const Ts &...x) {
|
||||
void play(Ts... x) {
|
||||
float freq = this->frequency_.value(x...);
|
||||
this->parent_->update_frequency(freq);
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ void Rtttl::dump_config() {
|
||||
|
||||
void Rtttl::play(std::string rtttl) {
|
||||
if (this->state_ != State::STATE_STOPPED && this->state_ != State::STATE_STOPPING) {
|
||||
size_t pos = this->rtttl_.find(':');
|
||||
size_t len = (pos != std::string::npos) ? pos : this->rtttl_.length();
|
||||
ESP_LOGW(TAG, "Already playing: %.*s", (int) len, this->rtttl_.c_str());
|
||||
int pos = this->rtttl_.find(':');
|
||||
auto name = this->rtttl_.substr(0, pos);
|
||||
ESP_LOGW(TAG, "Already playing: %s", name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,8 @@ void Rtttl::play(std::string rtttl) {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Playing song %.*s", (int) this->position_, this->rtttl_.c_str());
|
||||
auto name = this->rtttl_.substr(0, this->position_);
|
||||
ESP_LOGD(TAG, "Playing song %s", name.c_str());
|
||||
|
||||
// get default duration
|
||||
this->position_ = this->rtttl_.find("d=", this->position_);
|
||||
|
||||
@@ -122,7 +122,7 @@ template<typename... Ts> class PlayAction : public Action<Ts...> {
|
||||
PlayAction(Rtttl *rtttl) : rtttl_(rtttl) {}
|
||||
TEMPLATABLE_VALUE(std::string, value)
|
||||
|
||||
void play(const Ts &...x) override { this->rtttl_->play(this->value_.value(x...)); }
|
||||
void play(Ts... x) override { this->rtttl_->play(this->value_.value(x...)); }
|
||||
|
||||
protected:
|
||||
Rtttl *rtttl_;
|
||||
@@ -130,12 +130,12 @@ template<typename... Ts> class PlayAction : public Action<Ts...> {
|
||||
|
||||
template<typename... Ts> class StopAction : public Action<Ts...>, public Parented<Rtttl> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->stop(); }
|
||||
void play(Ts... x) override { this->parent_->stop(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsPlayingCondition : public Condition<Ts...>, public Parented<Rtttl> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_playing(); }
|
||||
bool check(Ts... x) override { return this->parent_->is_playing(); }
|
||||
};
|
||||
|
||||
class FinishedPlaybackTrigger : public Trigger<> {
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace scd30 {
|
||||
|
||||
template<typename... Ts> class ForceRecalibrationWithReference : public Action<Ts...>, public Parented<SCD30Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
if (this->value_.has_value()) {
|
||||
this->parent_->force_recalibration_with_reference(this->value_.value(x...));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace scd4x {
|
||||
|
||||
template<typename... Ts> class PerformForcedCalibrationAction : public Action<Ts...>, public Parented<SCD4XComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
if (this->value_.has_value()) {
|
||||
this->parent_->perform_forced_calibration(this->value_.value(x...));
|
||||
}
|
||||
@@ -21,7 +21,7 @@ template<typename... Ts> class PerformForcedCalibrationAction : public Action<Ts
|
||||
|
||||
template<typename... Ts> class FactoryResetAction : public Action<Ts...>, public Parented<SCD4XComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->factory_reset(); }
|
||||
void play(Ts... x) override { this->parent_->factory_reset(); }
|
||||
};
|
||||
|
||||
} // namespace scd4x
|
||||
|
||||
@@ -215,7 +215,7 @@ template<class... As, typename... Ts> class ScriptExecuteAction<Script<As...>, T
|
||||
|
||||
template<typename... F> void set_args(F... x) { args_ = Args{x...}; }
|
||||
|
||||
void play(const Ts &...x) override { this->script_->execute_tuple(this->eval_args_(x...)); }
|
||||
void play(Ts... x) override { this->script_->execute_tuple(this->eval_args_(x...)); }
|
||||
|
||||
protected:
|
||||
// NOTE:
|
||||
@@ -249,7 +249,7 @@ template<class C, typename... Ts> class ScriptStopAction : public Action<Ts...>
|
||||
public:
|
||||
ScriptStopAction(C *script) : script_(script) {}
|
||||
|
||||
void play(const Ts &...x) override { this->script_->stop(); }
|
||||
void play(Ts... x) override { this->script_->stop(); }
|
||||
|
||||
protected:
|
||||
C *script_;
|
||||
@@ -259,7 +259,7 @@ template<class C, typename... Ts> class IsRunningCondition : public Condition<Ts
|
||||
public:
|
||||
explicit IsRunningCondition(C *parent) : parent_(parent) {}
|
||||
|
||||
bool check(const Ts &...x) override { return this->parent_->is_running(); }
|
||||
bool check(Ts... x) override { return this->parent_->is_running(); }
|
||||
|
||||
protected:
|
||||
C *parent_;
|
||||
@@ -281,7 +281,7 @@ template<class C, typename... Ts> class ScriptWaitAction : public Action<Ts...>,
|
||||
this->disable_loop();
|
||||
}
|
||||
|
||||
void play_complex(const Ts &...x) override {
|
||||
void play_complex(Ts... x) override {
|
||||
this->num_running_++;
|
||||
// Check if we can continue immediately.
|
||||
if (!this->script_->is_running()) {
|
||||
@@ -312,7 +312,7 @@ template<class C, typename... Ts> class ScriptWaitAction : public Action<Ts...>,
|
||||
this->disable_loop();
|
||||
}
|
||||
|
||||
void play(const Ts &...x) override { /* ignore - see play_complex */
|
||||
void play(Ts... x) override { /* ignore - see play_complex */
|
||||
}
|
||||
|
||||
void stop() override {
|
||||
|
||||
@@ -19,7 +19,7 @@ template<typename... Ts> class SelectSetAction : public Action<Ts...> {
|
||||
explicit SelectSetAction(Select *select) : select_(select) {}
|
||||
TEMPLATABLE_VALUE(std::string, option)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->select_->make_call();
|
||||
call.set_option(this->option_.value(x...));
|
||||
call.perform();
|
||||
@@ -34,7 +34,7 @@ template<typename... Ts> class SelectSetIndexAction : public Action<Ts...> {
|
||||
explicit SelectSetIndexAction(Select *select) : select_(select) {}
|
||||
TEMPLATABLE_VALUE(size_t, index)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->select_->make_call();
|
||||
call.set_index(this->index_.value(x...));
|
||||
call.perform();
|
||||
@@ -50,7 +50,7 @@ template<typename... Ts> class SelectOperationAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(bool, cycle)
|
||||
TEMPLATABLE_VALUE(SelectOperation, operation)
|
||||
|
||||
void play(const Ts &...x) override {
|
||||
void play(Ts... x) override {
|
||||
auto call = this->select_->make_call();
|
||||
call.with_operation(this->operation_.value(x...));
|
||||
if (this->cycle_.has_value()) {
|
||||
|
||||
@@ -7,8 +7,8 @@ void SelectTraits::set_options(const std::initializer_list<const char *> &option
|
||||
|
||||
void SelectTraits::set_options(const FixedVector<const char *> &options) {
|
||||
this->options_.init(options.size());
|
||||
for (const auto &opt : options) {
|
||||
this->options_.push_back(opt);
|
||||
for (size_t i = 0; i < options.size(); i++) {
|
||||
this->options_[i] = options[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ template<typename... Ts> class StartFanAction : public Action<Ts...> {
|
||||
public:
|
||||
explicit StartFanAction(SEN5XComponent *sen5x) : sen5x_(sen5x) {}
|
||||
|
||||
void play(const Ts &...x) override { this->sen5x_->start_fan_cleaning(); }
|
||||
void play(Ts... x) override { this->sen5x_->start_fan_cleaning(); }
|
||||
|
||||
protected:
|
||||
SEN5XComponent *sen5x_;
|
||||
|
||||
@@ -42,7 +42,7 @@ template<typename... Ts> class SenseAirBackgroundCalibrationAction : public Acti
|
||||
public:
|
||||
SenseAirBackgroundCalibrationAction(SenseAirComponent *senseair) : senseair_(senseair) {}
|
||||
|
||||
void play(const Ts &...x) override { this->senseair_->background_calibration(); }
|
||||
void play(Ts... x) override { this->senseair_->background_calibration(); }
|
||||
|
||||
protected:
|
||||
SenseAirComponent *senseair_;
|
||||
@@ -52,7 +52,7 @@ template<typename... Ts> class SenseAirBackgroundCalibrationResultAction : publi
|
||||
public:
|
||||
SenseAirBackgroundCalibrationResultAction(SenseAirComponent *senseair) : senseair_(senseair) {}
|
||||
|
||||
void play(const Ts &...x) override { this->senseair_->background_calibration_result(); }
|
||||
void play(Ts... x) override { this->senseair_->background_calibration_result(); }
|
||||
|
||||
protected:
|
||||
SenseAirComponent *senseair_;
|
||||
@@ -62,7 +62,7 @@ template<typename... Ts> class SenseAirABCEnableAction : public Action<Ts...> {
|
||||
public:
|
||||
SenseAirABCEnableAction(SenseAirComponent *senseair) : senseair_(senseair) {}
|
||||
|
||||
void play(const Ts &...x) override { this->senseair_->abc_enable(); }
|
||||
void play(Ts... x) override { this->senseair_->abc_enable(); }
|
||||
|
||||
protected:
|
||||
SenseAirComponent *senseair_;
|
||||
@@ -72,7 +72,7 @@ template<typename... Ts> class SenseAirABCDisableAction : public Action<Ts...> {
|
||||
public:
|
||||
SenseAirABCDisableAction(SenseAirComponent *senseair) : senseair_(senseair) {}
|
||||
|
||||
void play(const Ts &...x) override { this->senseair_->abc_disable(); }
|
||||
void play(Ts... x) override { this->senseair_->abc_disable(); }
|
||||
|
||||
protected:
|
||||
SenseAirComponent *senseair_;
|
||||
@@ -82,7 +82,7 @@ template<typename... Ts> class SenseAirABCGetPeriodAction : public Action<Ts...>
|
||||
public:
|
||||
SenseAirABCGetPeriodAction(SenseAirComponent *senseair) : senseair_(senseair) {}
|
||||
|
||||
void play(const Ts &...x) override { this->senseair_->abc_get_period(); }
|
||||
void play(Ts... x) override { this->senseair_->abc_get_period(); }
|
||||
|
||||
protected:
|
||||
SenseAirComponent *senseair_;
|
||||
|
||||
@@ -26,7 +26,7 @@ template<typename... Ts> class SensorPublishAction : public Action<Ts...> {
|
||||
SensorPublishAction(Sensor *sensor) : sensor_(sensor) {}
|
||||
TEMPLATABLE_VALUE(float, state)
|
||||
|
||||
void play(const Ts &...x) override { this->sensor_->publish_state(this->state_.value(x...)); }
|
||||
void play(Ts... x) override { this->sensor_->publish_state(this->state_.value(x...)); }
|
||||
|
||||
protected:
|
||||
Sensor *sensor_;
|
||||
@@ -90,7 +90,7 @@ template<typename... Ts> class SensorInRangeCondition : public Condition<Ts...>
|
||||
|
||||
void set_min(float min) { this->min_ = min; }
|
||||
void set_max(float max) { this->max_ = max; }
|
||||
bool check(const Ts &...x) override {
|
||||
bool check(Ts... x) override {
|
||||
const float state = this->parent_->state;
|
||||
if (std::isnan(this->min_)) {
|
||||
return state <= this->max_;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user