Epaper result NAN sensor value

Hi!
This is my setup:
Home Assistant on Rasp 3 with ESPhome Addons installed.
I use to compile .yaml file: Esphome (version 2022.6.2) on Windows installed wiht Python. Because raspberry crash when i try to compile .yaml with addons on HA.

And I use:
1.54 inch epaper waveshare with D1 mini V3 NodeMCU for the project.

This is the yaml code:

#######################################

esphome:
  name: esp-display1
  platform: ESP8266
  board: esp01_1m
 
#######################################

wifi:
  ssid: "NAME"
  password: "PASS"

#######################################

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Display1 Fallback Hotspot"
    password: "26McVGW43JXL"

#######################################

captive_portal:

#######################################

logger:

#######################################
# Enable Home Assistant API
api:
  encryption:
    key: "KEY"

#######################################

ota:
  password: "3f0e3244b0f7cefd640283ebe9b9f375"

#######################################

time:
  - platform: homeassistant
    id: esptime

#######################################

sensor:
  - platform: homeassistant
    id: giardino_temp
    entity_id: sensor.0x158d000549afdc_temperature
    internal: true
    
#######################################

spi:
  clk_pin: 14
  mosi_pin: 13  #DIN

#######################################


font:

  # gfonts://family[@weight]
  - file: "gfonts://Roboto"
    id: roboto
    size: 20
    
  - file: "gfonts://Roboto"
    id: roboto30
    size: 30
         
#######################################

#######################################    

display:
  - platform: waveshare_epaper
    id: epaperdisplay
    cs_pin: 15
    dc_pin: 12
    update_interval: 3600s
    busy_pin: 16
    reset_pin: 4
    model: 1.54inv2
    lambda: |-

      /* PROVA */      
        
      // Print the string "Hello World!" at [50,10]
      it.print(50, 10, id(roboto), "Ciaooooo!");
      
      // Print time in HH:MM format
      it.strftime(5, 60, id(roboto), TextAlign::BASELINE_LEFT, "AGGIORNATO: %H:%M", id(esptime).now());
      
      
      // Print outside temperature (from homeassistant sensor)
      it.printf(20, 90, id(roboto), TextAlign::BASELINE_LEFT , "GIARDINO: %.2f", id(giardino_temp).state);
      

This i the log output from esphome addons on HA:

