8static const char *
const TAG =
"ufire_ise";
12 if (!this->
read_byte(REGISTER_VERSION, &version) || version == 0xFF) {
16 ESP_LOGI(TAG,
"Found uFire_ise board version 0x%02X", version);
20 this->
read_byte(REGISTER_CONFIG, &config);
22 config &= ~CONFIG_TEMP_COMPENSATION;
24 config |= CONFIG_TEMP_COMPENSATION;
32 this->
write_byte(REGISTER_TASK, COMMAND_MEASURE_TEMP);
36 this->
write_byte(REGISTER_TASK, COMMAND_MEASURE_MV);
73 ph = fabs(7.0 - (mv / PROBE_MV_TO_PH));
76 float distance_from_7 = std::abs(7 - roundf(ph));
77 float distance_from_25 = std::floor(std::abs(25 - roundf(
temperature)) / 10);
78 float temp_multiplier = (distance_from_25 * distance_from_7) * PROBE_TMP_CORRECTION;
80 temp_multiplier *= -1;
82 temp_multiplier *= -1;
84 ph += temp_multiplier;
85 if ((ph <= 0.0) || (ph > 14.0))
96 solution = (7 - solution) * PROBE_MV_TO_PH;
102 this->
write_byte(REGISTER_TASK, COMMAND_CALIBRATE_LOW);
107 this->
write_byte(REGISTER_TASK, COMMAND_CALIBRATE_HIGH);
121 this->
write(®, 1);
124 for (uint8_t i = 0; i < 4; i++) {
127 memcpy(&
f, temp,
sizeof(
f));
135 memcpy(temp, &data,
sizeof(data));
141 ESP_LOGCONFIG(TAG,
"uFire-ISE");
143 LOG_UPDATE_INTERVAL(
this);
144 LOG_SENSOR(
" ",
"PH Sensor", this->
ph_sensor_);
void mark_failed()
Mark this component as failed.
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_timeout(const std voi set_timeout)(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t std::function< RetryResult(uint8_t)> && f
ErrorCode write(const uint8_t *data, size_t len) const
writes an array of bytes to a device using an I2CBus
optional< std::array< uint8_t, N > > read_bytes_raw()
bool write_byte(uint8_t a_register, uint8_t data) const
bool read_byte(uint8_t a_register, uint8_t *data)
bool write_bytes(uint8_t a_register, const uint8_t *data, uint8_t len) const
void publish_state(float state)
Publish a new state to the front-end.
float state
This member variable stores the last state that has passed through all filters.
float read_data_(uint8_t reg)
sensor::Sensor * ph_sensor_
sensor::Sensor * temperature_sensor_
void set_solution_(float solution)
void write_data_(uint8_t reg, float data)
sensor::Sensor * temperature_sensor_external_
void calibrate_probe_low(float solution)
float measure_ph_(float temperature)
float measure_temperature_()
void dump_config() override
void calibrate_probe_high(float solution)
void HOT delay(uint32_t ms)