[GH-ISSUE #1303] wm:[0] [ERROR] wifi config failed ,When i try to set the subnet mask to 255.255.255.240 #1119

Closed
opened 2026-02-28 01:28:36 +03:00 by kerem · 2 comments
Owner

Originally created by @EgHubs on GitHub (Oct 22, 2021).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1303

Basic Infos

Hardware

WiFimanager Branch/Release: 2.0.4 beta

Hardware: ESP-12e

Core Version: 3.0.2

Description

I get

*wm:[2] Custom STA IP/GW/Subnet
*wm:[0] [ERROR] wifi config failed

when I try to specify the subnet mask with 3 digits at the end with a link like the following

http://192.168.4.1/wifisave?s=xxxxxx&p=xxxxxx&ip=172.20.10.202&gw=172.20.10.1&sn=255.255.255.240&email=xxxxx&pass=xxxxx&alarm=xxxxx

i,e. 255.255.255.240 --> from an iPhone.
otherwise, I tried to make it last with two digits or two digits and it is set successfully
i,e. 255.255.255.20 or 255.255.255.0

http://192.168.4.1/wifisave?s=xxxxxx&p=xxxxxx&ip=172.20.10.202&gw=172.20.10.1&sn=255.255.255.0&email=xxxxx&pass=xxxxx&alarm=xxxxx

*wm:[2] Custom STA IP/GW/Subnet
*wm:[1] STA IP set: 172.20.10.202

--

and what made me say three digits is when I tried to set it to 255.255.255.200 I also get the same error
and eventually the JSON settings for a nonworking subnet mask indicates (Unset) for all three parameters of the ips:(ip, gw,sn)

Originally created by @EgHubs on GitHub (Oct 22, 2021). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1303 ### Basic Infos #### Hardware WiFimanager Branch/Release: 2.0.4 beta Hardware: ESP-12e Core Version: 3.0.2 ### Description I get > *wm:[2] Custom STA IP/GW/Subnet > *wm:[0] [ERROR] wifi config failed when I try to specify the subnet mask with 3 digits at the end with a link like the following > http://192.168.4.1/wifisave?s=xxxxxx&p=xxxxxx&ip=172.20.10.202&gw=172.20.10.1&sn=255.255.255.240&email=xxxxx&pass=xxxxx&alarm=xxxxx i,e. 255.255.255.240 --> from an iPhone. otherwise, I tried to make it last with two digits or two digits and it is set successfully i,e. 255.255.255.20 or 255.255.255.0 > http://192.168.4.1/wifisave?s=xxxxxx&p=xxxxxx&ip=172.20.10.202&gw=172.20.10.1&sn=255.255.255.0&email=xxxxx&pass=xxxxx&alarm=xxxxx > *wm:[2] Custom STA IP/GW/Subnet > *wm:[1] STA IP set: 172.20.10.202 -- and what made me say three digits is when I tried to set it to 255.255.255.200 I also get the same error and eventually the JSON settings for a nonworking subnet mask indicates (Unset) for all three parameters of the ips:(ip, gw,sn)
kerem closed this issue 2026-02-28 01:28:36 +03:00
Author
Owner

@EgHubs commented on GitHub (Oct 22, 2021):

will I've made a workaround,
I set up the ESP without assigning any IPs
but instead, I added a new parameter to the system
for example

http://192.168.4.1/wifisave?s=&p=&email=&pass=&alarm=*****&staip=202

so that "staip" parameter, I will consider it my new local IP
I let the system get its IPs automatically then I save that automatically assigned three IPs then every time I connect to the wifi I assign a new local IP to the system

//first at saving i save what was automaticcally assinged.
 json["ip"] =  WiFi.localIP().toString();
 json["gateway"] = WiFi.gatewayIP().toString();
 json["subnet"] = WiFi.subnetMask().toString();
 json["sta_ip"] = static_ip_gotten;

  //then at normal boot i get these parameters then 
  if (!wifiManager.autoConnect(ssidMID, ssidPass)) {}
  choosen=WiFi.localIP().toString().substring(0,WiFi.localIP().toString().lastIndexOf('.')+1)+String(static_ip_gotten);
  choosen.toCharArray(static_ip, 17);
       IPAddress _ip, _gw, _sn;
       _ip.fromString(static_ip);
       _gw.fromString(static_gw);
       _sn.fromString(static_sn);
       WiFi.config(_ip, _gw, _sn);

BUT, I think that there is still a problem here with the library, I hope you can figure out what's wrong, thanks anyway.

<!-- gh-comment-id:950000078 --> @EgHubs commented on GitHub (Oct 22, 2021): will I've made a workaround, I set up the ESP without assigning any IPs but instead, I added a new parameter to the system for example > http://192.168.4.1/wifisave?s=*****&p=*****&email=*****&pass=*****&alarm=*****&staip=202 so that "staip" parameter, I will consider it my new local IP I let the system get its IPs automatically then I save that automatically assigned three IPs then every time I connect to the wifi I assign a new local IP to the system ``` //first at saving i save what was automaticcally assinged. json["ip"] = WiFi.localIP().toString(); json["gateway"] = WiFi.gatewayIP().toString(); json["subnet"] = WiFi.subnetMask().toString(); json["sta_ip"] = static_ip_gotten; //then at normal boot i get these parameters then if (!wifiManager.autoConnect(ssidMID, ssidPass)) {} choosen=WiFi.localIP().toString().substring(0,WiFi.localIP().toString().lastIndexOf('.')+1)+String(static_ip_gotten); choosen.toCharArray(static_ip, 17); IPAddress _ip, _gw, _sn; _ip.fromString(static_ip); _gw.fromString(static_gw); _sn.fromString(static_sn); WiFi.config(_ip, _gw, _sn); ``` BUT, I think that there is still a problem here with the library, I hope you can figure out what's wrong, thanks anyway.
Author
Owner

@EgHubs commented on GitHub (Oct 22, 2021):

My fault, sorry I didn't know that the relationship between the subnet mask and the IP addresses, now I get it thanks to this video :)

<!-- gh-comment-id:950013024 --> @EgHubs commented on GitHub (Oct 22, 2021): My fault, sorry I didn't know that the relationship between the subnet mask and the IP addresses, now I get it thanks to this [video](https://www.youtube.com/watch?v=pCcJFdYNamc) :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1119
No description provided.