Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
robbse81 opened this issue Dec 28, 2023 · 2 comments

Comments

@robbse81
Copy link

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

  • Core 2023.12.3
  • Supervisor 2023.12.0
  • Operating System 11.2
  • Frontend 20231208.2

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
Copy link

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

@robbse81
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants