Blackymas / NSPanel_HA_Blueprint

This allows you to configure your complete NSPanel via Blueprint with UI and without changing anything in the code
1.36k stars 253 forks source link

Unable to load your ESP yaml #101

Closed adrianGOO closed 1 year ago

adrianGOO commented 1 year ago

Hello,

I have a problem loading ESP code on my NSPanel

Currently my NSPanel is flashed successfully with tft file according to Mark Watt Tech manual but when I replace ESP config code with the one you posted my ESP will stay offline and show error when trying to install your codes. When I load back my old ESP yaml the NSPanel will come online again and work with my custom hmi and esp yaml. For your information this is my first week using NSPanel and ESP.

My secrets.yaml

# Your Wi-Fi SSID and password
wifi_ssid: "Wifi_2.4Ghz"
wifi_password: "somepassword"
tft_upload_url: "http://192.168.1.176:8123/local/hmi.tft"

ESP yaml

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

substitutions:

###### CHANGE ME ######

  device_name: "sonoff-nspanel" 
  wifi_ssid: !secret wifi_ssid
  wifi_password: !secret wifi_password

##### CHANGE ME #####

##### DO NOT CHANGE ANYTHING! #####

  nextion_update_url: "https://raw.githubusercontent.com/Blackymas/NSPanel_HA_Blueprint/main/nspanel.tft"
packages:
  ##### download esphome code from Github
  remote_package:
    url: https://github.com/Blackymas/NSPanel_HA_Blueprint
    ref: main
    files: [nspanel_esphome.yaml]
    refresh: 300s

##### DO NOT CHANGE ANYTHING! #####
##############################################################

Log

/data/cache/platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c: In function 'spiTransferBytesNL':
/data/cache/platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:922:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_out8 = &result[c_longs-1];
                                       ^
/data/cache/platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:923:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_data8 = &last_data;
                                        ^
Compiling /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/FrameworkArduino/esp32-hal-timer.c.o
Compiling /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/FrameworkArduino/esp32-hal-touch.c.o
Compiling /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/FrameworkArduino/esp32-hal-uart.c.o
Compiling /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/FrameworkArduino/libb64/cdecode.c.o
Compiling /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/FrameworkArduino/libb64/cencode.c.o
Compiling /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/FrameworkArduino/main.cpp.o
Compiling /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/FrameworkArduino/stdlib_noniso.c.o
Compiling /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/FrameworkArduino/wiring_pulse.c.o
Compiling /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/FrameworkArduino/wiring_shift.c.o
Archiving /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/libFrameworkArduino.a
Linking /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/firmware.elf
RAM:   [=         ]  13.2% (used 43224 bytes from 327680 bytes)
Flash: [=======   ]  69.0% (used 1265940 bytes from 1835008 bytes)
Building /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/firmware.bin
esp32_create_combined_bin(["/data/sonoff-nspanel/.pioenvs/sonoff-nspanel/firmware.bin"], ["/data/sonoff-nspanel/.pioenvs/sonoff-nspanel/firmware.elf"])
Wrote 0x145180 bytes to file /data/sonoff-nspanel/.pioenvs/sonoff-nspanel/firmware-factory.bin, ready to flash to offset 0x0
======================== [SUCCESS] Took 257.06 seconds ========================
INFO Successfully compiled program.
INFO Resolving IP address of sonoff-nspanel.local
ERROR Error resolving IP address of sonoff-nspanel.local. Is it connected to WiFi?
ERROR (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
ERROR Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname
Blackymas commented 1 year ago

hi - is it the first flash on the nspanel or did you have lovelace ui version on the nspanel before?

adrianGOO commented 1 year ago

hi - is it the first flash on the nspanel or did you have lovelace ui version on the nspanel before?

No I never used lovelace ui, I always use esp only to run HA scripts and button switches. The hmi I was using until now is hmi based on NSPanel YAML by marcfager.

Blackymas commented 1 year ago

the problem difficult to admit for me.

If you are using my ESPhome version - do you try to install the ESPhome version via OTA (wireless) or do you flash it via cable?

adrianGOO commented 1 year ago

the problem difficult to admit for me.

If you are using my ESPhome version - do you try to install the ESPhome version via OTA (wireless) or do you flash it via cable?

I tried both versions, wireless and cable but still same.

I think there is a mistake in flashing steps.

Do I need to load your hmi and then load your yaml or I have to stay on initially installed hmi instructed by Mark?

Blackymas commented 1 year ago

hear is a step by step guide

https://github.com/Blackymas/NSPanel_HA_Blueprint/wiki/(EN)-First-Steps---Installation-and-Setup

adrianGOO commented 1 year ago

hear is a step by step guide

https://github.com/Blackymas/NSPanel_HA_Blueprint/wiki/(EN)-First-Steps---Installation-and-Setup

Yes I did the same steps but ESP comes offline again.

I will try something else tonight and let you know about the results

I will remove ESP home from my HA server and delete all saved files in ESP config and reinstall everything from the begining. Anyway you have done a great job with yor firmware and we really appreciate your contribution.

GuySie commented 1 year ago

I had this same issue with the nspanel never coming online while using the secrets file substitutions for wifi ssid and password, when I replaced them hardcoded into the yaml it came up. I think esphome doesn't like it when we use secrets in substitutions?

deejaybeam commented 1 year ago

ESPHome supports using !secrets in substitutions. Use this in all my ~40 esphome-files since the first project. Have you created a secrets-file inside esphome - this is another one than ha uses per default? Look at the esphome-documentation: https://esphome.io/guides/faq.html This is from my (working) config:

##### ADVANCED CONFIGURATION - activate only when you know what you do ##############################
substitutions: 
  ## usage of secrets-file ## -> comment in ###### Change ME ######
  device_name: "nspanel01" # Wird im Blueprint benötigt!
  wifi_ssid: !secret nspanel_wifi_ssid # add in your esphome secrets file.
  wifi_password: !secret nspanel_wifi_password # add in your esphome secrets file. -> per default this is also used for ota_password and web_password
  ota_password: !secret nspanel_ota_password # add in your esphome secrets file. - manual change in code required to activate
  web_password: !secret nspanel_web_password # add in your esphome secrets file. - manual change in code required to activate
  api_password: !secret nspanel_api_password # add in your esphome secrets file. - manual change in code required to activate
  nextion_update_url: !secret nspanel_update_url # add in your esphome secrets file. Example: "http://"HOME ASSISTANT IP":8123/local/nspanel/nspanel.tft"

you can have a look at the secrets-file from esphome with the button right on top in the esphom-dashboard: image

chpego commented 1 year ago

https://esphome.io/components/esphome.html#changing-esphome-node-name

Blackymas commented 1 year ago

I close the issue because no feedback