mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-19 04:33:27 +02:00
2a84db7f85
Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl> Co-authored-by: rob-deutsch <robzyb+altgithub@gmail.com> Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
32 lines
966 B
C++
32 lines
966 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/output/binary_output.h"
|
|
#include "esphome/components/output/float_output.h"
|
|
#include "esphome/components/fan/fan.h"
|
|
|
|
namespace esphome {
|
|
namespace speed {
|
|
|
|
class SpeedFan : public Component, public fan::Fan {
|
|
public:
|
|
SpeedFan(output::FloatOutput *output, int speed_count) : output_(output), speed_count_(speed_count) {}
|
|
void setup() override;
|
|
void dump_config() override;
|
|
void set_oscillating(output::BinaryOutput *oscillating) { this->oscillating_ = oscillating; }
|
|
void set_direction(output::BinaryOutput *direction) { this->direction_ = direction; }
|
|
fan::FanTraits get_traits() override;
|
|
|
|
protected:
|
|
void control(const fan::FanCall &call) override;
|
|
void write_state_();
|
|
|
|
output::FloatOutput *output_;
|
|
output::BinaryOutput *oscillating_{nullptr};
|
|
output::BinaryOutput *direction_{nullptr};
|
|
int speed_count_{};
|
|
};
|
|
|
|
} // namespace speed
|
|
} // namespace esphome
|