muxa / esphome-wled-output

Control external WLED from ESPHome
5 stars 1 forks source link

error: invalid cast from type 'esphome::network::IPAddress' to type 'uint32_t' {aka 'unsigned int'} #2

Open robbse81 opened 8 months ago

robbse81 commented 8 months ago

Issue Description: I am experiencing difficulty updating my working configuration due to the error described below.

Error Message: error: invalid cast from type 'esphome::network::IPAddress' to type 'uint32_t' {aka 'unsigned int'})

Related Issues: I found similar issues at:

Environment Information: ESPhome Version: 2023.12.5 Platform/Operating System: Home Assistant

Configuration Files:

light:
  - platform: wled_output
    id: starlights
    address: 192.168.178.134
    num_leds: 100
    default_transition_length: 0ms
    effects:
    - automation:
        name: udp
        sequence:
          - light.control:
              id: starlights
              brightness: 100%             
              red: !lambda |-
                return id(strip).remote_values.get_red();
              green: !lambda |-
                return id(strip).remote_values.get_green();
              blue: !lambda |-
                return id(strip).remote_values.get_blue(); 
          - delay: 100ms

Logs:

INFO ESPHome 2023.12.5
INFO Reading configuration /config/esphome/tonie-wheel.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing tonie-wheel (board: d1_mini; framework: arduino; platform: platformio/espressif8266@3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|-- Wire @ 1.0
|-- NeoPixelBus @ 2.7.3
Compiling .pioenvs/tonie-wheel/src/esphome/components/wled_output/light/wled_light_output.cpp.o
Compiling .pioenvs/tonie-wheel/src/main.cpp.o
In file included from src/esphome/components/wled_output/light/wled_light_output.cpp:3:
src/esphome/components/wled_output/light/wled_light_output.h: In member function 'void esphome::wled::WLEDLightOutput::set_address(esphome::network::IPAddress)':
src/esphome/components/wled_output/light/wled_light_output.h:62:77: error: invalid cast from type 'esphome::network::IPAddress' to type 'uint32_t' {aka 'unsigned int'}
   62 |   void set_address(network::IPAddress address) { this->address_ = IPAddress((uint32_t)address); }
      |                                                                             ^~~~~~~~~~~~~~~~~
*** [.pioenvs/tonie-wheel/src/esphome/components/wled_output/light/wled_light_output.cpp.o] Error 1
In file included from src/esphome.h:71,
                 from src/main.cpp:3:
src/esphome/components/wled_output/light/wled_light_output.h: In member function 'void esphome::wled::WLEDLightOutput::set_address(esphome::network::IPAddress)':
src/esphome/components/wled_output/light/wled_light_output.h:62:77: error: invalid cast from type 'esphome::network::IPAddress' to type 'uint32_t' {aka 'unsigned int'}
   62 |   void set_address(network::IPAddress address) { this->address_ = IPAddress((uint32_t)address); }
      |                                                                             ^~~~~~~~~~~~~~~~~
*** [.pioenvs/tonie-wheel/src/main.cpp.o] Error 1
========================== [FAILED] Took 2.52 seconds ==========================

Attach any relevant logs or error messages here

Any advice is welcome.

fabio-garavini commented 7 months ago

Fixed You can check it out here https://github.com/fabio-garavini/esphome-wled-output

robbse81 commented 7 months ago

Hi @fabio-garavini,

thanks for looking into this. I cleaned the build files and replaced the external component with yours. Now the compiling errors are as follows:

In file included from src/esphome/components/wled_output/light/wled_light_output.cpp:3:
src/esphome/components/wled_output/light/wled_light_output.h: In member function 'void esphome::wled::WLEDLightOutput::set_address(esphome::network::IPAddress)':
src/esphome/components/wled_output/light/wled_light_output.h:62:67: error: ambiguous overload for 'operator=' (operand types are 'IPAddress' and 'esphome::network::IPAddress')
   62 |   void set_address(network::IPAddress address) { this->address_ = address; }
      |                                                                   ^~~~~~~
In file included from src/esphome/components/network/ip_address.h:14,
                 from src/esphome/components/wled_output/light/wled_light_output.h:6,
                 from src/esphome/components/wled_output/light/wled_light_output.cpp:3:
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/IPAddress.h:130:20: note: candidate: 'constexpr IPAddress& IPAddress::operator=(const IPAddress&)'
  130 |         IPAddress& operator=(const IPAddress&) = default;
      |                    ^~~~~~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/IPAddress.h:158:20: note: candidate: 'IPAddress& IPAddress::operator=(const ip4_addr&)'
  158 |         IPAddress& operator=(const ipv4_addr& fw_addr)   { setV4(); v4() = fw_addr.addr;  return *this; }
      |                    ^~~~~~~~
*** [.pioenvs/tonie-wheel/src/esphome/components/wled_output/light/wled_light_output.cpp.o] Error 1