Add support for STS3x Temperature sensors (#669)

* Add support for Sensirion STS3x Temperature sensors

* Removed humidty reading from STS3x sensor

* Fixed line error and operand error

* Fixed syntax

* Add test snippet for STS3x sensor

* Clean up

* #550 Proactive fix for STS3x component reporting WARNING status and reinitialzing similar to SHT3xd

* Flattened config.

* Fixed missing temperature unit

* Code formatting

* Added marking for future commands

* Cleanup

* Removed whitespace

* Cleanup

* Cleanup
This commit is contained in:
Nad
2019-10-19 21:31:37 +02:00
committed by Otto Winter
parent 7063aa6009
commit 18426b71e4
5 changed files with 172 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/components/sensor/sensor.h"
#include "esphome/components/i2c/i2c.h"
namespace esphome {
namespace sts3x {
/// This class implements support for the ST3x-DIS family of temperature i2c sensors.
class STS3XComponent : 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:
bool write_command_(uint16_t command);
bool read_data_(uint16_t *data, uint8_t len);
};
} // namespace sts3x
} // namespace esphome