Haustüer per ESP8266-12E und Blynk App öffnen

Hatte bevor ich blynk entdeckt hatte auf dem ESP8266 folgenden Code laufen:

/*
 * Creation:    02.11.2016
 * Last Update: 20.12.2016
 *
 * Copyright (c) 2016 by Georg Kainzbauer <http://www.gtkdb.de>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

// wireless network credentials:
const char* ssid = "<your_ssid>";
const char* password = "<your_wireless_password>";

// hostname for this system:
const char* host = "webcontrol";

// define GPIO pins:
const int output1 = 0;
const int output2 = 2;

// output status variables:
boolean output1_state = false;
boolean output2_state = false;

// web server on port 80:
ESP8266WebServer server(80);

String getContent()
{
  // create content for the website:
  String content = "<html><head><title>ESP8266 WebControl</title></head><body>";
  content += "This page shows the current state of the ESP8266 outputs and can be used to control these.

";

  if (output1_state)
  {
    content += "Output1: <a href=\"output1\"><button>ON</button></a>
";
  }
  else
  {
    content += "Output1: <a href=\"output1\"><button>OFF</button></a>
";
  }

  if (output2_state)
  {
    content += "Output2: <a href=\"output2\"><button>ON</button></a>
";
  }
  else
  {
    content += "Output2: <a href=\"output2\"><button>OFF</button></a>
";
  }

  content += "</body></html>";

  return content;
}

void setup()
{
  // configure GPIO 0 and GPIO 2 as outputs:
  pinMode(output1, OUTPUT);
  pinMode(output2, OUTPUT);

  // set outputs to low:
  digitalWrite(output1, LOW);
  digitalWrite(output2, LOW);

  // initialize serial port for debugging purpose:
  Serial.begin(115200);

  // connect to the wireless network:
  WiFi.begin(ssid, password);

  // wait for wireless network connection and print connection settings:
  Serial.println("");
  while (WiFi.status() != WL_CONNECTED)
  {
    Serial.print(".");
    delay(500);
  }
  Serial.println("");
  Serial.println("Wireless network connection established.");
  Serial.print("SSID: ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  // initialize mDNS:
  if (MDNS.begin(host))
  {
    Serial.println("mDNS responder started");
  }
  MDNS.addService("http", "tcp", 80);

  // start HTTP server:
  server.begin();
  Serial.println("HTTP server started");

  // print start page:
  server.on("/", [](){
    server.send(200, "text/html", getContent());
  });

  // control output1:
  server.on("/output1", [](){
    if (output1_state)
    {
      digitalWrite(output1, LOW);
      output1_state = false;
    }
    else
    {
      digitalWrite(output1, HIGH);
      output1_state = true;
    }
    server.send(200, "text/html", getContent());
    delay(1000);
  });

  // control output2:
  server.on("/output2", [](){
    if (output2_state)
    {
      digitalWrite(output2, LOW);
      output2_state = false;
    }
    else
    {
      digitalWrite(output2, HIGH);
      output2_state = true;
    }
    server.send(200, "text/html", getContent());
    delay(1000);
  });
}

void loop()
{
  // handle HTTP request:
  server.handleClient();
}

Der läuft über ein webinterface local in meinem WLAN.

Damit umgehe ich doch das Problem, meinen Kram auf irgendeinem Server im Internet liegen zu haben, oder?