Set Ethernet IP address via API

Is it possible to set the Ethernet IP address of the WLAN ESP device via the JSON protocol?

I currently have an arduino connected to the wled via serial pins and am looking for a way to configure the ethernet post without the web interface.

If it is not possible then can I make this a feature request please?

You can change wled config with the json api ( this part i personally tested and it works )
Examples here in discord using /json/cfg

You can also per the kb send JSON over Serial ( This part i did not test )

Thanks @ALDIY - yes, I am able to change config via JSON by either POSTing or via serial - but everything EXCEPT the Ethernet port IP address. Maybe I am overlooking something but it is not obvious.

The string that I am sending is: {"nw":{"ins":[{"ip":[192,168,88,123],"sn":[255,255,255,0]}]}} and the config displayed does change but the Ethernet address remains the same.


As you can see in the image above, it does state: Also used by Ethernet:.

Any thoughts or suggestions from anyone please?

BTW @ALDIY what is the application that you are using in your video to send the command?

i was using postman application to test , unfortunately i do not own any Ethernet board to test or be helpful in that regard . You look like you are on the right track and if you face a wall might be wait for the guys or drop by discord might be some one with Ethernet could say

You need to specify a gateway even if it’s BS (as long as it’s in the correct network), if it’s it won’t validate the static IP setting and thus not use it.

1 Like

Seems logical and we give that advice on gh but he seems to be MIA , please close that if the issue is solved Unable to set static Ethernet IP address · Issue #3927 · Aircoookie/WLED · GitHub

1 Like

Thank you very much @kilrah and @ALDIY - it does indeed require a gateway address, even though I do not have nor need one, the gateway must still be set with a non-zero value.

(sorry for the short delay in replying, I was at work and this is a hobby, saying MIA is rather extreme :laughing:)

The gateway is just another name for your router so you must have one

It is a local network so I have no routes anywhere. Simply just an arduino and an ESP32:

  • arduino connected to esp32 via serial and ethernet cables
  • arduino sends json via serial to the esp32 to set the ip address
  • then the two can communicate faster and more reliably over ethernet
  • if I have to change the esp32 then I do not need to set the ip manually

I like that , as i said on gh i have ordered some eth boards to test few things like that after seeing your post . The board is a bit costly to me but why not

To clarify that’s not specific to Ethernet, same is valid when setting a static IP on WiFi. Just a quirk of how the esp network libraries operate.

Well in case there is wifi then there must be a router somewhere , what i am curious about and got the board for is testing other things specially using it with arduino

Nope, I have no wifi here at all, everything wired, and just one isolated internet connected device - very old school!

If you have any questions with arduino interfacing, then just ask - I have learnt a lot tinkering with this.

Maybe not related directly to the question but what are you communicating from ardunio and how many leds we are talking about here as i think there will be a limit with wled . When using Ethernet ( which i never did before ) I thought there is no lag and hence the extra wiring and cost

Yeah, we are going off-topic, oops! I have several hundred LEDs connected. Going to add more and a couple of additional ESP32 units too and run them all in sync from ethernet control. Shall eventually have a setup where I plug a USB drive into the arduino containing some presets and text. The arduino will automatically upload the presets to the wleds and display the text scrolling on the led 2d matrix that I am assembling. It will be for a friend’s art display, all portable and self contained. If any esp32 dies then just put another in and it will receive all the config via json from serial so any idiot can use and maintain it. It is working super fine so far.

1 Like

This sounds great!!! I also use many eth esps to reduce lag and keep things in sync for big shows.

Would love to hear more about the way you update a new esp via the json command - currently I am doing it the long manual way and with many devices and a stressful situation the chnace for mistakes is high!

Hi @potential-difference I am still investigating this and am discussing it in Serial protocol limitations - hopefully a developer will provide a reply soon as this missing link is a bit of a show stopper for me.