mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-28 08:48:27 +02:00
5e2d4e332a
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
43 lines
850 B
C++
43 lines
850 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/core/automation.h"
|
|
#include "esphome/components/sensor/sensor.h"
|
|
#include "esphome/components/uart/uart.h"
|
|
|
|
namespace esphome {
|
|
namespace t6615 {
|
|
|
|
enum class T6615Command : uint8_t {
|
|
NONE = 0,
|
|
GET_PPM,
|
|
GET_SERIAL,
|
|
GET_VERSION,
|
|
GET_ELEVATION,
|
|
GET_ABC,
|
|
ENABLE_ABC,
|
|
DISABLE_ABC,
|
|
SET_ELEVATION,
|
|
};
|
|
|
|
class T6615Component : public PollingComponent, public uart::UARTDevice {
|
|
public:
|
|
float get_setup_priority() const override;
|
|
|
|
void loop() override;
|
|
void update() override;
|
|
void dump_config() override;
|
|
|
|
void set_co2_sensor(sensor::Sensor *co2_sensor) { this->co2_sensor_ = co2_sensor; }
|
|
|
|
protected:
|
|
void query_ppm_();
|
|
|
|
T6615Command command_ = T6615Command::NONE;
|
|
|
|
sensor::Sensor *co2_sensor_{nullptr};
|
|
};
|
|
|
|
} // namespace t6615
|
|
} // namespace esphome
|