NSPanel ESPTime doesnt work anymore

Hello everybody,

my NSPanel runson ESPHOME 2023.5.5 an everything is fine . Now i wanted to update to 2023.6.1 .
But i got an compiling-error .
after deleting this part in ESPHOME , it work fine.
---


time:
  - platform: homeassistant
    id: homeassistant_time
    timezone: 'Europe/Berlin'
    on_time:
      - seconds: 0
        minutes: /1
        then:
          - lambda: id(disp1).set_component_text_printf("Home.time", "%02i:%02i",id(homeassistant_time).now().hour, id(homeassistant_time).now().minute);
          - lambda: id(disp1).set_component_text_printf("Home.date", "%02i.%02i %i",id(homeassistant_time).now().day_of_month, id(homeassistant_time).now().month , id(homeassistant_time).now().year);
          - lambda: id(disp1).set_component_text_printf("Home.weekday", "%s", id(dayoftheweek).state.c_str());

Compiling /data/nspanel/.pioenvs/nspanel/src/esphome/components/nextion/nextion.cpp.o
Compiling /data/nspanel/.pioenvs/nspanel/src/esphome/components/nextion/nextion_commands.cpp.o
In file included from src/esphome/components/nextion/nextion_commands.cpp:1:
src/esphome/components/nextion/nextion.h:324:35: error: 'esphome::time::ESPTime' has not been declared
   void set_nextion_rtc_time(time::ESPTime time);
                                   ^~~~~~~
src/esphome/components/nextion/nextion_commands.cpp:223:42: error: variable or field 'set_nextion_rtc_time' declared void
 void Nextion::set_nextion_rtc_time(time::ESPTime time) {
                                          ^~~~~~~
src/esphome/components/nextion/nextion_commands.cpp:223:42: error: 'ESPTime' is not a member of 'esphome::time'
src/esphome/components/nextion/nextion_commands.cpp:223:42: note: suggested alternative:
In file included from src/esphome/components/time/real_time_clock.h:8,
                 from src/esphome/components/nextion/nextion.h:21,
                 from src/esphome/components/nextion/nextion_commands.cpp:1:
src/esphome/core/time.h:12:8: note:   'esphome::ESPTime'
 struct ESPTime {
        ^~~~~~~
In file included from src/esphome/components/nextion/nextion.cpp:1:
src/esphome/components/nextion/nextion.h:324:35: error: 'esphome::time::ESPTime' has not been declared
   void set_nextion_rtc_time(time::ESPTime time);
                                   ^~~~~~~
*** [/data/nspanel/.pioenvs/nspanel/src/esphome/components/nextion/nextion_commands.cpp.o] Error 1
*** [/data/nspanel/.pioenvs/nspanel/src/esphome/components/nextion/nextion.cpp.o] Error 1
========================== [FAILED] Took 5.02 seconds ==========================

Post your code properly please.

1 Like

For whatever reason, the compilation uses an older version of nextion.
Try after cleaning the build files

2 Likes

Thank you .

2 more things to solve the problem.

removed in Esphome Device Yaml:

external_components:
  - source: github://pr#2956
    components: [nextion]
    refresh: 1h

after this , i can compile without errors.

and for the " Nextion reported variable name invalid" error

   - platform: nextion
     name: $device_name INPUTKEYPAD
     id: disp1_inputkeypad
     component_name: code
     update_interval: 1s

after this , Log was clean…

1 Like

Similar issue here - in my case to remove the compilation error for esptime I had to do a clean build and then remove the following:

external_components:
  - source:
      type: git
      url: https://github.com/velaar/esphome
      ref: dev
    components: [ waveshare_epaper, display]

So now it compiles, but the display on my waveshare e-ink panel is corrupted.

Thanks guys, I just commented out the github section and it updated with no issues.

external_components:

  • source: github://pr#2956
    components: [nextion]
    refresh: 1h

I am using this for a Sonoff NSpanel.

The solution to remove the outdated external components works to compile correctly without the “ESPTime not declared” error message.

However, I think removing that is now inhibiting my ability to update the tft file via uart.
When I make a service call in Home Assistant “ESPHome: nspanel_upload_tft” I get the following error messages in the log:

[12:32:55][E][uart:015]: Reading from UART timed out at byte 0!
[12:32:55][W][nextion:072]: Nextion is not connected! 
[12:32:55][W][component:204]: Component nextion.display took a long time for an operation (0.11 s).
[12:32:55][W][component:205]: Components should block for at most 20-30ms.

I have the same issue here.
My compilation used to work fine but after doing updates, I now get the following:
In file included from src/esphome/components/nextion/nextion_commands.cpp:1:
src/esphome/components/nextion/nextion.h:324:35: error: ‘esphome::time::ESPTime’ has not been declared
void set_nextion_rtc_time(time::ESPTime time);
^~~~~~~
src/esphome/components/nextion/nextion_commands.cpp:223:42: error: variable or field ‘set_nextion_rtc_time’ declared void
void Nextion::set_nextion_rtc_time(time::ESPTime time) {
^~~~~~~
src/esphome/components/nextion/nextion_commands.cpp:223:42: error: ‘ESPTime’ is not a member of ‘esphome::time’
src/esphome/components/nextion/nextion_commands.cpp:223:42: note: suggested alternative:
In file included from src/esphome/components/time/real_time_clock.h:8,
from src/esphome/components/nextion/nextion.h:21,
from src/esphome/components/nextion/nextion_commands.cpp:1:
src/esphome/core/time.h:12:8: note: ‘esphome::ESPTime’
struct ESPTime {
^~~~~~~
In file included from src/esphome/components/nextion/nextion.cpp:1:
src/esphome/components/nextion/nextion.h:324:35: error: ‘esphome::time::ESPTime’ has not been declared
void set_nextion_rtc_time(time::ESPTime time);
^~~~~~~
In file included from src/esphome/components/nextion/nextion_upload.cpp:1:
src/esphome/components/nextion/nextion.h:324:35: error: ‘esphome::time::ESPTime’ has not been declared
void set_nextion_rtc_time(time::ESPTime time);
^~~~~~~
*** [/data/sonoff-nsp-lounge/.pioenvs/sonoff-nsp-lounge/src/esphome/components/nextion/nextion_commands.cpp.o] Error 1
*** [/data/sonoff-nsp-lounge/.pioenvs/sonoff-nsp-lounge/src/esphome/components/nextion/nextion_upload.cpp.o] Error 1
*** [/data/sonoff-nsp-lounge/.pioenvs/sonoff-nsp-lounge/src/esphome/components/nextion/nextion.cpp.o] Error 1

And this is the offending code:

time:
  - platform: homeassistant
    id: homeassistant_time
    on_time:
      - seconds: 0
        minutes: '*'
        then:
          - lambda: |-
              auto time_text = id(homeassistant_time).now().strftime("%I:%M%p");
              id(disp1).set_component_text("time", time_text.c_str());

Any suggestions?

I have tried cleaning the old build files but no success.

Any progress with this? This is my first time with the Sonoff NS Panel, so I hope I can test it soon…

Did you manage to fix this? I have the same issue, can compile and install, but I get the same errors as you

Same problem. Nextion component is still out of date and I don’t know of an alternative.