14 ESP_LOGD(TAG,
"Received BedJetFan::control");
15 if (!this->
parent_->is_connected()) {
16 ESP_LOGW(TAG,
"Not connected, cannot handle control call yet.");
19 bool did_change =
false;
21 auto state_opt =
call.get_state();
22 if (state_opt.has_value() && this->state != *state_opt) {
32 if (this->
parent_->button_cool()) {
39 auto speed_opt =
call.get_speed();
40 if (this->
state && speed_opt.has_value()) {
41 auto speed = *speed_opt;
56 ESP_LOGVV(TAG,
"[%s] Handling on_status with data=%p", this->
get_name().c_str(), (
void *) data);
57 bool did_change =
false;
60 if (new_state != this->
state) {
61 this->
state = new_state;
66 if (data->fan_step + 1 != this->speed) {
83bool BedJetFan::update_status_() {
84 if (!this->
parent_->is_connected())
86 if (!this->
parent_->has_status())
91 if (status ==
nullptr)
99 ESP_LOGD(TAG,
"[%s] update()", this->
get_name().c_str());
102 auto result = this->update_status_();
103 ESP_LOGD(TAG,
"[%s] update_status result=%s", this->
get_name().c_str(), result ?
"true" :
"false");
107void BedJetFan::reset_state_() {
const StringRef & get_name() const
void dump_config() override
void control(const fan::FanCall &call) override
void on_status(const BedjetStatusPacket *data) override
std::string describe() override
bool state
The current on/off state of the fan.
int speed
The current fan speed level.
@ MODE_WAIT
BedJet is in "wait" mode, a step during a biorhythm program.
@ MODE_STANDBY
BedJet is Off.
The format of a BedJet V3 status packet.
uint8_t fan_step
BedJet fan speed; value is in the 0-19 range, representing 5% increments (5%-100%): 5 + 5 /< * fan_st...