Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #include <ESP8266WiFi.h>
- #include <ESP8266HTTPClient.h>
- const char *ssid = "sid";
- const char *pass = "myssecret";
- WiFiClient client;
- HTTPClient http;
- void setup() {
- Serial.begin(9600);
- delay(100);
- Serial.print("Connecting to ");
- Serial.println(ssid);
- WiFi.begin(ssid, pass);
- while (WiFi.status() != WL_CONNECTED) {
- delay(500);
- Serial.print(".");
- }
- Serial.println("");
- Serial.println("WiFi connected");
- }
- int httpCode = 0;
- void loop() {
- String url = "http://192.168.1.13:83/dev/sps/io/0f7d5586-039c-3ba2-fffffe345eb0bf31/on";
- http.begin(url);
- http.setAuthorization("admin", "password");
- httpCode = http.GET();
- if (httpCode == HTTP_CODE_OK) {
- }
- http.end();
- delay(2000);
- String url2 = "http://192.168.1.13:83/dev/sps/io/0f7d5586-039c-3ba2-fffffe345eb0bf31/off";
- http.begin(url2);
- http.setAuthorization("admin", "password");
- httpCode = http.GET();
- if (httpCode == HTTP_CODE_OK) {
- Serial.print("Feuchtigkeit sent to Loxone. ");
- }
- http.end();
- Serial.println("Waiting... 10sec....");
- delay(10000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement