9static const char *
const TAG =
"tc74";
11static const uint8_t TC74_REGISTER_TEMPERATURE = 0x00;
12static const uint8_t TC74_REGISTER_CONFIGURATION = 0x01;
13static const uint8_t TC74_DATA_READY_MASK = 0x40;
18 ESP_LOGCONFIG(TAG,
"Setting up TC74...");
24 this->
data_ready_ = config_reg & TC74_DATA_READY_MASK;
30 LOG_SENSOR(
"",
"TC74",
this);
33 ESP_LOGE(TAG,
"Connection with TC74 failed!");
35 LOG_UPDATE_INTERVAL(
this);
46 if (config_reg & TC74_DATA_READY_MASK) {
49 ESP_LOGD(TAG,
"TC74 not ready");
54 uint8_t temperature_reg;
60 ESP_LOGD(TAG,
"Got Temperature=%d °C", temperature_reg);
virtual void mark_failed()
Mark this component as failed.
void status_set_warning(const char *message="unspecified")
void status_clear_warning()
ErrorCode read_register(uint8_t a_register, uint8_t *data, size_t len, bool stop=true)
reads an array of bytes from a specific register in the I²C device
void publish_state(float state)
Publish a new state to the front-end.
void read_temperature_()
Internal method to read the temperature from the component after it has been scheduled.
void update() override
Update the sensor value (temperature).
void setup() override
Setup the sensor and check connection.
float get_setup_priority() const override
void dump_config() override
@ ERROR_OK
No error found during execution of method.
const float DATA
For components that import data from directly connected sensors like DHT.
Providing packet encoding functions for exchanging data with a remote host.