Skip to main content

Wifi Configuration

When you have uploaded your code, and the device starts up for the first time, it will spit out a bunch of messages saying it can't find a saved wifi network. Let's fix that!

.....
*wm:Connect Wifi, ATTEMPT # 2 of 6
*wm:No wifi saved, skipping 
*wm:Connect Wifi, ATTEMPT # 3 of 6
*wm:No wifi saved, skipping 
*wm:Connect Wifi, ATTEMPT # 4 of 6
*wm:No wifi saved, skipping 
*wm:Connect Wifi, ATTEMPT # 5 of 6
*wm:No wifi saved, skipping 
*wm:Connect Wifi, ATTEMPT # 6 of 6
*wm:No wifi saved, skipping 
*wm:AutoConnect: FAILED for  6004 ms
*wm:StartAP with SSID:  ESP_F6129C
*wm:AP IP address: 192.168.4.1
*wm:[ERROR] country code not found 
*wm:Starting Web Portal 

For your MicroIndicator to download the latest data, it needs to connect to the internet through your wifi. To give it the wifi password, connect the hotspot it just created.

In the above case, it's called ESP_F6129C, and it'll open a captive portal when you connect:

image.png

If it dosen't automatically pop-up for you, just go to http://192.168.4.1/ in any web browser.

If you connect sucessfully, press Configure Wifi:

yes.png

Then, you can click your Wifi network in the scan results, enter your Wifi Password, and save.

2023-04-13_22-49.png

If your wifi network dosen't show in the scan results, it might not be supported by the NodeMCU, please ensure the wifi network has 2.4Ghz support, and your NodeMCU is close enough to the router.

Once saved, hopefully it will connect!

...
wm:2 networks found
*wm:Connect Wifi, ATTEMPT # 1 of 6
*wm:Connecting to NEW AP: What
*wm:connectTimeout not set, ESP waitForConnectResult... 
*wm:Connect to new AP [SUCCESS] 
*wm:Got IP Address: 
*wm:192.168.130.9 
*wm:config portal exiting 
Wifi Setup Complete

If it can connect back to the DirtyWatts Server, it'll start spiting out stats about the powergrid:

####################

Got power stations:
Battery generation: 0.00
Co-gen generation: 118.00
Coal generation: 102.00
Gas generation: 209.00
Geothermal generation: 796.00
Hydro generation: 2702.00
Diesel generation: 0.00
Wind generation: 378.00

Calculations:
Percent renewable: 0.90
Color: 174, 74, 0
Power socket: 0

####################

If it dosen't and instead fails to connect to the server, it could be beacuse of many reasons. It might be due to an captive portal on the wifi blocking acess, in which case you will need to find a diffrent wifi network, or it could be that the Dirtywatts API is offline for everyone!