EspHoMaTriXv2 icon indicating copy to clipboard operation
EspHoMaTriXv2 copied to clipboard

[ESPHome 2025.7] Issues with the new ESPHome version

Open skgsergio opened this issue 5 months ago • 14 comments

Hi, is me and is that time of the month... it works but we have several deprecation errors.

This time some of the issues are just matter of changing the device yaml others need to be taken care but.

Error: 'register_service' was not declared in this scope

Easy fix, ESPHome made a change in https://github.com/esphome/esphome/pull/9451 to conditionally compile API user services so some flash can be saved on devices that doesn't need it.

For YAML services, ESPHome automatically loads it, but for components using CustomAPIDevice in code, you need to enable it in YAML explicitly:

api:
  custom_services: true
Error log
src/esphome/components/ehmtxv2/EHMTX.cpp: In member function 'virtual void esphome::EHMTX::setup()':
src/esphome/components/ehmtxv2/EHMTX.cpp:1016:5: error: 'register_service' was not declared in this scope
1016 |     register_service(&EHMTX::get_status, "get_status");

Warning: legacy adc driver is deprecated

This one is on ESPHome, will be fixed by https://github.com/esphome/esphome/pull/9021

Tested by using the PR as custom component, but users can wait for it to get into a version, is just a warning and works.

external_components:
  - source: github://pr#9021
    components: adc
Error log
In file included from src/esphome/components/adc/adc_sensor.h:9,
                 from src/esphome/components/adc/adc_sensor_common.cpp:1:
/data/cache/platformio/packages/framework-arduinoespressif32-libs/esp32/include/esp_adc/deprecated/include/esp_adc_cal.h:17:2: warning: #warning "legacy adc calibration driver is deprecated, please migrate to use esp_adc/adc_cali.h and esp_adc/adc_cali_scheme.h" [-Wcpp]
   17 | #warning "legacy adc calibration driver is deprecated, please migrate to use esp_adc/adc_cali.h and esp_adc/adc_cali_scheme.h"
      |  ^~~~~~~
In file included from src/esphome/components/adc/adc_sensor.h:10:
/data/cache/platformio/packages/framework-arduinoespressif32-libs/esp32/include/driver/deprecated/driver/adc.h:19:2: warning: #warning "legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively" [-Wcpp]
   19 | #warning "legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively"
      |  ^~~~~~~
In file included from src/esphome/components/adc/adc_sensor.h:9,
                 from src/esphome/components/adc/adc_sensor_esp32.cpp:3:
/data/cache/platformio/packages/framework-arduinoespressif32-libs/esp32/include/esp_adc/deprecated/include/esp_adc_cal.h:17:2: warning: #warning "legacy adc calibration driver is deprecated, please migrate to use esp_adc/adc_cali.h and esp_adc/adc_cali_scheme.h" [-Wcpp]
   17 | #warning "legacy adc calibration driver is deprecated, please migrate to use esp_adc/adc_cali.h and esp_adc/adc_cali_scheme.h"
      |  ^~~~~~~
In file included from src/esphome/components/adc/adc_sensor.h:10:
/data/cache/platformio/packages/framework-arduinoespressif32-libs/esp32/include/driver/deprecated/driver/adc.h:19:2: warning: #warning "legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively" [-Wcpp]
   19 | #warning "legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively"
      |  ^~~~~~~

Warning: The legacy RMT driver is deprecated

It works but I guess at some point it will stop working and also the warning in the compile log is ugly.

In this case is just a matter of stop using neopixelbus and use esp32_rmt_led_strip. I had it running for a while now and looks is working right.

This are the required changes in the light entry:

  • change platform neopixelbus to esp32_rmt_led_strip
  • change type key to rgb_order
  • change variant key to chipset
light:
  - platform: esp32_rmt_led_strip
    id: ehmtx_light
    rgb_order: GRB
    internal: true
    chipset: WS2812
    pin: $matrix_pin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    gamma_correct: 2.0
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF
Error log
In file included from .piolibdeps/pixel-clock/NeoPixelBus/src/internal/methods/NeoEsp32RmtMethod.h:49,
                 from .piolibdeps/pixel-clock/NeoPixelBus/src/internal/NeoMethods.h:59,
                 from .piolibdeps/pixel-clock/NeoPixelBus/src/NeoPixelBus.h:43,
                 from src/esphome/components/neopixelbus/neopixelbus_light.h:12,
                 from src/esphome.h:66,
                 from src/esphome/components/ehmtxv2/EHMTX.cpp:11:
