ayushsharma82 / EasyDDNS

Easy to Use ESP8266 & ESP32 DDNS Update Client Library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EasyDDNS

     


An easy to use DDNS Update Client library for ESP8266 & ESP32.

EasyDDNS Library can be implemented in your major projects as a sidekick. It is independent and does not interfare with rest of your code.

Supported DDNS Providers:

  • DuckDNS
  • No-ip
  • DynDNS
  • Dynu
  • ENom
  • all-inkl
  • selfhost.de
  • strato
  • freemyip
  • afraid.org
  • OVH.com

If you don't know what's DDNS, then you can find more info about DDNS here: WiKipedia


How to Install

(Best Method) Directly Through Arduino IDE

Go to Sketch > Include Library > Library Manager > Search for "EasyDDNS" > Install

Manual Install

For Windows: Download the Repository and extract the .zip in Documents>Arduino>Libraries>{Place "EasyDDNS" folder Here}

For Linux: Download the Repository and extract the .zip in Sketchbook>Libraries>{Place "EasyDDNS" folder Here}

Manually through IDE

Download the Repository, Go to Sketch>Include Library>Add .zip Library> Select the Downloaded .zip File.


Dependencies

For ESP8266:

For ESP32:


Example

#if defined(ESP8266)
  #include "ESP8266WiFi.h"
  #include "ESP8266HTTPClient.h"
#elif defined(ESP32)
  #include "WiFi.h"
  #include "HTTPClient.h"
#endif

#include <EasyDDNS.h>

const char * ssid = "your-ssid";
const char * password = "your-password";

WiFiServer server(80);

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println(WiFi.localIP()); // Print the IP address
  server.begin();

  /*
    List of supported DDNS providers:
    - "duckdns"
    - "noip"
    - "dyndns"
    - "dynu"
    - "enom"
    - "all-inkl"
    - "selfhost.de"
    - "dyndns.it"
    - "strato"
    - "freemyip"
    - "afraid.org"
  */
  EasyDDNS.service("duckdns");

  /*
    For DDNS Providers where you get a token:
      Use this: EasyDDNS.client("domain", "token");
    
    For DDNS Providers where you get username and password: ( Leave the password field empty "" if not required )
      Use this: EasyDDNS.client("domain", "username", "password");
  */
  EasyDDNS.client("12345.duckdns.org", "token"); // Enter your DDNS Domain & Token

  // Get Notified when your IP changes
  EasyDDNS.onUpdate([&](const char* oldIP, const char* newIP){
    Serial.print("EasyDDNS - IP Change Detected: ");
    Serial.println(newIP);
  });
}

void loop() {
  // Check for new public IP every 10 seconds
  EasyDDNS.update(10000);
}

Support Me

You can always buy me a coffee :) , It supports my work and in return you get to keep up-to-date version of my libraries.


About

Easy to Use ESP8266 & ESP32 DDNS Update Client Library.

License:MIT License


Languages

Language:C++ 100.0%