mirror of
https://github.com/esphome/esphome.git
synced 2024-12-02 11:44:13 +01:00
25 lines
733 B
C++
25 lines
733 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/sensor/sensor.h"
|
|
#include "esphome/components/i2c/i2c.h"
|
|
|
|
namespace esphome {
|
|
namespace tee501 {
|
|
|
|
/// This class implements support for the tee501 of temperature i2c sensors.
|
|
class TEE501Component : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
|
public:
|
|
void setup() override;
|
|
void dump_config() override;
|
|
float get_setup_priority() const override;
|
|
void update() override;
|
|
|
|
protected:
|
|
unsigned char calc_crc8_(const unsigned char buf[], unsigned char from, unsigned char to);
|
|
|
|
enum ErrorCode { NONE = 0, COMMUNICATION_FAILED, CRC_CHECK_FAILED } error_code_{NONE};
|
|
};
|
|
|
|
} // namespace tee501
|
|
} // namespace esphome
|