ZXInterfaceZ icon indicating copy to clipboard operation
ZXInterfaceZ copied to clipboard

/req/wifi doesn't report assigned DHCP IP

Open rickard-von-essen opened this issue 4 years ago • 6 comments
trafficstars

Currenlty the API /req/wifi returns

{
  "mode" : "ap", 
  "sta": {
   	"ssid": "ssid",
        "hostname": "interfacez", 
        "ip": "dhcp", 
        "netmask": "255.255.255.0", 
        "gw": "127.0.0.1", 
  },
  "ap" : {
   	"ssid": "ssid",
        "hostname": "interfacez",
        "channel": 1,
        "ip" : "127.0.0.1",
        "netmask" : "255.255.255.0",
        "gw" : "127.0.0.1"
  }
}

Where ip: dhcp but I think it would be better to add "dhcp": true, "ip": "<currently leased IP>".

rickard-von-essen avatar Nov 28 '20 21:11 rickard-von-essen

Definitely, it should return the IP address in there. I'll change it as per your proposal

alvieboy avatar Nov 29 '20 08:11 alvieboy

Ok now I undestand why it looks like this. This relates to the WiFi configuration, not to the WiFi status. For status, I propose adding a new node which would the current IP configuration. Looks OK for you?

alvieboy avatar Nov 30 '20 19:11 alvieboy

That's fine. I could also include the MAC etc. Also there is no way of setting the config from the API either.

rickard-von-essen avatar Dec 02 '20 15:12 rickard-von-essen

How do you prefer to handle the sets for WiFI? JSON or POST parameters?

alvieboy avatar Dec 22 '20 15:12 alvieboy

POST with json body.

On Tue, Dec 22, 2020, 16:59 Álvaro Lopes [email protected] wrote:

How do you prefer to handle the sets for WiFI? JSON or POST parameters?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alvieboy/ZXInterfaceZ/issues/56#issuecomment-749617525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEIFA5SIWRAXPOMOJAAG6DSWC66VANCNFSM4UGBSKNA .

rickard-von-essen avatar Dec 22 '20 16:12 rickard-von-essen

For "scan" operations, via /req/scan, the operation will return "success":"false", and error field will not be present while the scan is in progress. You can use the scan results to configure WiFi after you retrieve the SSID from the scan.

Does this make sense for the JSON part:

WiFi Disabled: "mode": "disabled"

WiFi as access point (dhcp server implicit): "mode": "ap", "ip": "x.x.x.x", "netmask": "x.x.x.x", "ssid": "theapssid", "password": "theappassword". "channel": "8"

WiFi station (dhcp): "mode": "sta", "inet": "dhcp", "ssid": "theapssid", "password": "theappassword_or_empty"

WiFi station (static IP): "mode": "sta", "inet": "static", "ip": "x.x.x.x", "netmask": "x.x.x.x", "gw": "x.x.x.x", "ssid": "theapssid", "password": "theappassword_or_empty"

alvieboy avatar Dec 22 '20 18:12 alvieboy