/data/cache/platformio/packages/framework-arduinoespressif32-libs/esp32/include/driver/deprecated/driver/rmt.h:18:2: warning: #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h" [-Wcpp]
   18 | #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h"
      |  ^~~~~~~
In file included from .piolibdeps/pixel-clock/NeoPixelBus/src/internal/methods/NeoEsp32RmtMethod.h:49,
                 from .piolibdeps/pixel-clock/NeoPixelBus/src/internal/NeoMethods.h:59,
                 from .piolibdeps/pixel-clock/NeoPixelBus/src/NeoPixelBus.h:43,
                 from src/esphome/components/neopixelbus/neopixelbus_light.h:12,
                 from src/esphome.h:66,
                 from src/esphome/components/ehmtxv2/EHMTX_icons.cpp:1:
/data/cache/platformio/packages/framework-arduinoespressif32-libs/esp32/include/driver/deprecated/driver/rmt.h:18:2: warning: #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h" [-Wcpp]
   18 | #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h"
      |  ^~~~~~~

Warning: JSON_ARRAY_SIZE is deprecated and '...::StaticJsonDocument' is deprecated: use JsonDocument instead

This one is on EspHoMaTriXv2, it works but I guess at some point it will stop working and also the warning in the compile log is ugly. It requires some changes in the code that look small, I might give it a try if I have some time in the following days.

Error log
src/esphome/components/ehmtxv2/EHMTX.cpp:590:13: warning: JSON_ARRAY_SIZE is deprecated, you don't need to compute the size anymore
  590 |     const size_t CAPACITY = JSON_ARRAY_SIZE(256);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                      
src/esphome/components/ehmtxv2/EHMTX.cpp:664:13: warning: JSON_ARRAY_SIZE is deprecated, you don't need to compute the size anymore
  664 |     const size_t CAPACITY = JSON_ARRAY_SIZE(64);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                       
src/esphome/components/ehmtxv2/EHMTX.cpp:725:13: warning: JSON_ARRAY_SIZE is deprecated, you don't need to compute the size anymore
  725 |     const size_t CAPACITY = JSON_ARRAY_SIZE(64);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                       
src/esphome/components/ehmtxv2/EHMTX.cpp:927:13: warning: JSON_ARRAY_SIZE is deprecated, you don't need to compute the size anymore
  927 |     const size_t CAPACITY = JSON_ARRAY_SIZE(8);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                        
src/esphome/components/ehmtxv2/EHMTX.cpp:2507:13: warning: JSON_ARRAY_SIZE is deprecated, you don't need to compute the size anymore
 2507 |     const size_t CAPACITY = JSON_ARRAY_SIZE(72);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                       
src/esphome/components/ehmtxv2/EHMTX.cpp: In member function 'void esphome::EHMTX::bitmap_screen(std::string, int32_t, int32_t)':
src/esphome/components/ehmtxv2/EHMTX.cpp:591:5: warning: 'template<unsigned int N> class ArduinoJson::V742PB22::StaticJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations]
  591 |     StaticJsonDocument<CAPACITY> doc;
      |     ^~~~~~~~~~~~~~~~~~
In file included from .piolibdeps/pixel-clock/ArduinoJson/src/ArduinoJson.hpp:65,
                 from .piolibdeps/pixel-clock/ArduinoJson/src/ArduinoJson.h:9,
                 from src/esphome/components/json/json_util.h:11,
                 from src/esphome/core/string_ref.h:11,
                 from src/esphome/core/entity_base.h:5,
                 from src/esphome/components/sensor/sensor.h:4,
                 from src/esphome/components/adc/adc_sensor.h:3,
                 from src/esphome.h:3,
                 from src/esphome/components/ehmtxv2/EHMTX.cpp:11:
.piolibdeps/pixel-clock/ArduinoJson/src/ArduinoJson/compatibility.hpp:63:58: note: declared here
   63 | class ARDUINOJSON_DEPRECATED("use JsonDocument instead") StaticJsonDocument
      |                                                          ^~~~~~~~~~~~~~~~~~
src/esphome/components/ehmtxv2/EHMTX.cpp: In member function 'void esphome::EHMTX::bitmap_small(std::string, std::string, int32_t, int32_t, bool, int32_t, int32_t, int32_t)':
src/esphome/components/ehmtxv2/EHMTX.cpp:665:5: warning: 'template<unsigned int N> class ArduinoJson::V742PB22::StaticJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations]
  665 |     StaticJsonDocument<CAPACITY> doc;
      |     ^~~~~~~~~~~~~~~~~~