INFO Reading configuration /config/esphome/esp-display1.yaml...
INFO Detected timezone 'Europe/Rome'
INFO Starting log output from esp-display1.local using esphome API
INFO Successfully connected to esp-display1.local
[10:14:22][I][app:102]: ESPHome version 2022.6.2 compiled on Jul 10 2022, 10:08:43
[10:14:22][C][wifi:491]: WiFi:
[10:14:22][C][wifi:353]:   Local MAC: 48:55:19:C7:DD:11
[10:14:22][C][wifi:354]:   SSID: 'NAME'[redacted]
[10:14:22][C][wifi:355]:   IP Address: 192.168.1.149
[10:14:22][C][wifi:356]:   BSSID: D4:35:1D:[redacted]
[10:14:22][C][wifi:358]:   Hostname: 'esp-display1'
[10:14:22][C][wifi:360]:   Signal strength: -59 dB ā–‚ā–„ā–†ā–ˆ
[10:14:22][C][wifi:364]:   Channel: 6
[10:14:22][C][wifi:365]:   Subnet: 255.255.255.0
[10:14:22][C][wifi:366]:   Gateway: 192.168.1.1
[10:14:22][C][wifi:367]:   DNS1: 192.168.1.1
[10:14:22][C][wifi:368]:   DNS2: 0.0.0.0
[10:14:22][C][logger:275]: Logger:
[10:14:22][C][logger:276]:   Level: DEBUG
[10:14:22][C][logger:277]:   Log Baud Rate: 115200
[10:14:22][C][logger:278]:   Hardware UART: UART0
[10:14:22][C][spi:097]: SPI bus:
[10:14:22][C][spi:098]:   CLK Pin: GPIO14
[10:14:22][C][spi:100]:   MOSI Pin: GPIO13
[10:14:22][C][spi:102]:   Using HW SPI: YES
[10:14:22][C][homeassistant.time:010]: Home Assistant Time:
[10:14:22][C][homeassistant.time:011]:   Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[10:14:22][C][waveshare_epaper:221]: Waveshare E-Paper
[10:14:22][C][waveshare_epaper:221]:   Rotations: 0 Ā°
[10:14:22][C][waveshare_epaper:221]:   Dimensions: 200px x 200px
[10:14:22][C][waveshare_epaper:227]:   Model: 1.54inV2
[10:14:22][C][waveshare_epaper:251]:   Full Update Every: 30
[10:14:22][C][waveshare_epaper:252]:   Reset Pin: GPIO4
[10:14:22][C][waveshare_epaper:253]:   DC Pin: GPIO12
[10:14:22][C][waveshare_epaper:254]:   Busy Pin: GPIO16
[10:14:22][C][waveshare_epaper:255]:   Update Interval: 3600.0s
[10:14:22][C][captive_portal:088]: Captive Portal:
[10:14:22][C][mdns:084]: mDNS:
[10:14:22][C][mdns:085]:   Hostname: esp-display1
[10:14:22][C][ota:085]: Over-The-Air Updates:
[10:14:22][C][ota:086]:   Address: esp-display1.local:8266
[10:14:22][C][ota:089]:   Using Password.
[10:14:22][C][api:138]: API Server:
[10:14:22][C][api:139]:   Address: esp-display1.local:6053
[10:14:22][C][api:141]:   Using noise encryption: YES
[10:14:22][C][homeassistant.sensor:030]: Homeassistant Sensor 'giardino_temp'
[10:14:22][C][homeassistant.sensor:030]:   State Class: ''
[10:14:22][C][homeassistant.sensor:030]:   Unit of Measurement: ''
[10:14:22][C][homeassistant.sensor:030]:   Accuracy Decimals: 1
[10:14:22][C][homeassistant.sensor:031]:   Entity ID: 'sensor.0x158d000549afdc_temperature'

And this is the result:

The time is incorrect, and the temperature for the garden sensor is NAN???
Why??
Thanks
Luca

The log does not show what you are sending and how you setup the field on the screenā€¦ (incase you did not know: nan means not-a-number)
EDITā€¦ I only know of nextion panels and for the time I use this:
it.set_component_text_printf(ā€œHome.timeā€, ā€œ%02i:%02iā€, id(esptime).now().hour, id(homeassistant_time).now().minute);
(ā€œHome.timeā€ is the field ā€˜timeā€™ on page ā€˜Homeā€™)

So because that is a ā€œremoteā€ sensor value ha actually needs to be connected to that esphome node (via native api) to get this working. Is the that esphome configured (as integration) in ha? Is it connected the time of testing (see esphome logs for that).

You can also add it this way then the sensor will only be displayed if there is a state.

      // Print outside temperature (from homeassistant sensor)
      if (id(giardino_temp).has_state()) {
        it.printf(20, 90, id(roboto), TextAlign::BASELINE_LEFT , "GIARDINO: %.2f", id(giardino_temp).state);
      }

I had the same issue a while back. Turns out I hadnā€™t added the device into HA.

To fix it I went into HA Settings > Devices & Services and hit ā€˜Add Integrationā€™. Searched for ESPHome and added the IP address of the device.

As soon as I had done that, rebooted the ESP device and the time and sensors started reading from HA.

HTH

5 Likes

Yeahā€¦wellā€¦I did not guess that :slight_smile: as an option
Another FYIā€¦ when connected, at some point my log shows data with an update sent to the screen:

[12:38:41][D][homeassistant.sensor:022]: 'weather.home::temperature': Got attribute state 28.80

You can simulate this by updating the sensor value in HA

1 Like

Thank you all for the answers.
I have reboot a lot of time ESPhome on HA but nothing.
I have re installed ESPhome on HA and ITS WORK!!
I donā€™t know whyā€¦
Maybe because itā€™s time to abandon Raspberryā€¦ :upside_down_face: