Skip to content

Conversation

@me-no-dev
Copy link
Member

This pull request adds a new method to the NetworkManager class to check if the device is online by verifying if any network interface (except AP) has an assigned IPv4 or global IPv6 address.

New functionality:

  • Added the isOnline() method to the NetworkManager class, which returns true if any interface (other than AP) has an assigned IPv4 or global IPv6 address. (NetworkManager.cpp, NetworkManager.h) [1] [2]

@me-no-dev me-no-dev added the Status: Review needed Issue or PR is awaiting review label Nov 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "fix(net): Fix typo":
    • summary looks too short

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 10 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

👋 Hello me-no-dev, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 58cda9a

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Test Results

 76 files   76 suites   16m 55s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit 58cda9a.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32C5000.000.00000.000.00
ESP32P4000.000.00000.000.00
ESP32S30⚠️ +400.000.00000.000.00
ESP32S20⚠️ +240.000.00000.000.00
ESP32C3000.000.00000.000.00
ESP32C6000.000.00000.000.00
ESP32H2000.000.00000.000.00
ESP320⚠️ +400.000.00000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32C5ESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/ArduinoOTA/examples/BasicOTA0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/AsyncUDP/examples/AsyncUDPClient0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/AsyncUDP/examples/AsyncUDPMulticastServer0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/AsyncUDP/examples/AsyncUDPServer0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/DNSServer/examples/CaptivePortal0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/ESP32/examples/Time/SimpleTime0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/ESP_NOW/examples/ESP_NOW_Broadcast_Master00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/ESP_NOW/examples/ESP_NOW_Broadcast_Slave00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/ESP_NOW/examples/ESP_NOW_Network00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/ESP_NOW/examples/ESP_NOW_Serial00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/ESPmDNS/examples/mDNS-SD_Extended0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/ESPmDNS/examples/mDNS_Web_Server0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/Ethernet/examples/ETH_W5500_Arduino_SPI0000⚠️ +240⚠️ +240000000⚠️ +240
libraries/Ethernet/examples/ETH_W5500_IDF_SPI0000⚠️ +240⚠️ +240000000⚠️ +240
libraries/Ethernet/examples/ETH_WIFI_BRIDGE0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/FFat/examples/FFat_time0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/HTTPClient/examples/Authorization0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/HTTPClient/examples/BasicHttpClient0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/HTTPClient/examples/BasicHttpsClient0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/HTTPClient/examples/CustomHeaders0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/HTTPClient/examples/HTTPClientEnterprise00--⚠️ +240⚠️ +1600000--⚠️ +240
libraries/HTTPClient/examples/ReuseConnection0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/HTTPClient/examples/StreamHttpClient0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/HTTPUpdate/examples/httpUpdate0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/HTTPUpdate/examples/httpUpdateSPIFFS0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/HTTPUpdate/examples/httpUpdateSecure0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/HTTPUpdateServer/examples/WebUpdater0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/Insights/examples/DiagnosticsSmokeTest00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/Insights/examples/MinimalDiagnostics00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/LittleFS/examples/LITTLEFS_time0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/Matter/examples/MatterColorLight00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterCommissionTest00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterComposedLights00--⚠️ +160⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterContactSensor00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterDimmableLight00--00⚠️ +240000000⚠️ +400
libraries/Matter/examples/MatterEnhancedColorLight00--00⚠️ +160000000⚠️ +240
libraries/Matter/examples/MatterEvents00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterFan00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterHumiditySensor00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterLambdaSingleCallbackManyEPs00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterMinimum00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterOccupancySensor00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterOnIdentify00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterOnOffLight00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterOnOffPlugin00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterPressureSensor00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterSmartButton00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterTemperatureLight00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterTemperatureSensor00--00⚠️ +240000000⚠️ +240
libraries/Matter/examples/MatterThermostat00--00⚠️ +240000000⚠️ +240
libraries/NetBIOS/examples/ESP_NBNST0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/NetworkClientSecure/examples/WiFiClientInsecure0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/NetworkClientSecure/examples/WiFiClientPSK0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/NetworkClientSecure/examples/WiFiClientSecure0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/NetworkClientSecure/examples/WiFiClientSecureEnterprise00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/NetworkClientSecure/examples/WiFiClientSecureProtocolUpgrade0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/NetworkClientSecure/examples/WiFiClientShowPeerCredentials0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/NetworkClientSecure/examples/WiFiClientTrustOnFirstUse0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/PPP/examples/PPP_Basic0000⚠️ +240⚠️ +240000000⚠️ +240
libraries/PPP/examples/PPP_WIFI_BRIDGE0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/RainMaker/examples/RMakerCustom00--⚠️ +240⚠️ +2400000----
libraries/RainMaker/examples/RMakerCustomAirCooler00--⚠️ +240⚠️ +2400000----
libraries/RainMaker/examples/RMakerSonoffDualR300--⚠️ +240⚠️ +2400000----
libraries/RainMaker/examples/RMakerSwitch00--⚠️ +240⚠️ +2400000----
libraries/SD/examples/SD_time0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/SPIFFS/examples/SPIFFS_time0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/Update/examples/AWS_S3_OTA_Update0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/Update/examples/HTTPS_OTA_Update0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/Update/examples/HTTP_Client_AES_OTA_Update0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/Update/examples/HTTP_Server_AES_OTA_Update0000⚠️ +400⚠️ +2400000--⚠️ +240
libraries/Update/examples/OTAWebUpdater0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/AdvancedWebServer0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/ChunkWriting0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/FSBrowser0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/Filters0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/HelloServer0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/HttpAdvancedAuth0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/HttpAuthCallback0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/HttpAuthCallbackInline0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/HttpBasicAuth0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/HttpBasicAuthSHA10000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/HttpBasicAuthSHA1orBearerToken0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/Middleware00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/MultiHomedServers0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/PathArgServer0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/SDWebServer0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/SimpleAuthentification0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/UploadHugeFile0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/WebServer0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WebServer/examples/WebUpdate0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/FTM/FTM_Initiator0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/FTM/FTM_Responder0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/SimpleWiFiServer0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WPS00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiAccessPoint0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiBlueToothSwitch00--⚠️ +240--0000--⚠️ +240
libraries/WiFi/examples/WiFiClient0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiClientBasic0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiClientConnect0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiClientEnterprise00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiClientEvents0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiClientStaticIP0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiExtender0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiIPv60000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiMulti0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiMultiAdvanced0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiScan0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiScanAsync0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiScanDualAntenna0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiScanTime0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiSmartConfig00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiTelnetToSerial0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFi/examples/WiFiUDPClient0000⚠️ +240⚠️ +2400000--⚠️ +240
libraries/WiFiProv/examples/WiFiProv00--⚠️ +240⚠️ +2400000--⚠️ +240
libraries/Zigbee/examples/Zigbee_Gateway00--⚠️ +240⚠️ +24000----⚠️ +240
libraries/Ethernet/examples/ETH_TLK110--00----------⚠️ +240
libraries/SD_MMC/examples/SDMMC_time--00⚠️ +240--------⚠️ +240
libraries/ESP32/examples/Camera/CameraWebServer----⚠️ +240⚠️ +240------⚠️ +240
ESP32/examples/Camera/CameraWebServer (2)----⚠️ +240⚠️ +240------⚠️ +240
ESP32/examples/Camera/CameraWebServer (3)----⚠️ +240----------
libraries/Ethernet/examples/ETH_LAN8720--------------⚠️ +240