.piolibdeps/pixel-clock/ArduinoJson/src/ArduinoJson/compatibility.hpp:63:58: note: declared here
   63 | class ARDUINOJSON_DEPRECATED("use JsonDocument instead") StaticJsonDocument
      |                                                          ^~~~~~~~~~~~~~~~~~
src/esphome/components/ehmtxv2/EHMTX.cpp: In member function 'void esphome::EHMTX::rainbow_bitmap_small(std::string, std::string, int32_t, int32_t, bool)':
src/esphome/components/ehmtxv2/EHMTX.cpp:726:5: warning: 'template<unsigned int N> class ArduinoJson::V742PB22::StaticJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations]
  726 |     StaticJsonDocument<CAPACITY> doc;
      |     ^~~~~~~~~~~~~~~~~~
.piolibdeps/pixel-clock/ArduinoJson/src/ArduinoJson/compatibility.hpp:63:58: note: declared here
   63 | class ARDUINOJSON_DEPRECATED("use JsonDocument instead") StaticJsonDocument
      |                                                          ^~~~~~~~~~~~~~~~~~
src/esphome/components/ehmtxv2/EHMTX.cpp: In member function 'void esphome::EHMTX::color_gauge(std::string)':
src/esphome/components/ehmtxv2/EHMTX.cpp:928:5: warning: 'template<unsigned int N> class ArduinoJson::V742PB22::StaticJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations]
  928 |     StaticJsonDocument<CAPACITY> doc;
      |     ^~~~~~~~~~~~~~~~~~
.piolibdeps/pixel-clock/ArduinoJson/src/ArduinoJson/compatibility.hpp:63:58: note: declared here
   63 | class ARDUINOJSON_DEPRECATED("use JsonDocument instead") StaticJsonDocument
      |                                                          ^~~~~~~~~~~~~~~~~~
src/esphome/components/ehmtxv2/EHMTX.cpp: In member function 'void esphome::EHMTX::icon_prognosis_screen_rgb(std::string, std::string, std::string, int32_t, int32_t, bool, int32_t, int32_t, int32_t)':
src/esphome/components/ehmtxv2/EHMTX.cpp:2508:5: warning: 'template<unsigned int N> class ArduinoJson::V742PB22::StaticJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations]
 2508 |     StaticJsonDocument<CAPACITY> doc;
      |     ^~~~~~~~~~~~~~~~~~
.piolibdeps/pixel-clock/ArduinoJson/src/ArduinoJson/compatibility.hpp:63:58: note: declared here
   63 | class ARDUINOJSON_DEPRECATED("use JsonDocument instead") StaticJsonDocument
      |                                                          ^~~~~~~~~~~~~~~~~~

skgsergio avatar Jul 17 '25 16:07 skgsergio

Same here but even worse.

    |                                                          ^~~~~~~~~~~~~~~~~~
src/esphome/components/ehmtxv2/EHMTX.cpp: In member function 'virtual void esphome::EHMTX::setup()':
**src/esphome/components/ehmtxv2/EHMTX.cpp:1016:5: error: 'register_service' was not declared in this scope**
1016 |     register_service(&EHMTX::get_status, "get_status");

On Sunday i will take a look. The Update to 2025.7.1 of esphome din't change anything :-(

lubeda avatar Jul 17 '25 17:07 lubeda

Same here but even worse.

    |                                                          ^~~~~~~~~~~~~~~~~~
src/esphome/components/ehmtxv2/EHMTX.cpp: In member function 'virtual void esphome::EHMTX::setup()':
**src/esphome/components/ehmtxv2/EHMTX.cpp:1016:5: error: 'register_service' was not declared in this scope**
1016 |     register_service(&EHMTX::get_status, "get_status");

On Sunday i will take a look. The Update to 2025.7.1 of esphome din't change anything :-(

Oh yes I forgot about this one, I'll edit the OP but as easy as adding:

api:
  custom_services: true

skgsergio avatar Jul 17 '25 17:07 skgsergio

Error: 'register_service' was not declared in this scope

api:
  custom_services: true

andrewjswan avatar Jul 17 '25 19:07 andrewjswan

I have this strange error... But I don't understand where it comes from...

