mirror of
https://github.com/esphome/esphome.git
synced 2024-12-03 20:24:14 +01:00
d51c0f13c0
* Компилится * Tests * Checksum calculation * Read status
26 lines
725 B
C++
26 lines
725 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/sensor/sensor.h"
|
|
#include "esphome/components/uart/uart.h"
|
|
|
|
namespace esphome {
|
|
namespace senseair {
|
|
|
|
class SenseAirComponent : public PollingComponent, public uart::UARTDevice {
|
|
public:
|
|
float get_setup_priority() const override { return setup_priority::DATA; }
|
|
void set_co2_sensor(sensor::Sensor *co2_sensor) { co2_sensor_ = co2_sensor; }
|
|
|
|
void update() override;
|
|
void dump_config() override;
|
|
|
|
protected:
|
|
uint16_t senseair_checksum_(uint8_t *ptr, uint8_t length);
|
|
bool senseair_write_command_(const uint8_t *command, uint8_t *response);
|
|
|
|
sensor::Sensor *co2_sensor_{nullptr};
|
|
};
|
|
|
|
} // namespace senseair
|
|
} // namespace esphome
|