I have a display connected to my ESP32. I want to display current temperature/humidity values on that display… while the ESP pushes data to MQTT/HomeAssistant etc.
And the compile fails with:
Compiling .pioenvs/sensoresp32/src/main.cpp.o
src/main.cpp: In lambda function:
src/main.cpp:544:66: error: ‘class esphome::atc_mithermometer::ATCMiThermometer’ has no member named ‘state’
it.print(0, 20, my_font, “Kitchen: %.2f”, sensor_kitchen->state);
^
*** [.pioenvs/sensoresp32/src/main.cpp.o] Error 1
Can I do what I want to do?
If not, is there a work around?
Compiling .pioenvs/sensoresp32/src/main.cpp.o
src/main.cpp: In lambda function:
src/main.cpp:545:69: error: no matching function for call to 'esphome::display::DisplayBuffer::print(int, int, esphome::display::Font*&, const char [15], float&)'
it.print(0, 20, my_font, "Kitchen: %.2f", kitchen_temp->state);
^
In file included from src/esphome.h:14:0,
from src/main.cpp:3:
src/esphome/components/display/display_buffer.h:139:8: note: candidate: void esphome::display::DisplayBuffer::print(int, int, esphome::display::Font*, esphome::Color, esphome::display::TextAlign, const char*)
void print(int x, int y, Font *font, Color color, TextAlign align, const char *text);
^
display:
- platform: ...
# ...
lambda: |-
it.printf(0, 0, id(my_font), "The sensor value is: %.1f", id(my_sensor).state);
// If the sensor has the value 30.02, the result will be: "The sensor value is: 30.0"
Basically it seems that you only missing a the f in print statement.