/data/cache/platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /data/cache/platformio/packages/framework-arduinoespressif32-libs/esp32/lib/liblwip.a(magic.c.obj): in function `magic':
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/netif/ppp/magic.c:263: multiple definition of `magic'; .pioenvs/hall-pixel-clock/src/main.cpp.o:/data/.build/esp_hall_pixel_clock/src/main.cpp:108: first defined here
/data/cache/platformio/packages/framework-arduinoespressif32-libs/esp32/lib/liblwip.a(lcp.c.obj): in function `lcp_resetci':
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/netif/ppp/lcp.c:746:(.text.lcp_resetci+0x24): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: magic
/data/cache/platformio/packages/framework-arduinoespressif32-libs/esp32/lib/liblwip.a(lcp.c.obj): in function `lcp_reqci':
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/netif/ppp/lcp.c:2155:(.text.lcp_reqci+0x13a): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: magic
/data/cache/platformio/packages/framework-arduinoespressif32-libs/esp32/lib/liblwip.a(lcp.c.obj): in function `lcp_nakci':
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/netif/ppp/lcp.c:1419:(.text.lcp_nakci+0x1e7): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: magic
collect2: error: ld returned 1 exit status
*** [.pioenvs/hall-pixel-clock/firmware.elf] Error 1

andrewjswan avatar Jul 17 '25 19:07 andrewjswan

It's funny, that's the reason...

    - id: magic
      lameid: 4788

main.cpp

esphome::EHMTX_Icon *magic;

andrewjswan avatar Jul 17 '25 20:07 andrewjswan

https://github.com/lubeda/EspHoMaTriXv2/pull/307

andrewjswan avatar Jul 17 '25 20:07 andrewjswan

https://github.com/esphome/esphome/pull/7770

andrewjswan avatar Jul 18 '25 11:07 andrewjswan

esphome/esphome#7770

This doesn't fix NeoPixelBus warnings, which is an external component. Details here: https://github.com/lubeda/EspHoMaTriXv2/pull/307#issuecomment-3089139631

skgsergio avatar Jul 18 '25 11:07 skgsergio

This doesn't fix NeoPixelBus warnings, which is an external component.

I think we should open an Issue

andrewjswan avatar Jul 18 '25 11:07 andrewjswan

Error: 'register_service' was not declared in this scope

api: custom_services: true

I'm using ESPHome 2025.7.3. I fixed the compilation error with the additional line for the api: statement.

But now the device can't connect to HA. It tries to connect multiple times while showing the load animation.

Device log via serial connection:

[17:31:04][D][api:146]: Accept 192.168.178.30
[17:31:04][W][component:307]: api cleared Warning flag
[17:31:04][D][api.connection:1466]: Home Assistant 2025.7.3 (192.168.178.30) connected
[17:31:04][W][component:279]: api set Warning flag: unspecified
[17:32:04][D][api:146]: Accept 192.168.178.30
[17:32:04][W][component:307]: api cleared Warning flag
[17:32:04][D][api.connection:1466]: Home Assistant 2025.7.3 (192.168.178.30) connected
[17:32:04][W][component:279]: api set Warning flag: unspecified

Protocol from Home Assistant:

Logger: aioesphomeapi.reconnect_logic
Quelle: runner.py:154

Can't connect to ESPHome API for maximatrix @ 192.168.178.98: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.178.98', port=6053))]: [Errno 113] Connect call failed ('192.168.178.98', 6053) (SocketAPIError)
Can't connect to ESPHome API for maximatrix @ 192.168.178.98: Error while starting connection: Starting connection cancelled (APIConnectionCancelledError)
Can't connect to ESPHome API for maximatrix @ 192.168.178.98: maximatrix-gfx @ 192.168.178.98: EOF received (SocketClosedAPIError)
Can't connect to ESPHome API for maximatrix @ 192.168.178.98: maximatrix @ 192.168.178.98: EOF received (SocketClosedAPIError)

Any idea other than downgrading ESPHome? Thank you very much.

ramdacxp avatar Jul 27 '25 15:07 ramdacxp

Do you use an encryption key?

i only use this, and it works with 2025.7.3

api:
  custom_services: true

lubeda avatar Jul 27 '25 17:07 lubeda

I use encryption key, and it works with 2025.7.3.

andrewjswan avatar Jul 28 '25 08:07 andrewjswan

But now the device can't connect to HA. It tries to connect multiple times while showing the load animation.

Try delete device from HA and add ...

andrewjswan avatar Jul 28 '25 08:07 andrewjswan

Thank you for the hints.

I think I had an out of memory issue. After adding the encryption key, OTA was no longer possible (due to missing free RAM). Switching the board to an ESP32-WROOM 32 helped. It now works fine with 2025.7.3.

So ESPHome 2025.7.4 is out today. Let's see.. ;)

ramdacxp avatar Jul 28 '25 19:07 ramdacxp