15 ESP_LOGD(TAG,
"Received BedJetFan::control");
16 if (!this->
parent_->is_connected()) {
17 ESP_LOGW(TAG,
"Not connected, cannot handle control call yet.");
20 bool did_change =
false;
22 auto state_opt =
call.get_state();
23 if (state_opt.has_value() && this->state != *state_opt) {
33 if (this->
parent_->button_cool()) {
40 auto speed_opt =
call.get_speed();
41 if (this->
state && speed_opt.has_value()) {
42 auto speed = *speed_opt;
57 ESP_LOGVV(TAG,
"[%s] Handling on_status with data=%p", this->
get_name().c_str(), (
void *) data);
58 bool did_change =
false;
61 if (new_state != this->
state) {
62 this->
state = new_state;
67 if (data->
fan_step + 1 != this->speed) {
84bool BedJetFan::update_status_() {
85 if (!this->
parent_->is_connected())
87 if (!this->
parent_->has_status())
92 if (status ==
nullptr)
100 ESP_LOGD(TAG,
"[%s] update()", this->
get_name().c_str());
103 auto result = this->update_status_();
104 ESP_LOGD(TAG,
"[%s] update_status result=%s", this->
get_name().c_str(), result ?
"true" :
"false");
108void 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.
Providing packet encoding functions for exchanging data with a remote host.
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...
BedjetMode mode
BedJet operating mode.