Commit 675736a4 authored by Eric Duminil's avatar Eric Duminil
Browse files

Commands: local ip via serial or mqtt

parent 28687be6
...@@ -37,7 +37,7 @@ namespace mqtt { ...@@ -37,7 +37,7 @@ namespace mqtt {
mqttClient.setServer(config::mqtt_server, config::mqtt_port); mqttClient.setServer(config::mqtt_server, config::mqtt_port);
sensor_console::defineIntCommand("mqtt", setMQTTinterval, F(" 60 (Sets MQTT sending interval, in s)")); sensor_console::defineIntCommand("mqtt", setMQTTinterval, F(" 60 (Sets MQTT sending interval, in s)"));
sensor_console::defineCommand("local_ip", sendInfoAboutLocalNetwork, sensor_console::defineCommand("send_local_ip", sendInfoAboutLocalNetwork,
F(" (Sends local IP and SSID via MQTT. Can be useful to find sensor)")); F(" (Sends local IP and SSID via MQTT. Can be useful to find sensor)"));
} }
......
...@@ -33,10 +33,19 @@ namespace wifi { ...@@ -33,10 +33,19 @@ namespace wifi {
Serial.println(); Serial.println();
} }
// Initialize Wi-Fi void showLocalIp() {
Serial.print(F("WiFi - Local IP : "));
Serial.println(wifi::local_ip);
Serial.print(F("WiFi - SSID : "));
Serial.println(WIFI_SSID);
}
// Initialize Wi-Fi
void connect(const char *hostname) { void connect(const char *hostname) {
sensor_console::defineCommand("wifi_scan", scanNetworks, F(" (Scans available WiFi networks)")); sensor_console::defineCommand("wifi_scan", scanNetworks, F(" (Scans available WiFi networks)"));
sensor_console::defineCommand("local_ip", showLocalIp, F(" (Displays local IP and current SSID)"));
//NOTE: WiFi Multi could allow multiple SSID and passwords. //NOTE: WiFi Multi could allow multiple SSID and passwords.
WiFi.persistent(false); // Don't write user & password to Flash. WiFi.persistent(false); // Don't write user & password to Flash.
WiFi.mode(WIFI_STA); // Set ESP to be a WiFi-client only WiFi.mode(WIFI_STA); // Set ESP to be a WiFi-client only
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment