2019-04-17 12:06:00 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "esphome/core/component.h"
|
|
|
|
#include "esphome/components/output/binary_output.h"
|
|
|
|
#include "esphome/components/fan/fan_state.h"
|
|
|
|
|
|
|
|
namespace esphome {
|
|
|
|
namespace binary {
|
|
|
|
|
|
|
|
class BinaryFan : public Component {
|
|
|
|
public:
|
2019-04-22 21:56:30 +02:00
|
|
|
void set_fan(fan::FanState *fan) { fan_ = fan; }
|
|
|
|
void set_output(output::BinaryOutput *output) { output_ = output; }
|
2019-04-17 12:06:00 +02:00
|
|
|
void setup() override;
|
|
|
|
void loop() override;
|
|
|
|
void dump_config() override;
|
|
|
|
float get_setup_priority() const override;
|
|
|
|
void set_oscillating(output::BinaryOutput *oscillating) { this->oscillating_ = oscillating; }
|
2020-06-14 21:54:31 +02:00
|
|
|
void set_direction(output::BinaryOutput *direction) { this->direction_ = direction; }
|
2019-04-17 12:06:00 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
fan::FanState *fan_;
|
|
|
|
output::BinaryOutput *output_;
|
|
|
|
output::BinaryOutput *oscillating_{nullptr};
|
2020-06-14 21:54:31 +02:00
|
|
|
output::BinaryOutput *direction_{nullptr};
|
2019-04-17 12:06:00 +02:00
|
|
|
bool next_update_{true};
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace binary
|
|
|
|
} // namespace esphome
|