@P-R-O-C-H-Y P-R-O-C-H-Y added Status: Pending Merge Pull Request is ready to be merged and removed Status: Review needed Issue or PR is awaiting review labels Nov 8, 2025
@szerwi
Copy link
Contributor

szerwi commented Nov 9, 2025

@me-no-dev I've spotted this PR and I have one remark - I'm not sure if checking if the device is online by checking interfaces' hasIP() is a good approach.
If static IP is set, ETH returns true for hasIP() even when cable is not connected. Not sure if WiFi works the same way.

@me-no-dev
Copy link
Member Author

@szerwi have you tested that? GOT_IP should not come if interface is not connected

@szerwi
Copy link
Contributor

szerwi commented Nov 9, 2025

@szerwi have you tested that? GOT_IP should not come if interface is not connected

Yes, I have an application that uses WiFi STA & AP, ETH and PPP.
When ETH (W5500) is configured to static IP and the Ethernet cable is not connected, it returns:
Started: YES Link up: NO Connected: NO Has IP: YES
(Printing in my app maps 0/false to "NO" and 1/true to "YES")

printTo() returns:

eth0: <DOWN,10M,ADDR:0x1> (DHCPC_OFF,GARP,IP_MOD) PRIO: 100
       ether <masked>
       inet 192.168.1.99 netmask 255.255.255.0 broadcast 192.168.1.255
       gateway 192.168.1.1 dns 1.1.1.1

When IP config is dynamic, it returns:
Started: YES Link up: NO Connected: NO Has IP: NO
printTo() returns:

eth0: <DOWN,10M,ADDR:0x1> (DHCPC,GARP,IP_MOD) PRIO: 100
       ether <masked>
       inet 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255
       gateway 0.0.0.0 dns 192.168.1.1

@me-no-dev
Copy link
Member Author

@szerwi I found why that happens and added a check for connected also

@me-no-dev me-no-dev merged commit 5521e02 into master Nov 9, 2025
79 checks passed
@me-no-dev me-no-dev deleted the feature/network_is_online branch November 9, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Pending Merge Pull Request is ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants