LED Kugel mit Infrarot mit IPS Steuern

Garten Aktent Beleuchtung günstig

Wie kann ich günstig eine Wlan Infrarot bridge bauen
Die aus China stammenden LED Leuchten (Günstig) haben meist nur Infrarot Steuerung

Bildschirmfoto 2016-11-10 um 19.15.41.png

zb so eine Solar-RGB-LED-Leuchtkugel, 30 cm, IP67 | ELV-Elektronik

Bildschirmfoto 2016-11-10 um 19.19.09.png
ESP8266 V3 ^// dieser kann mit der Arduino Software programmiert werden
IR Sendediode aus alter FB

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
 #include <IRremoteESP8266.h>
MDNSResponder mdns;
const char* host = "192.168.xxx.xxx";  //Web Server
// Replace with your network credentials
const char* ssid = "xxx";
const char* password = "xxxxxxxxxxxxxxxxxxx";
 IRsend irsend(5); //an IR led is connected to GPIO pin 5
 
 ESP8266WebServer server(80);

String webPage = "";
float TmpWert = 0.00;
int gpio0_pin = 0;
int gpio2_pin = 2;
int outputPin= 0;
void setup(void){
  webPage += "<h1>IR Server Garten Web Server</h1><p>LED KUGEL GARTEN <a href=\"socket1On\"><button>ON</button></a> <a href=\"socket1Off\"><button>OFF</button></a></p>";
  webPage += "<p>Socket #2 <a href=\"socket2On\"><button>ON</button></a> <a href=\"socket2Off\"><button>OFF</button></a></p>";
  

  
  // preparing GPIOs
  pinMode(gpio0_pin, OUTPUT);
  digitalWrite(gpio0_pin, LOW);
  pinMode(gpio2_pin, OUTPUT);
  digitalWrite(gpio2_pin, LOW);
  irsend.begin();
  delay(1000);
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  
  if (mdns.begin("esp8266", WiFi.localIP())) {
    Serial.println("MDNS responder started");
  }
  
  server.on("/", [](){
    server.send(200, "text/html", webPage);
  });
  server.on("/socket1On", [](){
    server.send(200, "text/html", webPage);
    digitalWrite(gpio0_pin, HIGH);
     irsend.sendNEC(0xFFE21D, 32);           // IR Befehl senden für an
    delay(500);
  });
  server.on("/socket1Off", [](){
    server.send(200, "text/html", webPage);
    digitalWrite(gpio0_pin, LOW);
     irsend.sendNEC(0xFFA25D, 32);           // IR Befehl senden für aus

    delay(500); 
  });
  server.on("/socket2On", [](){
    server.send(200, "text/html", webPage);
    digitalWrite(gpio2_pin, HIGH);
    delay(500);
  });
  server.on("/socket2Off", [](){
    server.send(200, "text/html", webPage);
    digitalWrite(gpio2_pin, LOW);
    delay(500); 
  });
  server.begin();
  Serial.println("HTTP server started");
}
 
void loop(void){
  server.handleClient();
  int rawvoltage= analogRead(outputPin);
float millivolts= (rawvoltage/1024.0) * 3300;
float kelvin= (millivolts/10);
Serial.print(kelvin);
Serial.println(" degrees Kelvin");

float celsius= kelvin - 273.15;
Serial.print(celsius);
Serial.println(" degrees Celsius");
TmpWert = (celsius);

  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }

 // We now create a URI for the request
  String url = "/get_val.php?";
  
  url += "&Wert=";
  url += TmpWert;
  
  Serial.print("Requesting URL: ");
  Serial.println(url);
  
  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1
" +
               "Host: " + host + "
" + 
               "Connection: close

");
  Serial.println("Werte an WebServer uebergeben");
  delay(10);
  
  // Read all the lines of the reply from server and print them to Serial
  while(client.available()){
    String line = client.readStringUntil('\r');
    //Serial.print(line);


delay(100);
} 
} 



Auf IPS Seite

Ganz einfach den Http String aufrufen per WWW Reader für den ESP
und Skript Inhalt

<?

 $bw1 = getvalue(xxxxx /*[HM\Fensterkontakt Wohnzimmer 2 \STATE]*/ );


if ($bw1 == false)
{
 $url = "http://192.168.xxx.xxx/socket1On";
$wwwReaderID = xxxxx /*[WWW Reader led http]*/;
WWWReader_SetPage($wwwReaderID, $url);
IPS_ApplyChanges($wwwReaderID);
WWWReader_UpdatePage($wwwReaderID);

}
else
{
 $url = "http://192.168.xxx.xx/socket1Off";
$wwwReaderID = xxxxx /*[WWW Reader led http]*/;
WWWReader_SetPage($wwwReaderID, $url);
IPS_ApplyChanges($wwwReaderID);
WWWReader_UpdatePage($wwwReaderID);

}
 
?>

Ich habe das Skript über mein Tür Kontakt getriggert bei Änderung

Farben sind der nächste Step lange Wintertage liegen vor uns