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 doesn't automatically pop up for you, go to http://192.168.4.1/ in any web browser.

If you connect successfully, 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 doesn't show in the scan results, your NodeMCU might not support it. Please ensure the wifi network has 2.4 GHz support and your NodeMCU is close enough to the router.

Once saved, it should 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 spitting out stats about the power grid:

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

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 doesn't and instead fails to connect to the server, it could be because of many reasons. It could be due to a captive portal on the wifi blocking access, in which case you will need to find a different wifi network or the Dirtywatts API is offline for everyone!

image.png