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;
24 if (this->
state && this->parent_->button_off()) {
26 this->publish_state();
32 if (this->parent_->button_cool()) {
44 this->parent_->set_fan_index(this->
speed - 1);
50 this->publish_state();
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) {
66 this->
speed = data->fan_step + 1;
71 this->publish_state();
82 bool BedJetFan::update_status_() {
83 if (!this->parent_->is_connected())
85 if (!this->parent_->has_status())
88 auto *
status = this->parent_->get_status_packet();
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");
106 void BedJetFan::reset_state_() {
108 this->publish_state();
optional< int > get_speed() const
BedJet is in "wait" mode, a step during a biorhythm program.
The format of a BedJet V3 status packet.
void dump_config() override
optional< bool > get_state() const
void on_status(const BedjetStatusPacket *data) override
std::string describe() override
Implementation of SPI Controller mode.
void control(const fan::FanCall &call) override