ESPHome  2024.11.1
smt100.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace smt100 {
9 
11  static const uint16_t MAX_LINE_LENGTH = 31;
12 
13  public:
14  SMT100Component() = default;
15 
16  void dump_config() override;
17  void loop() override;
18  void update() override;
19 
20  float get_setup_priority() const override;
21 
22  void set_counts_sensor(sensor::Sensor *counts_sensor) { this->counts_sensor_ = counts_sensor; }
23  void set_dielectric_constant_sensor(sensor::Sensor *dielectric_constant_sensor) {
24  this->dielectric_constant_sensor_ = dielectric_constant_sensor;
25  }
26  void set_temperature_sensor(sensor::Sensor *temperature_sensor) { this->temperature_sensor_ = temperature_sensor; }
27  void set_moisture_sensor(sensor::Sensor *moisture_sensor) { this->moisture_sensor_ = moisture_sensor; }
28  void set_voltage_sensor(sensor::Sensor *voltage_sensor) { this->voltage_sensor_ = voltage_sensor; }
29 
30  protected:
31  int readline_(int readch, char *buffer, int len);
32 
38 
39  uint32_t last_transmission_{0};
40 };
41 
42 } // namespace smt100
43 } // namespace esphome
void dump_config() override
Definition: smt100.cpp:49
This class simplifies creating components that periodically check a state.
Definition: component.h:283
sensor::Sensor * dielectric_constant_sensor_
Definition: smt100.h:34
sensor::Sensor * moisture_sensor_
Definition: smt100.h:35
sensor::Sensor * temperature_sensor_
Definition: smt100.h:36
float get_setup_priority() const override
Definition: smt100.cpp:47
void set_voltage_sensor(sensor::Sensor *voltage_sensor)
Definition: smt100.h:28
void set_counts_sensor(sensor::Sensor *counts_sensor)
Definition: smt100.h:22
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition: smt100.h:26
std::string size_t len
Definition: helpers.h:293
void set_dielectric_constant_sensor(sensor::Sensor *dielectric_constant_sensor)
Definition: smt100.h:23
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57
sensor::Sensor * counts_sensor_
Definition: smt100.h:33
void set_moisture_sensor(sensor::Sensor *moisture_sensor)
Definition: smt100.h:27
sensor::Sensor * voltage_sensor_
Definition: smt100.h:37
int readline_(int readch, char *buffer, int len)
Definition: smt100.cpp:60