Can I buy a Airgradient One version 9 and it will work without Wi-Fi ?
I don’t mind not having UI with stats, I just want the readings
Do you know how to shut off the wifi ?
Can I buy a Airgradient One version 9 and it will work without Wi-Fi ?
I don’t mind not having UI with stats, I just want the readings
Do you know how to shut off the wifi ?
By default it will setup a wifi hotspot for your phone to connect to so you can configure the wifi network you want it on. If it doesn’t connect to Wifi (or maybe their dashboard) within 15 minutes, it will reboot itself and do the same process.
You could edit the code and flash the modifications so it doesn’t enable the wifi and doesn’t reboot if it isn’t connected, but out of the box, it will expect wifi
Looking at the code - it seems simple enough
// set to true if you want to connect to wifi. You have 60 seconds to connect. Then it will go into an offline mode.
boolean connectWIFI=true;
That code is for the Pro up to 4.2. Since you mentioned ONE v9, look at this file:
arduino/examples/ONE_V9/ONE_V9.ino at master · airgradienthq/arduino (github.com)
This highlighted line is where it notifies the hardware watchdog it is alive as part of sending data to the API, so if you aren’t intentionally connecting to wifi, somewhere you’ll need to call resetWatchdog();
every 3 minutes or so to keep it from self-rebooting, thinking something is wrong
Missed that ONE v9 - but the code still seems to have a flag to disable wifi
Correct, but I’m fairly certain you will also still need to add the resetWatchdog(); somewhere to prevent it from rebooting every ~5 min unless you don’t mind that
Thank you SO much for your answers, when you are starting it is hard to find where to look !
Ok indeed I see the
L202 if (connectWIFI) connectToWifi();
Then I see
// Wifi Manager
void connectToWifi() {
WiFiManager wifiManager;
//WiFi.disconnect(); //to delete previous saved hotspot
String HOTSPOT = "AG-" + String(getNormalizedMac());
updateOLED2("180s to connect", "to Wifi Hotspot", HOTSPOT);
wifiManager.setTimeout(180);
if (!wifiManager.autoConnect((const char * ) HOTSPOT.c_str())) {
Serial.println("failed to connect and hit timeout");
delay(6000);
}
}
But it does seem like the wifi hardware is up by default
I am looking at
“WifiManager by tzapu, tablatronix” tested with version 2.0.11-beta
#include <WiFiManager.h>
So I will ask them if I can disable the WiFi hardware. But it does not look like it can do it
Ok so I have no idea if this is true but GPT4 told me 2 alternatives:
I don’t really feel comfortable doing that
Do you know if this is right ?
It gave me this other example to disable it, if ran :
#include <WiFi101.h>
void setup() {
WiFi.setPins(8,7,4,2); // change these to any unused digital pins.
WiFi.begin();
delay(10000); // Wait for WiFi to connect.
if (WiFi.status() == WL_CONNECTED) {
WiFi.disconnect();
WiFi.end();
}
}
Surely I should reuse the other lib, but I wonder if this would work
But it feels quite stupid as it starts the Wifi, connects and then stops.
I am clueless on the intention here, especially if it told me before that no code would mean no signal emitted
As far as I know WiFi is disabled on the microcontroller by default. So if you remove all WiFi functions it should not be used.
The code that chat GPT gave you does not look correct at all.
I would remove the complete WiFiManager library and also the “SendToServer” functions as these are also calling the WiFi module. Then it should not use the WiFi module anymore.
But still need to add the resetWatchdog() call somewhere if sendToServer() is removed
Nice, thank you so much @MallocArray and @Achim_AirGradient
Will order my arigradient and share somewhere my code for other people wanting to avoid using wifi
Just saw these updates.
Feel free to look at a VERY quick edit of the existing code where I’ve tried to comment out any wifi stuff.
Might work, but a starting point to get it working I think ONE_V9-no-wifi.ino · GitHub
Any updates on this? I’m considering the purchase of an Air Gradient, but I’d like to use it in a location where WiFi is not allowed. I plan to just use the display to see the readings
(Then later I’d like to bring it back to my own bedroom where WiFi is allowed, so I’d like to be able to switch between modes somehow. Maybe I should look at other devices but I like the open-sourced nature of this)
I don’t think this is a core feature of what AirGradient is designed around.
As you said, it is open source so you could modify it to remove the wifi components either in the Arduino software or in the ESPHome configuration, but I don’t expect it is a priority for the developers at this time.