esphome/esphome/components/senseair/senseair.h
Nikolay Vasilchuk d51c0f13c0 SenseAir S8 CO2 sensor support (#705)
* Компилится

* Tests

* Checksum calculation

* Read status
2019-10-17 21:37:24 +02:00

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