ESPHome
2026.11.0b6
Loading...
Searching...
No Matches
esphome
components
ds3231
sensor
ds3231_temperature.cpp
Go to the documentation of this file.
1
#include "
ds3231_temperature.h
"
2
#include "
esphome/core/log.h
"
3
4
namespace
esphome::ds3231
{
5
6
ESPHOME_LOG_TAG
(TAG,
"ds3231.sensor"
);
7
8
void
DS3231TemperatureSensor::update
() {
9
float
temperature
;
10
if
(!this->
status_comm_result
(this->
parent_
->read_temperature(temperature)))
11
return
;
12
this->
publish_state
(temperature);
13
}
14
15
void
DS3231TemperatureSensor::dump_config
() {
16
LOG_SENSOR(
""
,
"DS3231 Temperature"
,
this
);
17
LOG_UPDATE_INTERVAL(
this
);
18
}
19
20
}
// namespace esphome::ds3231
esphome::Component::status_comm_result
bool status_comm_result(bool ok)
Clears the warning when ok, else sets it with message (default "Communication failed"); returns ok.
Definition
component.cpp:293
esphome::Parented< DS3231Component >::parent_
DS3231Component * parent_
Definition
helpers.h:2171
esphome::ds3231::DS3231TemperatureSensor::dump_config
void dump_config() override
Definition
ds3231_temperature.cpp:15
esphome::ds3231::DS3231TemperatureSensor::update
void update() override
Definition
ds3231_temperature.cpp:8
esphome::sensor::Sensor::publish_state
void publish_state(float state)
Publish a new state to the front-end.
Definition
sensor.cpp:65
ds3231_temperature.h
log.h
esphome::ds3231
Definition
ds3231.cpp:8
esphome::ds3231::ESPHOME_LOG_TAG
ESPHOME_LOG_TAG(TAG, "ds3231")
temperature
uint16_t temperature
Definition
sun_gtil2.cpp:12
Generated by
1.12.0