ESPHome  2024.12.2
bedjet_fan.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/defines.h"
5 #include "esphome/core/hal.h"
10 
11 #ifdef USE_ESP32
12 
13 namespace esphome {
14 namespace bedjet {
15 
16 class BedJetFan : public fan::Fan, public BedJetClient, public PollingComponent {
17  public:
18  void update() override;
19  void dump_config() override;
20  float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
21 
22  /* BedJetClient status update */
23  void on_status(const BedjetStatusPacket *data) override;
24  void on_bedjet_state(bool is_ready) override{};
25  std::string describe() override;
26 
27  fan::FanTraits get_traits() override { return fan::FanTraits(false, true, false, BEDJET_FAN_SPEED_COUNT); }
28 
29  protected:
30  void control(const fan::FanCall &call) override;
31 
32  private:
33  void reset_state_();
34  bool update_status_();
35 };
36 
37 } // namespace bedjet
38 } // namespace esphome
39 
40 #endif
const float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition: component.cpp:26
void update() override
Definition: bedjet_fan.cpp:97
float get_setup_priority() const override
Definition: bedjet_fan.h:20
This class simplifies creating components that periodically check a state.
Definition: component.h:283
The format of a BedJet V3 status packet.
Definition: bedjet_codec.h:39
bool is_ready() const
Definition: component.cpp:144
fan::FanTraits get_traits() override
Definition: bedjet_fan.h:27
void dump_config() override
Definition: bedjet_fan.cpp:11
void on_status(const BedjetStatusPacket *data) override
Definition: bedjet_fan.cpp:54
std::string describe() override
Definition: bedjet_fan.cpp:12
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void on_bedjet_state(bool is_ready) override
Definition: bedjet_fan.h:24
void control(const fan::FanCall &call) override
Definition: bedjet_fan.cpp:14