Hello. I’m trying to display some temperature values from HA into a waveshare_epaper display.
however, I’m getting NAN all the time.
I can see that values are being received on the ESP sensor:
[13:51:45][D][homeassistant.binary_sensor:026]: 'input_boolean.e_ink_prevent_deep_sleep': Got state OFF
[13:51:45][D][binary_sensor:034]: 'E-ink esphome Prevent Deep Sleep': Sending initial state OFF
[13:51:45][D][homeassistant.sensor:024]: 'sensor.mijia_temperature': Got state 23.80
[13:51:45][D][sensor:125]: 'office_temp': Sending state 23.80000 with 1 decimals of accuracy
[13:51:45][D][homeassistant.sensor:024]: 'sensor.mj_salon_temp': Got state 23.40
[13:51:45][D][sensor:125]: 'salon_temp': Sending state 23.40000 with 1 decimals of accuracy
Just out of curiosity, I tried to put the printf statement behind an if flag like this:
if (id(office_temp).has_state())
it.printf(0, 25, id(font1), TextAlign::TOP_LEFT, "%.1fC", id(office_temp).state);
else
ESP_LOGD("screen", "No data from HA for office_temp");
and now I get a value on the screen.
My guess is that the display is trying to update itself when the values are not available yet, and then it overrides whatever value it has with the not available one yet. But why all the times it is not available? How is that possible? It is an e-ink display, setup to do updates not often, why it always tries to refresh when values are not available? If it were updating every second, then I could understand that it may be always with the latest invalid value.
In any case, is it advisable to always run this kind of checks?