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 if (
call.get_state().has_value() && this->state != *
call.get_state()) {
32 if (this->
parent_->button_cool()) {
55 ESP_LOGVV(TAG,
"[%s] Handling on_status with data=%p", this->
get_name().c_str(), (
void *) data);
56 bool did_change =
false;
59 if (new_state != this->
state) {
60 this->
state = new_state;
65 if (data->
fan_step + 1 != this->speed) {
82bool BedJetFan::update_status_() {
83 if (!this->
parent_->is_connected())
85 if (!this->
parent_->has_status())
90 if (status ==
nullptr)
98 ESP_LOGD(TAG,
"[%s] update()", this->
get_name().c_str());
101 auto result = this->update_status_();
102 ESP_LOGD(TAG,
"[%s] update_status result=%s", this->
get_name().c_str(), result ?
"true" :
"false");
106void 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
optional< int > get_speed() const
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.