7 static const char *
const TAG =
"smt100";
10 ESP_LOGV(TAG,
"Sending measurement request");
15 static char buffer[MAX_LINE_LENGTH];
18 int counts = (int) strtol((strtok(buffer,
",")),
nullptr, 10);
19 float dielectric_constant = (float) strtod((strtok(
nullptr,
",")),
nullptr);
20 float moisture = (float) strtod((strtok(
nullptr,
",")),
nullptr);
21 float temperature = (float) strtod((strtok(
nullptr,
",")),
nullptr);
22 float voltage = (float) strtod((strtok(
nullptr,
",")),
nullptr);
50 ESP_LOGCONFIG(TAG,
"SMT100:");
56 LOG_UPDATE_INTERVAL(
this);
74 buffer[pos++] = readch;
void write_str(const char *str)
const float DATA
For components that import data from directly connected sensors like DHT.
void dump_config() override
sensor::Sensor * dielectric_constant_sensor_
sensor::Sensor * moisture_sensor_
void check_uart_settings(uint32_t baud_rate, uint8_t stop_bits=1, UARTParityOptions parity=UART_CONFIG_PARITY_NONE, uint8_t data_bits=8)
Check that the configuration of the UART bus matches the provided values and otherwise print a warnin...
sensor::Sensor * temperature_sensor_
void publish_state(float state)
Publish a new state to the front-end.
float get_setup_priority() const override
Implementation of SPI Controller mode.
sensor::Sensor * counts_sensor_
sensor::Sensor * voltage_sensor_
int readline_(int readch, char *buffer, int len)