Serial protocol limitations

According to Serial - WLED Project the JSON API is available over serial via GPIO1 and GPIO3.

This works well but it seems that it is limited to only the State object.

Is it possible to access the cfg object via serial to directly access configuration settings?

I had another question where I thought that I was sending over serial but was in fact POSTing the JSON string: Set Ethernet IP address via API

If one could send the following over serial to set up newly flashed units then that would be amazing!

{"nw":{"ins":[{"ip":[192,168,88,123],"gw":[192,168,88,1],"sn":[255,255,255,0]}]}}

It would be the same as posting to /json/cfg but because I am usually in environments without wifi then this becomes tedious:

curl -X POST http://192.168.88.123/json/cfg -H "Content-Type: application/json" -d '{"nw":{"ins":[{"ip":[192,168,88,111],"gw":[192,168,88,1],"sn":[255,255,255,0]}]}}'

If the only option is to modify the binary then I am prepared to do that.

I am able to build both v0.14 and v0.15 locally from source. If anyone can tell me what to change in the code to allow the Serial API to access the cfg.json configuration then that would help me immensely.

Unfortunately i could not find any good examples of using serial , i know it is used by the installer site if you want to dig in that , Might be a workaround ( it might be easier then you think if it works even ) . Is to setup the network as you like then export the cfg.json and even edit that if you like . Keep your unit AP always open and from your phone just upload the modified cfg.json , i have used the upload of cfg.json but from PC to change the config on multiple devices via a script but i think could work in your case , if enabling AP mode does not impact your setup . Else keep trying but as said i could not find even a single example on using json over serial

Thank you @ALDIY but, for my use case, network, whether wireless or wired is not an option at all for this project.

AP mode is not possible ?That is a restriction you imposed or why to just understand

Yes, this is a local art exhibition. The venue has stated no wifi allowed at all. But, beside that, the project requires that the units are randomised and interchangeable. Let me explain:

We have many “blocks” that can be placed at many places on big frames. Each of these blocks contains an ESP32 running WLED and some LED strips.

When a block is placed in one of many sockets then it has to behave according to some preconfigured rules. The easiest way to keep all the effects in sync are via ethernet.

So a visitor will pick up various blocks and put them randomly in various sockets. Each unit has predefined preset already loaded. They just need to be triggered in a specific order depending on their position.

The WLED therefore will power up and be assigned a specific IP depending on its position. Then the master controller tells which preset to recall via the LAN.

In order for this to work then I need to assign an IP address as soon as it powers up. Using serial is the best option: it connects, is assigned the correct IP then the lighting effect syncs up with everything else.

Everything is working perfectly apart from the network IP assignment. If I can access the configuration via anything except network then I am happy.

1 Like