Der Weihnachtsbaum wird "smart"

More and more devices are "smart", why not also the Christmas tree. This project deals with the control of the Christmas tree fairy lights over browser and Alexa. In the browser and via LED's on the hardware, the water level can also be monitored in the Christmas tree foot. Of course, a timer can also be configured to turn the light on and off regularly. The entire configuration takes place in the browser. So go, what are you waiting for!

Required hardware

Two variants are described.
Free construction without housing:

Quantity

Component

annotation

1

D1 mini

 

1

Relay module

 

1

Capacitive moisture sensor

For water level sensor

3

LEDs red, yellow and green

For water level sensor

4

Resistors 3 x 220 Ohm 1 x 220 KOHM

For water level sensor

 

The components for the water level sensor are optional if this feature is to be used.

Construction on dual-base shield with housing from the 3D printer:

Quantity

Component

annotation

1

D1 mini

 

1

Relais Shield

 

1

Dual Base Shield

 

1

Prototype Shield for D1 Mini

For water level sensor

1

Capacitive moisture sensor

For water level sensor

3

LEDs red, yellow and green

For water level sensor

4

Resistors 3 x 220 Ohm 1 x 220 KOHM

For water level sensor

1

Angled pin strip 3-pole

For water level sensor

1

Housing base from the 3D printer

 

1

Housing lid without sensor

 

1

Housing lid with sensor

For water level sensor

1

Cover sensor part1

For water level sensor

1

Cover sensor part2

For water level sensor

 

The components for the water level sensor are optional if this feature is to be used.

The circuit

Free construction without housing:

circuit

With Dual-Bas Shield and Relaisshield:

circuit diagram

Construction of the variant 2

If you want to use the Water Status Sensor option, the D1 mini must be equipped with the combined pin and spring strips, so that the sensor shield can then be inserted on it. There is nothing to do with the Relais Shield. The Dual Base Shield is equipped with the enclosed spring strips.

Image of the modules

The Sensor Shield is built on the D1 mini prototyping shield. First, the resistors, then the pin strips and last the light-emitting diodes should be installed. The arrangement of the components was chosen so that the wiring can take place with bare wires. Only for the ground line (shown in the following illustration of purple), an insulated wire must be used.
Construction as a drawing
Construction as a picture


software

So that the sketch can be compiled, the Arduino IDE must be prepared accordingly. By default, the Arduino IDE supports a large number of boards with different microcontrollers, but not the ESP8266. So you can create and upload programs for the ESP8266, a software package must be installed for the support of the ESP8266.

ESP8266 support

First, you must tell the Arduino IDE where you will find the additionally required data for ESP8266. To do this, open the item Preferences in the File menu. In the preset window, there is the input field with the label "Additional Board Manager URLs". If you click on the icon to the right of the input field, a window opens in the URL

https://arduino.esp8266.com/stable/package_esp8266com_index.json can enter.

Now choose in the Arduino IDE under Tool → Board board administration.


A window opens in which all available packages are listed. To narrow the list, enter "ESP8266" in the search box. Then you only get one entry in the list.

ESP8266 board selection

For the Alexa Interface you need two libraries that can not be installed through library management. These must first be downloaded as ZIP file. The asynchronous web server of https://github.com/me-no-dev/ESPAsyncWebServer and asynchronously TCP of https://github.com/me-no-dev/ESPAsyncTCP. Simply click on the green button code and select "Download Zip".

To install the downloaded ZIP files in the Arduino IDE, call up in the SKETCH menu -> Integrate library -> .zip Library Add to. A file selection dialog appears by selecting the downloaded files. Nothing else to do.

Finally, two more libraries are needed, which can be installed via the Arduino library management. This is the "Espabauxmo" library that implements the interface to Alexa and the "asyncwebconfig" library, which implements the configuration via the browser.

 Library Fauxmo

 Library asyncwebconfig

If all libraries are installed, the sketch can be compiled and uploaded to the hardware.

The sketch

 

#include <ESP8266Wifi.H>     // WiFi Support
#include <ESP8266MDNS.H>     // for name Server to use names in Place of IP 
#include <Tz.H>              // Timezone Dfinitions for Clock
#include <Asyncwebconfig.H>  // Library for Configuration
#include <EspasyncWebserver.H> // asynchron web server
#include <fauxmoesp.H>       // Interface for Alexa

// Pins Used for LED and relay
#define Pinrelais D1
#define Pinempty D2
#define Pinhale D3
#define Pinfull D4

#define Lvlfull 300
#define Lvlempty 600

#define Time zone TZ_EUROPE_BERLIN

#define Reconnect 300 // Seconds to Wait for Reconnect AFTER DISCONNECT

// Form for Configuration, JSON formatted
String param = "["
  "{"
  "'Name': 'SSID',"
  "'Label': 'Name of the WLAN',"
  "'Type':"+String(Input text)+","
  "'default':''"
  "},"
  "{"
  "'Name': 'PWD',"
  "'label': 'wlan password',"
  "'Type':"+String(Inputpassword)+","
  "'default':''"
  "},"
  "{"
  "'Name': 'Alexaname',"
  "'Label': 'Name for Alexa',"
  "'Type':"+String(Input text)+","
  "'Default': 'Christmas tree'"
  "},"
  "{"
  "'Name': 'NTPServer',"
  "'label': 'NTP server',"
  "'Type':"+String(Input text)+","
  "'Default': 'Pool.ntp.org'"
  "},"
  "{"
  "'Name': 'Showlevel',"
  "'Label': 'Show water level',"
  "'Type':"+String(InputCheckBox)+","
  "'Default': '1'"
  "},"
  "{"
  "'Name': 'Usetimer',"
  "'Label': Use 'Timer',"
  "'Type':"+String(InputCheckBox)+","
  "'Default': '0'"
  "},"
  "{"
  "'Name': 'StartTime',"
  "'Label': 'Optional time',"
  "'Type':"+String(Inputime)+","
  "'Default': '18:30'"
  "},"
  "{"
  "'Name': 'StopTime',"
  "" Label ": 'switch-off time',"
  "'Type':"+String(Inputime)+","
  "'Default': '23:00'"
  "}"
"]";

constant Char HTML[] Progmem =
" \ N"
" \ n"
" \ N"
" \ n"
" \ n"
" \ n"
" Configuration </ Title> \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"<Style> \ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Body {\ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Background Color: # ECC361; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Font-Family: Arial, Helvetica, Sans-Serif; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Color: # 000000; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Font-size: 12pt; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Width: 320px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"} \ n"</span>
<span style="color: #005c5f;" color="#005c5f">".Titel {\ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Font-Weight: Bold; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Text Align: Center; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Width: 100 %%; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Padding: 5px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"} \ n"</span>
<span style="color: #005c5f;" color="#005c5f">". Line {\ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Text Align: Center; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"} \ n"</span>
<span style="color: #005c5f;" color="#005c5f">".BTN {\ N "</span>
<span style="color: #005c5f;" color="#005c5f">"Width: 150px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Border Radius: 10px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Background Color:% s; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"} \ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Image {\ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Width: 320px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Opacity:% f; \ n"</span>
<span style="color: #005c5f;" color="#005c5f">"} \ n"</span>
<span style="color: #005c5f;" color="#005c5f">".full, .half, .empty {\ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Width: 30px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Height: 30px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Border Radius: 15px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Border: 2px solid black; \ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Display: inline block; \ n"</span>
<span style="color: #005c5f;" color="#005c5f">"} \ n"</span>
<span style="color: #005c5f;" color="#005c5f">".full {\ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Background Color:% s; \ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Margin-Left: 86px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"} \ n"</span>
<span style="color: #005c5f;" color="#005c5f">".half {\ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Background Color:% s; \ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Margin-Left: 18px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"} \ n"</span>
<span style="color: #005c5f;" color="#005c5f">".empty {\ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Background Color:% s; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Margin-Left: 18px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"} \ n"</span>
<span style="color: #005c5f;" color="#005c5f">".showlevel {\ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Visibility:% s; \ n"</span>
<span style="color: #005c5f;" color="#005c5f">"} \ n"</span>
<span style="color: #005c5f;" color="#005c5f">".conf {\ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Background Color: Lightgray, \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Border: 2px solid black; \ n"</span>
<span style="color: #005c5f;" color="#005c5f">"Width: 150px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Padding: 1px 0px 1px 0px; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"Text Align: Center; \ N"</span>
<span style="color: #005c5f;" color="#005c5f">"text-decoration: none;\n"</span>
<span style="color: #005c5f;" color="#005c5f">"display: inline-block;\n"</span>
<span style="color: #005c5f;" color="#005c5f">"border-radius: 15px;\n"</span>
<span style="color: #005c5f;" color="#005c5f">"margin-top: 10px;\n"</span>
<span style="color: #005c5f;" color="#005c5f">"cursor: pointer;\n"</span>
<span style="color: #005c5f;" color="#005c5f">"}\n"</span>
<span style="color: #005c5f;" color="#005c5f">"</style>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"</head>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<body>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<div id='main_div'>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<img src='https://cdn.pixabay.com/photo/2021/10/05/21/42/christmas-6683805_960_720.png' class='bild'/>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<form method='post'>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<div class='zeile'><button class='btn' type='submit' name='%s'>%s</button></div>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<div class='showlevel'>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<div class='titel'>Wasserstand</div>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<div class='full'> </div>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<div class='half'> </div>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<div class='empty'> </div></div>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"<div class='zeile'><a href='./config' target='blank' class='conf'>Konfiguration</a></div>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"</form>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"</body>\n"</span>
<span style="color: #005c5f;" color="#005c5f">"</html>\n"</span><span style="color: #000000;" color="#000000">;</span>

<span style="color: #434f54;" color="#434f54">//Global variables</span>
<span style="color: #000000;" color="#000000">AsyncWebServer</span> <span style="color: #000000;" color="#000000">server</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">80</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #000000;" color="#000000">AsyncWebConfig</span> <span style="color: #000000;" color="#000000">conf</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #000000;" color="#000000">fauxmoESP</span> <span style="color: #000000;" color="#000000">fauxmo</span><span style="color: #000000;" color="#000000">;</span>

<span style="color: #00979c;" color="#00979c">uint32_t</span> <span style="color: #000000;" color="#000000">last</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">0</span><span style="color: #000000;" color="#000000">;</span>      <span style="color: #434f54;" color="#434f54">//used for timed actions</span>
<span style="color: #00979c;" color="#00979c">boolean</span> <span style="color: #000000;" color="#000000">timeron</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #00979c;" color="#00979c">true</span><span style="color: #000000;" color="#000000">;</span> <span style="color: #434f54;" color="#434f54">//flag if timer has switched on</span>
<span style="color: #00979c;" color="#00979c">boolean</span> <span style="color: #d35400;" color="#d35400">connected</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #00979c;" color="#00979c">false</span><span style="color: #000000;" color="#000000">;</span> <span style="color: #434f54;" color="#434f54">//true if we have a router connection</span>
<span style="color: #00979c;" color="#00979c">uint16_t</span> <span style="color: #000000;" color="#000000">nextTry</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">0</span><span style="color: #000000;" color="#000000">;</span>    <span style="color: #434f54;" color="#434f54">//second counter for reconnect</span>
<span style="color: #434f54;" color="#434f54">//current colors for water level</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">bgfull</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">bghalf</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">bgempty</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span><span style="color: #434f54;" color="#434f54">*</span> <span style="color: #000000;" color="#000000">bgbtn</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">btnname</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">btnlabel</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">showlevel</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">float</span> <span style="color: #000000;" color="#000000">opac</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #434f54;" color="#434f54">//char buf[2048];</span>
<span style="color: #434f54;" color="#434f54">//constants to be used for web page</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">bgbtnon</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"aquamarine"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">btnnameon</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"on"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">btnlabelon</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"ON"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">bgbtnoff</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"lightgray"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">btnnameoff</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"off"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">btnlabeloff</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"OFF"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">colfull</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"green"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">colhalf</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"yellow"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">colempty</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"red"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">colnone</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"lightgray"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">showit</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"visible"</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">hideit</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">]</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #005c5f;" color="#005c5f">"hidden"</span><span style="color: #000000;" color="#000000">;</span>

<span style="color: #434f54;" color="#434f54">//Initiate WiFi connection </span>
<span style="color: #00979c;" color="#00979c">boolean</span> <span style="color: #000000;" color="#000000">initWiFi</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
    <span style="color: #00979c;" color="#00979c">boolean</span> <span style="color: #d35400;" color="#d35400">connected</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #00979c;" color="#00979c">false</span><span style="color: #000000;" color="#000000">;</span>
    <b><span style="color: #d35400;" color="#d35400">WiFi</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">mode</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">WIFI_STA</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">print</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"Connect to "</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">println</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getValue</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"ssid"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #434f54;" color="#434f54">//if SSID was configured we try to establish a connection</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getValue</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"ssid"</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">!=</span> <span style="color: #005c5f;" color="#005c5f">""</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span> 
      <b><span style="color: #d35400;" color="#d35400">WiFi</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">begin</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">values</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">0</span><span style="color: #000000;" color="#000000">]</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">c_str</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">values</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">1</span><span style="color: #000000;" color="#000000">]</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">c_str</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #00979c;" color="#00979c">uint8_t</span> <span style="color: #000000;" color="#000000">cnt</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">0</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #434f54;" color="#434f54">//wait 10 seconds</span>
      <span style="color: #5e6d03;" color="#5e6d03">while</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><b><span style="color: #d35400;" color="#d35400">WiFi</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">status</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">!=</span> <span style="color: #000000;" color="#000000">WL_CONNECTED</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">&&</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">cnt</span><span style="color: #434f54;" color="#434f54"><</span><span style="color: #000000;" color="#000000">20</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">{</span>
        <span style="color: #d35400;" color="#d35400">delay</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">500</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
        <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">print</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"."</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
        <span style="color: #000000;" color="#000000">cnt</span><span style="color: #434f54;" color="#434f54">++</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #000000;" color="#000000">}</span>
      <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">println</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #434f54;" color="#434f54">//if successful connected the IP address will be printed</span>
      <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><b><span style="color: #d35400;" color="#d35400">WiFi</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">status</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">==</span> <span style="color: #000000;" color="#000000">WL_CONNECTED</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
        <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">print</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"IP-Adresse = "</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
        <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">println</span><span style="color: #000000;" color="#000000">(</span><b><span style="color: #d35400;" color="#d35400">WiFi</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">localIP</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
        <span style="color: #d35400;" color="#d35400">connected</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #00979c;" color="#00979c">true</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #000000;" color="#000000">}</span>
    <span style="color: #000000;" color="#000000">}</span>
    <span style="color: #434f54;" color="#434f54">//if no SSID was configured or the connection could not be established</span>
    <span style="color: #434f54;" color="#434f54">//we start an accesspoint to make configuration</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #434f54;" color="#434f54">!</span><span style="color: #d35400;" color="#d35400">connected</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
          <b><span style="color: #d35400;" color="#d35400">WiFi</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">mode</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">WIFI_AP</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
          <b><span style="color: #d35400;" color="#d35400">WiFi</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">softAP</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getApName</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #005c5f;" color="#005c5f">""</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">1</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
          <span style="color: #000000;" color="#000000">nextTry</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">0</span><span style="color: #000000;" color="#000000">;</span>  
    <span style="color: #000000;" color="#000000">}</span>
    <span style="color: #5e6d03;" color="#5e6d03">return</span> <span style="color: #d35400;" color="#d35400">connected</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #000000;" color="#000000">}</span>

<span style="color: #434f54;" color="#434f54">//get minutes from a time string formatted hh:mm</span>
<span style="color: #00979c;" color="#00979c">uint16_t</span> <span style="color: #d35400;" color="#d35400">getMinutes</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">String</span> <span style="color: #000000;" color="#000000">tim</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
  <span style="color: #00979c;" color="#00979c">uint16_t</span> <span style="color: #000000;" color="#000000">h</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">tim</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">substring</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">0</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">2</span><span style="color: #000000;" color="#000000">)</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">toInt</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #00979c;" color="#00979c">uint16_t</span> <span style="color: #000000;" color="#000000">m</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">tim</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">substring</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">3</span><span style="color: #000000;" color="#000000">)</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">toInt</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #5e6d03;" color="#5e6d03">return</span> <span style="color: #000000;" color="#000000">h</span><span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">60</span><span style="color: #434f54;" color="#434f54">+</span><span style="color: #000000;" color="#000000">m</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #000000;" color="#000000">}</span>

<span style="color: #434f54;" color="#434f54">//check if timer is in range and switch relais if necessary</span>
<span style="color: #00979c;" color="#00979c">void</span> <span style="color: #000000;" color="#000000">checkTimer</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
  <span style="color: #434f54;" color="#434f54">//get minutes for now</span>
  <b><span style="color: #d35400;" color="#d35400">time_t</span></b> <span style="color: #d35400;" color="#d35400">now</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #d35400;" color="#d35400">time</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">nullptr</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span> <span style="color: #434f54;" color="#434f54">//aktuelle Zeit </span>
  <span style="color: #00979c;" color="#00979c">struct</span> <span style="color: #000000;" color="#000000">tm</span> <span style="color: #434f54;" color="#434f54">*</span> <span style="color: #000000;" color="#000000">s_time</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #d35400;" color="#d35400">localtime</span><span style="color: #000000;" color="#000000">(</span><span style="color: #434f54;" color="#434f54">&</span><span style="color: #d35400;" color="#d35400">now</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span> <span style="color: #434f54;" color="#434f54">//Zeitstruktur aufgesplittet in Jahr, Monat, Tag, Stunden, Minuten und Sekunden</span>
  <span style="color: #00979c;" color="#00979c">uint16_t</span> <span style="color: #000000;" color="#000000">minutes</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">s_time</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #000000;" color="#000000">tm_hour</span> <span style="color: #434f54;" color="#434f54">*</span> <span style="color: #000000;" color="#000000">60</span> <span style="color: #434f54;" color="#434f54">+</span> <span style="color: #000000;" color="#000000">s_time</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #000000;" color="#000000">tm_min</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #434f54;" color="#434f54">//get minutes for start and stop</span>
  <span style="color: #00979c;" color="#00979c">uint16_t</span> <span style="color: #000000;" color="#000000">starttime</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #d35400;" color="#d35400">getMinutes</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getString</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"starttime"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #00979c;" color="#00979c">uint16_t</span> <span style="color: #000000;" color="#000000">stoptime</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #d35400;" color="#d35400">getMinutes</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getString</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"stoptime"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">starttime</span> <span style="color: #434f54;" color="#434f54"><=</span> <span style="color: #000000;" color="#000000">stoptime</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span> <span style="color: #434f54;" color="#434f54">//relais on inside the range</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">minutes</span> <span style="color: #434f54;" color="#434f54">>=</span> <span style="color: #000000;" color="#000000">starttime</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">&&</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">minutes</span> <span style="color: #434f54;" color="#434f54"><=</span> <span style="color: #000000;" color="#000000">stoptime</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">&&</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #434f54;" color="#434f54">!</span><span style="color: #000000;" color="#000000">timeron</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
      <span style="color: #000000;" color="#000000">timeron</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #00979c;" color="#00979c">true</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #000000;" color="#000000">setRelay</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">true</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">}</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">minutes</span> <span style="color: #434f54;" color="#434f54"><</span> <span style="color: #000000;" color="#000000">starttime</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">||</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">minutes</span> <span style="color: #434f54;" color="#434f54">></span> <span style="color: #000000;" color="#000000">stoptime</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">&&</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">timeron</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
      <span style="color: #000000;" color="#000000">timeron</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #00979c;" color="#00979c">false</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #000000;" color="#000000">setRelay</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">false</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">}</span>
  <span style="color: #000000;" color="#000000">}</span> <span style="color: #5e6d03;" color="#5e6d03">else</span> <span style="color: #000000;" color="#000000">{</span> <span style="color: #434f54;" color="#434f54">//relais on outside the range</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">minutes</span> <span style="color: #434f54;" color="#434f54">>=</span> <span style="color: #000000;" color="#000000">starttime</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">&&</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">minutes</span> <span style="color: #434f54;" color="#434f54"><=</span> <span style="color: #000000;" color="#000000">stoptime</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">&&</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">timeron</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
      <span style="color: #000000;" color="#000000">timeron</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #00979c;" color="#00979c">false</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #000000;" color="#000000">setRelay</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">false</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">}</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">minutes</span> <span style="color: #434f54;" color="#434f54"><</span> <span style="color: #000000;" color="#000000">starttime</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">||</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">minutes</span> <span style="color: #434f54;" color="#434f54">></span> <span style="color: #000000;" color="#000000">stoptime</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">&&</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #434f54;" color="#434f54">!</span><span style="color: #000000;" color="#000000">timeron</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
      <span style="color: #000000;" color="#000000">timeron</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #00979c;" color="#00979c">true</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #000000;" color="#000000">setRelay</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">true</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">}</span>
  <span style="color: #000000;" color="#000000">}</span>
<span style="color: #000000;" color="#000000">}</span>

<span style="color: #434f54;" color="#434f54">//switch the relais on or off</span>
<span style="color: #00979c;" color="#00979c">void</span> <span style="color: #000000;" color="#000000">setRelay</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">boolean</span> <span style="color: #d35400;" color="#d35400">on</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
  <span style="color: #d35400;" color="#d35400">digitalWrite</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINRELAIS</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #d35400;" color="#d35400">on</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #d35400;" color="#d35400">on</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
    <span style="color: #000000;" color="#000000">bgbtn</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">bgbtnon</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">btnname</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">btnnameon</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">btnlabel</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">btnlabelon</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">opac</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">1</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">}</span> <span style="color: #5e6d03;" color="#5e6d03">else</span> <span style="color: #000000;" color="#000000">{</span>
    <span style="color: #000000;" color="#000000">bgbtn</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">bgbtnoff</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">btnname</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">btnnameoff</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">btnlabel</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">btnlabeloff</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">opac</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">0.2</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">}</span>
<span style="color: #000000;" color="#000000">}</span>
<span style="color: #434f54;" color="#434f54">//check fluid level and set correesponding LEDs</span>
<span style="color: #00979c;" color="#00979c">void</span> <span style="color: #000000;" color="#000000">setLEDs</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">{</span>
  <span style="color: #434f54;" color="#434f54">//read from moisture sensor</span>
  <span style="color: #434f54;" color="#434f54">//low value if wet</span>
  <span style="color: #00979c;" color="#00979c">int</span> <span style="color: #000000;" color="#000000">x</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #d35400;" color="#d35400">analogRead</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">A0</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">printf</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"Analog read: %i\n"</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">x</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #434f54;" color="#434f54">//output low to switch LED on</span>
  <span style="color: #000000;" color="#000000">bgempty</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">colnone</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">bghalf</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">colnone</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">bgfull</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">colnone</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">x</span> <span style="color: #434f54;" color="#434f54">></span> <span style="color: #000000;" color="#000000">LVLEMPTY</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span> 
    <span style="color: #d35400;" color="#d35400">digitalWrite</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINEMPTY</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">0</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #d35400;" color="#d35400">digitalWrite</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINHALF</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">1</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #d35400;" color="#d35400">digitalWrite</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINFULL</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">1</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">bgempty</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">colempty</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">}</span> <span style="color: #5e6d03;" color="#5e6d03">else</span> <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">x</span> <span style="color: #434f54;" color="#434f54"><=</span> <span style="color: #000000;" color="#000000">LVLEMPTY</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">&&</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">x</span> <span style="color: #434f54;" color="#434f54">>=</span> <span style="color: #000000;" color="#000000">LVLFULL</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
    <span style="color: #d35400;" color="#d35400">digitalWrite</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINEMPTY</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">1</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #d35400;" color="#d35400">digitalWrite</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINHALF</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">0</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #d35400;" color="#d35400">digitalWrite</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINFULL</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">1</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">bghalf</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">colhalf</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">}</span> <span style="color: #5e6d03;" color="#5e6d03">else</span> <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">x</span> <span style="color: #434f54;" color="#434f54"><</span> <span style="color: #000000;" color="#000000">LVLFULL</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
    <span style="color: #d35400;" color="#d35400">digitalWrite</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINEMPTY</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">1</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #d35400;" color="#d35400">digitalWrite</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINHALF</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">1</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #d35400;" color="#d35400">digitalWrite</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINFULL</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">0</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">bgfull</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">colfull</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">}</span>
<span style="color: #000000;" color="#000000">}</span>

<span style="color: #434f54;" color="#434f54">//*****callback functions for web server</span>
<span style="color: #00979c;" color="#00979c">void</span> <span style="color: #000000;" color="#000000">handleRoot</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">AsyncWebServerRequest</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">request</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">{</span>
  <span style="color: #434f54;" color="#434f54">//if we are not connected we show the config page</span>
  <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #434f54;" color="#434f54">!</span><span style="color: #d35400;" color="#d35400">connected</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
    <span style="color: #000000;" color="#000000">handleConfig</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">request</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">}</span> <span style="color: #5e6d03;" color="#5e6d03">else</span> <span style="color: #000000;" color="#000000">{</span>
    <span style="color: #434f54;" color="#434f54">//we show the hompage</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #d35400;" color="#d35400">hasArg</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"on"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">setRelay</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">false</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #d35400;" color="#d35400">hasArg</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"off"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">setRelay</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">true</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">buf</span><span style="color: #000000;" color="#000000">[</span><span style="color: #000000;" color="#000000">2048</span><span style="color: #000000;" color="#000000">]</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #d35400;" color="#d35400">sprintf</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">buf</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">HTML</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">bgbtn</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">opac</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">bgfull</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">bghalf</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">bgempty</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">showlevel</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">btnname</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">btnlabel</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #d35400;" color="#d35400">send</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">200</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #005c5f;" color="#005c5f">"text/html"</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">buf</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">}</span>
<span style="color: #000000;" color="#000000">}</span>

<span style="color: #00979c;" color="#00979c">void</span> <span style="color: #000000;" color="#000000">handleConfig</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">AsyncWebServerRequest</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">request</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">{</span>
  <span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">handleFormRequest</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">request</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #d35400;" color="#d35400">hasArg</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"SAVE"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
    <span style="color: #000000;" color="#000000">showlevel</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">hideit</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getBool</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"showlevel"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">showlevel</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">showit</span><span style="color: #000000;" color="#000000">;</span> 
  <span style="color: #000000;" color="#000000">}</span>
<span style="color: #000000;" color="#000000">}</span>

<span style="color: #00979c;" color="#00979c">void</span> <span style="color: #000000;" color="#000000">handleNotFound</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">AsyncWebServerRequest</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">request</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">{</span>
  <span style="color: #434f54;" color="#434f54">//for fauxmo</span>
  <span style="color: #00979c;" color="#00979c">String</span> <span style="color: #000000;" color="#000000">body</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #000000;" color="#000000">hasParam</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"body"</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #00979c;" color="#00979c">true</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">?</span> <span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #000000;" color="#000000">getParam</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"body"</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #00979c;" color="#00979c">true</span><span style="color: #000000;" color="#000000">)</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #d35400;" color="#d35400">value</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">:</span> <span style="color: #00979c;" color="#00979c">String</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">fauxmo</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #000000;" color="#000000">process</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #d35400;" color="#d35400">client</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #d35400;" color="#d35400">method</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">==</span> <span style="color: #00979c;" color="#00979c">HTTP_GET</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #000000;" color="#000000">url</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #000000;" color="#000000">body</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #5e6d03;" color="#5e6d03">return</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #434f54;" color="#434f54">// Handle other not found requests here...</span>
<span style="color: #000000;" color="#000000">}</span>

<span style="color: #00979c;" color="#00979c">void</span> <span style="color: #000000;" color="#000000">handleBodyRequest</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">AsyncWebServerRequest</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #00979c;" color="#00979c">uint8_t</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #d35400;" color="#d35400">data</span><span style="color: #434f54;" color="#434f54">,</span> <b><span style="color: #d35400;" color="#d35400">size_t</span></b> <span style="color: #000000;" color="#000000">len</span><span style="color: #434f54;" color="#434f54">,</span> <b><span style="color: #d35400;" color="#d35400">size_t</span></b> <span style="color: #000000;" color="#000000">index</span><span style="color: #434f54;" color="#434f54">,</span> <b><span style="color: #d35400;" color="#d35400">size_t</span></b> <span style="color: #000000;" color="#000000">total</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">{</span>
  <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">println</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #000000;" color="#000000">url</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">fauxmo</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #000000;" color="#000000">process</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #d35400;" color="#d35400">client</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #d35400;" color="#d35400">method</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">==</span> <span style="color: #00979c;" color="#00979c">HTTP_GET</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #000000;" color="#000000">request</span><span style="color: #434f54;" color="#434f54">-</span><span style="color: #434f54;" color="#434f54">></span><span style="color: #000000;" color="#000000">url</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #00979c;" color="#00979c">String</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">char</span> <span style="color: #434f54;" color="#434f54">*</span><span style="color: #000000;" color="#000000">)</span><span style="color: #d35400;" color="#d35400">data</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #5e6d03;" color="#5e6d03">return</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #434f54;" color="#434f54">// Handle any other body request here...</span>
<span style="color: #000000;" color="#000000">}</span>

<span style="color: #00979c;" color="#00979c">void</span> <span style="color: #000000;" color="#000000">handleAlexa</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">unsigned</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #000000;" color="#000000">device_id</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #00979c;" color="#00979c">const</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #434f54;" color="#434f54">*</span> <span style="color: #000000;" color="#000000">device_name</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #00979c;" color="#00979c">bool</span> <span style="color: #000000;" color="#000000">state</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #00979c;" color="#00979c">unsigned</span> <span style="color: #00979c;" color="#00979c">char</span> <span style="color: #d35400;" color="#d35400">value</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
  <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">printf</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"[MAIN] Device #%d (%s) state: %s value: %d\n"</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #000000;" color="#000000">device_id</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #000000;" color="#000000">device_name</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #000000;" color="#000000">state</span> <span style="color: #434f54;" color="#434f54">?</span> <span style="color: #005c5f;" color="#005c5f">"ON"</span> <span style="color: #434f54;" color="#434f54">:</span> <span style="color: #005c5f;" color="#005c5f">"OFF"</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #d35400;" color="#d35400">value</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">setRelay</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">state</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>      
<span style="color: #000000;" color="#000000">}</span>

<span style="color: #434f54;" color="#434f54">//init the Alexa interface</span>
<span style="color: #00979c;" color="#00979c">void</span> <span style="color: #000000;" color="#000000">initAlexa</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
  <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">println</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"Init Alexa"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #434f54;" color="#434f54">// Set fauxmoESP to not create an internal TCP server and redirect requests to the server on the defined port</span>
  <span style="color: #434f54;" color="#434f54">// The TCP port must be 80 for gen3 devices (default is 1901)</span>
  <span style="color: #434f54;" color="#434f54">// This has to be done before the call to enable()</span>
  <span style="color: #000000;" color="#000000">fauxmo</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #000000;" color="#000000">createServer</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">false</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">fauxmo</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">setPort</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">80</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span> <span style="color: #434f54;" color="#434f54">// This is required for gen3 devices</span>

  <span style="color: #434f54;" color="#434f54">// You have to call enable(true) once you have a WiFi connection</span>
  <span style="color: #434f54;" color="#434f54">// You can enable or disable the library at any moment</span>
  <span style="color: #434f54;" color="#434f54">// Disabling it will prevent the devices from being discovered and switched</span>
  <span style="color: #000000;" color="#000000">fauxmo</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">enable</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">true</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #434f54;" color="#434f54">// Add virtual devices</span>
  <span style="color: #000000;" color="#000000">fauxmo</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #000000;" color="#000000">addDevice</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getValue</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"alexaname"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">fauxmo</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #000000;" color="#000000">onSetState</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">handleAlexa</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #000000;" color="#000000">}</span>
<br><span style="color: #00979c;" color="#00979c">void</span> <span style="color: #5e6d03;" color="#5e6d03">setup</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
  <b><span style="color: #d35400;" color="#d35400">Serial</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">begin</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">74880</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #434f54;" color="#434f54">//All used pins as output</span>
  <span style="color: #d35400;" color="#d35400">pinMode</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINRELAIS</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #00979c;" color="#00979c">OUTPUT</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #d35400;" color="#d35400">pinMode</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINFULL</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #00979c;" color="#00979c">OUTPUT</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #d35400;" color="#d35400">pinMode</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINHALF</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #00979c;" color="#00979c">OUTPUT</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #d35400;" color="#d35400">pinMode</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">PINEMPTY</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #00979c;" color="#00979c">OUTPUT</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #434f54;" color="#434f54">//prepare configuration form and read existing configuration</span>
  <span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">setDescription</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">params</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">readConfig</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">showlevel</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">hideit</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getBool</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"showlevel"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">showlevel</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">showit</span><span style="color: #000000;" color="#000000">;</span> 
  <span style="color: #d35400;" color="#d35400">connected</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">initWiFi</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #434f54;" color="#434f54">//we start the web server independent if we have an internet</span>
  <span style="color: #434f54;" color="#434f54">//connection or an accesspoint</span>
  <span style="color: #000000;" color="#000000">server</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">on</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"/"</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">handleRoot</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">server</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">on</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"/config"</span><span style="color: #434f54;" color="#434f54">,</span><span style="color: #000000;" color="#000000">handleConfig</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">server</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #000000;" color="#000000">onRequestBody</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">handleBodyRequest</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">server</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">onNotFound</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">handleNotFound</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">server</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">begin</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #d35400;" color="#d35400">connected</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span> <span style="color: #434f54;" color="#434f54">//if we have an internet connection</span>
    <span style="color: #000000;" color="#000000">initAlexa</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #434f54;" color="#434f54">//init the internal clock</span>
    <span style="color: #000000;" color="#000000">configTime</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">TIMEZONE</span><span style="color: #434f54;" color="#434f54">,</span> <span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getValue</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"ntpserver"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">}</span>
  <span style="color: #434f54;" color="#434f54">//reset timed event</span>
  <span style="color: #000000;" color="#000000">last</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #d35400;" color="#d35400">millis</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">setRelay</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">false</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">setLEDs</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <b><span style="color: #d35400;" color="#d35400">MDNS</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">begin</span><span style="color: #000000;" color="#000000">(</span><span style="color: #00979c;" color="#00979c">String</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getApName</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span><span style="color: #434f54;" color="#434f54">+</span><span style="color: #005c5f;" color="#005c5f">".local"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #000000;" color="#000000">}</span>

<span style="color: #00979c;" color="#00979c">void</span> <span style="color: #5e6d03;" color="#5e6d03">loop</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
  <span style="color: #000000;" color="#000000">fauxmo</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">handle</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #434f54;" color="#434f54">//action every second</span>
  <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">(</span><span style="color: #d35400;" color="#d35400">millis</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">-</span> <span style="color: #000000;" color="#000000">last</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">></span> <span style="color: #000000;" color="#000000">1000</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><b><span style="color: #d35400;" color="#d35400">WiFi</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">status</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #434f54;" color="#434f54">!=</span> <span style="color: #000000;" color="#000000">WL_CONNECTED</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span> 
      <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #434f54;" color="#434f54">++</span><span style="color: #000000;" color="#000000">nextTry</span> <span style="color: #434f54;" color="#434f54">></span> <span style="color: #000000;" color="#000000">RECONNECT</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">{</span>
        <span style="color: #000000;" color="#000000">initWiFi</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #000000;" color="#000000">}</span> <span style="color: #5e6d03;" color="#5e6d03">else</span> <span style="color: #000000;" color="#000000">{</span>
        <span style="color: #000000;" color="#000000">nextTry</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #000000;" color="#000000">0</span><span style="color: #000000;" color="#000000">;</span>
      <span style="color: #000000;" color="#000000">}</span>
    <span style="color: #000000;" color="#000000">}</span>
    <span style="color: #000000;" color="#000000">last</span> <span style="color: #434f54;" color="#434f54">=</span> <span style="color: #d35400;" color="#d35400">millis</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #000000;" color="#000000">setLEDs</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
    <span style="color: #5e6d03;" color="#5e6d03">if</span> <span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">conf</span><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">getBool</span><span style="color: #000000;" color="#000000">(</span><span style="color: #005c5f;" color="#005c5f">"usetimer"</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">)</span> <span style="color: #000000;" color="#000000">checkTimer</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
  <span style="color: #000000;" color="#000000">}</span>
  <b><span style="color: #d35400;" color="#d35400">MDNS</span></b><span style="color: #434f54;" color="#434f54">.</span><span style="color: #d35400;" color="#d35400">update</span><span style="color: #000000;" color="#000000">(</span><span style="color: #000000;" color="#000000">)</span><span style="color: #000000;" color="#000000">;</span>
<span style="color: #000000;" color="#000000">}</span>

</pre>
<p><a href="https://drive.google.com/file/d/1XHI90WJpQiNGR76nBG1bk9KtHtP0XdcU/view?usp=sharing" title="Sketch for download">Sketch zum Herunterladen</a></p>
<h3>In Betrieb nehmen</h3>
<p>Wenn der Sketch ohne Fehler kompiliert und hochgeladen wurde, startet das Programm. Da noch keine Konfigurationsdaten vorhanden sind, wird ein Accesspoint gestartet. Die SSID wird aus der MAC-Adresse des D1-Minis gebildet. Mit einem Smartphone oder einem anderen WLAN-fähigen Computer kann jetzt eine Verbindung zu diesem Accesspoint hergestellt werden. Der Zugriff ist offen, es ist also kein Passwort erforderlich. Nachdem die WLAN-Verbindung hergestellt ist, kann man im Browser die Adresse 192.168.4.1 aufrufen. Die Konfigurationsseite wird dargestellt.</p>
<p><img style="float: left; padding-right: 15px;" src="https://cdn.shopify.com/s/files/1/1509/1638/files/config_480x480.jpg?v=1638192930" alt="Screenshot for configuration"></p>
<p>Der Name des Accesspoints wird später als DNS-Name verwendet. Es folgen die Zugangsdaten zum WLAN. <br> Der Name für Alexa ist der Gerätename, der in der Alexa App verwendet werden soll.<br> Der NTP-Server wird zur Synchronisation der internen Uhr verwendet. Hier könnte z.B. auch fritz.box stehen, wenn die Fritz-Box als Zeitserver verwendet werden soll.<br> Mit der Checkbox Wasserstand anzeigen wird gesteuert, ob der aktuelle Wasserstand auf der Homepage angezeigt wird oder nicht.<br> Es folgt eine weitere Checkbox zum Aktivieren des Timers. Sollte der Timer verwendet werden, muss auch eine Einschalt- und eine Abschaltzeit gesetzt werden.<br> Mit dem Button „Save“ wird die Konfiguration im Flash-Filesystem des D1-Minis gespeichert.<br> Mit dem Button „Restart“ wird die Konfiguration ebenfalls gespeichert und dann der D1-Mini neu gestartet. <br> Die Erstkonfiguration sollte mit „Restart“ beendet werden, da sich der D1-Mini nach dem Neustart mit dem WLAN verbinden sollte. Ist die Verbindung erfolgreich, wird kein Accesspoint gestartet.<br> Es sollte jetzt möglich sein, die Homepage mit der URL <nameDesAccesspoint>.local also im dargestellten Beispiel mit Weihnachtsbaum.local  aufzurufen. Wenn Ihr Router mDNS nicht unterstützt, müssen Sie die IP-Adresse, die über den seriellen Monitor ausgegeben wurde, verwenden.</p>
<h4>Alexa aktivieren</h4>
<p>Dazu müssen Sie auf Ihrem Smartphone die Alexa App starten. Tippen Sie unten in der Symbolleiste auf Geräte und auf der jetzt erscheinenden Geräte-Seite auf das Plus Symbol rechts oben.<br> Jetzt wählen Sie Gerät hinzufügen.<br> Es erscheint die Auswahl des Geräte-Typs. Gehen Sie hier ganz nach unten und wählen Sie „Sonstiges“ aus. Auf der nächsten Seite können Sie die Gerätesuche starten. Überprüfen Sie vorher, ob der D1-Mini richtig gestartet hat und die Homepage anzeigen kann.<br> Nach einiger Zeit sollte die Alexa-App anzeigen, dass eine Lampe gefunden und verbunden wurde. Lampe wird angezeigt, da die Bibliothek eine Philips HUE Lampe emuliert.<br> Tippen Sie auf Gerät einrichten. Sie können nun das neue Gerät einer Gruppe zuordnen.<br> Zum Schluss erhalten Sie die Meldung „Weihnachtsbaum ist eingerichtet und bereit zur Verwendung“. Falls Sie einen anderen Namen konfiguriert haben, steht natürlich dieser Name und nicht „Weihnachtsbaum“ in der Meldung. <br> Nun kann die Beleuchtung mit dem Sprachbefehl “Alexa, Weihnachtsbaum ein“ eingeschaltet werden.</p>
<p><strong>Anschluss der Lichterkette</strong></p>
<p>It can be used any fairy light chain that operates a two-core connection cable and with voltages below 40V. For connection, one of the two wires is severed and the relay is interconnected. To power the D1 minis, a USB cable is required.</p>
<p><img src="https://cdn.shopify.com/s/files/1/1509/1638/files/lichterkette_neu_480x480.jpg?v=1638393192" alt="fairy lights"></p>
<p class="table-wrapper"><a href="https://drive.google.com/file/d/1MrAhnfWbVaMut_MHrnJm9CS6DR8P5ILr/view?usp=sharing">Blog post as PDF </a></p>
    </div><div class="article__aside"><div class="article__aside-item">
            <span class="article__tag-label">Tags: </span><a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/tagged/esp-8266" class="link link--accented link--underline">Esp-8266</a>, <a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/tagged/projekte-fuer-anfaenger" class="link link--accented link--underline">Projects for beginners</a>, <a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/tagged/sensoren" class="link link--accented link--underline">Sensors</a></div><div class="article__aside-item">
            <span class="article__share-label">Share</span>
            

      <ul class="social-media__item-list list--unstyled">
        <li class="social-media__item social-media__item--facebook">
          <a href="https://www.facebook.com/sharer.php?u=https://www.az-delivery.de/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/der-weihnachtsbaum-wird-smart" target="_blank" rel="noopener" aria-label="Share on Facebook"><svg class="icon icon--facebook" viewBox="0 0 30 30">
      <path d="M15 30C6.71572875 30 0 23.2842712 0 15 0 6.71572875 6.71572875 0 15 0c8.2842712 0 15 6.71572875 15 15 0 8.2842712-6.7157288 15-15 15zm3.2142857-17.1429611h-2.1428678v-2.1425646c0-.5852979.8203285-1.07160109 1.0714928-1.07160109h1.071375v-2.1428925h-2.1428678c-2.3564786 0-3.2142536 1.98610393-3.2142536 3.21449359v2.1425646h-1.0714822l.0032143 2.1528011 1.0682679-.0099086v7.499969h3.2142536v-7.499969h2.1428678v-2.1428925z" fill="currentColor" fill-rule="evenodd"></path>
    </svg></a>
        </li>

        <li class="social-media__item social-media__item--pinterest">
          <a href="https://pinterest.com/pin/create/button/?url=https://www.az-delivery.de/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/der-weihnachtsbaum-wird-smart&media=https://cdn.shopify.com/s/files/1/1509/1638/articles/SmartWeihnachtsbaum_Titelbild_en_large.png?v=1638212759&description=More%20and%20more%20devices%20are%20%22smart%22,%20why%20not%20also%20the%20Christmas%20tree.%20This%20project%20deals..." target="_blank" rel="noopener" aria-label="Pin on Pinterest"><svg class="icon icon--pinterest" role="presentation" viewBox="0 0 30 30">
      <path d="M15 30C6.71572875 30 0 23.2842712 0 15 0 6.71572875 6.71572875 0 15 0c8.2842712 0 15 6.71572875 15 15 0 8.2842712-6.7157288 15-15 15zm-.4492946-22.49876954c-.3287968.04238918-.6577148.08477836-.9865116.12714793-.619603.15784625-1.2950238.30765013-1.7959124.60980792-1.3367356.80672832-2.26284291 1.74754848-2.88355361 3.27881599-.1001431.247352-.10374313.4870343-.17702448.7625149-.47574032 1.7840923.36779138 3.6310327 1.39120339 4.2696951.1968419.1231267.6448551.3405257.8093833.0511377.0909873-.1603963.0706852-.3734014.1265202-.5593764.036883-.1231267.1532436-.3547666.1263818-.508219-.0455542-.260514-.316041-.4256572-.4299438-.635367-.230748-.4253041-.2421365-.8027267-.3541701-1.3723228.0084116-.0763633.0168405-.1527266.0253733-.2290899.0340445-.6372108.1384107-1.0968422.3287968-1.5502554.5593198-1.3317775 1.4578212-2.07273488 2.9088231-2.5163011.324591-.09899963 1.2400541-.25867013 1.7200175-.1523539.2867042.05078464.5734084.10156927.8600087.1523539 1.0390064.33760307 1.7953931.9602003 2.2007079 1.9316992.252902.6061594.3275507 1.7651044.1517724 2.5415071-.0833199.3679287-.0705641.6832289-.1770418 1.0168107-.3936666 1.2334841-.9709174 2.3763639-2.2765854 2.6942337-.8613761.2093567-1.5070793-.3321303-1.7200175-.8896824-.0589159-.1545509-.1598205-.4285603-.1011297-.6865243.2277711-1.0010987.5562045-1.8969797.8093661-2.8969995.24115-.9528838-.2166421-1.7048063-.9358863-1.8809146-.8949186-.2192233-1.585328.6350139-1.8211644 1.1943903-.1872881.4442919-.3005678 1.2641823-.1517724 1.8557085.0471811.1874265.2666617.689447.2276672.8640842-.1728187.7731269-.3685356 1.6039823-.5818373 2.3635745-.2219729.7906632-.3415527 1.5999416-.5564641 2.3639276-.098793.3507651-.0955738.7263439-.1770244 1.092821v.5337977c-.0739045.3379758-.0194367.9375444.0505042 1.2703809.0449484.2137505-.0261175.4786388.0758948.6357396.0020943.1140055.0159752.1388388.0506254.2031582.3168026-.0095136.7526829-.8673992.9106342-1.118027.3008274-.477913.5797431-.990879.8093833-1.5506281.2069844-.5042174.2391769-1.0621226.4046917-1.60104.1195798-.3894861.2889369-.843272.328918-1.2707535h.0252521c.065614.2342095.3033024.403727.4805692.5334446.5563429.4077482 1.5137774.7873678 2.5547742.5337977 1.1769151-.2868184 2.1141687-.8571599 2.7317812-1.702982.4549537-.6225776.7983583-1.3445472 1.0624066-2.1600633.1297394-.4011574.156982-.8454494.2529193-1.2711066.2405269-1.0661438-.0797199-2.3511383-.3794396-3.0497261-.9078995-2.11694836-2.8374975-3.32410832-5.918897-3.27881604z" fill="currentColor" fill-rule="evenodd"></path>
    </svg></a>
        </li>

        <li class="social-media__item social-media__item--twitter">
          <a href="https://twitter.com/share?text=The Christmas tree becomes "smart"&url=https://www.az-delivery.de/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/der-weihnachtsbaum-wird-smart" target="_blank" rel="noopener" aria-label="Tweet on Twitter"><svg class="icon icon--twitter" role="presentation" viewBox="0 0 30 30">
      <path d="M15 30C6.71572875 30 0 23.2842712 0 15 0 6.71572875 6.71572875 0 15 0c8.2842712 0 15 6.71572875 15 15 0 8.2842712-6.7157288 15-15 15zm3.4314771-20.35648929c-.134011.01468929-.2681239.02905715-.4022367.043425-.2602865.05139643-.5083383.11526429-.7319208.20275715-.9352275.36657324-1.5727317 1.05116784-1.86618 2.00016964-.1167278.3774214-.1643635 1.0083696-.0160821 1.3982464-.5276368-.0006268-1.0383364-.0756643-1.4800457-.1737-1.7415129-.3873214-2.8258768-.9100285-4.02996109-1.7609946-.35342035-.2497018-.70016357-.5329286-.981255-.8477679-.09067071-.1012178-.23357785-.1903178-.29762142-.3113357-.00537429-.0025553-.01072822-.0047893-.0161025-.0073446-.13989429.2340643-.27121822.4879125-.35394965.7752857-.32626393 1.1332446.18958607 2.0844643.73998215 2.7026518.16682678.187441.43731214.3036696.60328392.4783178h.01608215c-.12466715.041834-.34181679-.0159589-.45040179-.0360803-.25715143-.0482143-.476235-.0919607-.69177643-.1740215-.11255464-.0482142-.22521107-.09675-.3378675-.1449642-.00525214 1.251691.69448393 2.0653071 1.55247643 2.5503267.27968679.158384.67097143.3713625 1.07780893.391484-.2176789.1657285-1.14873321.0897268-1.47198429.0581143.40392643.9397285 1.02481929 1.5652607 2.09147249 1.9056375.2750861.0874928.6108975.1650857.981255.1593482-.1965482.2107446-.6162514.3825321-.8928439.528766-.57057.3017572-1.2328489.4971697-1.97873466.6450108-.2991075.0590785-.61700464.0469446-.94113107.0941946-.35834678.0520554-.73320321-.02745-1.0537875-.0364018.09657429.053325.19312822.1063286.28958036.1596536.2939775.1615821.60135.3033482.93309.4345875.59738036.2359768 1.23392786.4144661 1.93859037.5725286 1.4209286.3186642 3.4251707.175291 4.6653278-.1740215 3.4539354-.9723053 5.6357529-3.2426035 6.459179-6.586425.1416246-.5754053.162226-1.2283875.1527803-1.9126768.1716718-.1232517.3432215-.2465035.5148729-.3697553.4251996-.3074947.8236703-.7363286 1.118055-1.1591036v-.00765c-.5604729.1583679-1.1506672.4499036-1.8661597.4566054v-.0070232c.1397925-.0495.250515-.1545429.3619908-.2321358.5021089-.3493285.8288003-.8100964 1.0697678-1.39826246-.1366982.06769286-.2734778.13506429-.4101761.20275716-.4218407.1938214-1.1381067.4719375-1.689256.5144143-.6491893-.5345357-1.3289754-.95506074-2.6061215-.93461789z" fill="currentColor" fill-rule="evenodd"></path>
    </svg></a>
        </li>

        <li class="social-media__item">
          <a href="mailto:?&subject=The Christmas tree becomes "smart"&body=https://www.az-delivery.de/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/der-weihnachtsbaum-wird-smart" aria-label="Share by email"><svg class="icon icon--email" role="presentation" viewBox="0 0 28 28">
      <path d="M14 28C6.2680135 28 0 21.7319865 0 14S6.2680135 0 14 0s14 6.2680135 14 14-6.2680135 14-14 14zm-3.2379501-18h6.4759002L14 12.6982917 10.7620499 10zM19 11.1350416V18H9v-6.8649584l5 4.1666667 5-4.1666667zM21 8H7v12h14V8z"></path>
    </svg></a>
        </li>
      </ul>
          </div></div><div class="article__navigation "><a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/peltierelemente-und-micropython-teil-5-touchdisplay-wir-sprechen-mit-unserem-kuhlschank" class="article__navigation-item article__navigation-item--prev text--strong link" rel="prev"><svg class="icon icon--arrow-left" viewBox="0 0 8 12" role="presentation">
      <path stroke="currentColor" stroke-width="2" d="M6 10L2 6l4-4" fill="none" stroke-linecap="square"></path>
    </svg>Previous article</a><a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/kennen-sie-eia-485-und-dmx-512-teil-2" class="article__navigation-item article__navigation-item--next text--strong link" rel="next">Next article<svg class="icon icon--arrow-right" viewBox="0 0 8 12" role="presentation">
      <path stroke="currentColor" stroke-width="2" d="M2 2l4 4-4 4" fill="none" stroke-linecap="square"></path>
    </svg></a></div><span id="comments" class="anchor"></span><div class="article__comment-list">
          <p class="article__comment-list-heading heading h2">1 comment</p><div class="article-comment"><img class="article-comment__gravatar" src="//www.gravatar.com/avatar/f21c27aadf742a3b6dff4e6a9b551865?s=100" alt="Jochen"><div class="article-comment__inner">
                  <p class="article-comment__author text--strong">Jochen</p>
                  <time class="article-comment__date">January 10, 2022 at 10:30am</time>

                  <div class="article-comment__content rte"><p>Hallo zusammen,</p>
<p>zugegeben, Adventszeit ist rum, Weihnachtsbaum schon wieder weg, aber dennoch:<br>
Ich habe versucht das Teil nachzubauen, ist ja “eigentlich” kein Hexenwerk, leider versagt der am wenigsten durchsichtige Step:<br>
Das Hinzufügen zur AlexaApp funktioniert nicht. Selbst wenn ich in der FauxmoESp die Debugs anmache, sehe ich, dass Interaktion mit dem Device stattfindet. Die App meldet aber immer, dass kein Device gefunden wurde…<br>
Hab ich was übersehen?</p>
<p>Danke und Grüße<br>
Jochen</p></div>
                </div>
              </div></div><form method="post" action="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/der-weihnachtsbaum-wird-smart/comments#comment_form" id="comment_form" accept-charset="UTF-8" class="article__comment-form form"><input type="hidden" name="form_type" value="new_comment" /><input type="hidden" name="utf8" value="✓" /><p class="article__comment-form-title heading h2">Leave a comment</p><p class="article__moderated-note">All comments are moderated before being published</p><div class="article__comment-form-wrapper"><div class="form__input-row">
            <div class="form__input-wrapper form__input-wrapper--labelled"><input id="comment-form-name" type="text" class="form__field form__field--text " name="comment[author]" value="" required="required">
              <label for="comment-form-name" class="form__floating-label">Name</label>
            </div>

            <div class="form__input-wrapper form__input-wrapper--labelled"><input id="comment-form-email" type="email" class="form__field form__field--text " name="comment[email]" value="" required="required">
              <label for="comment-form-email" class="form__floating-label">Email</label>
            </div>
          </div>

          <div class="form__input-wrapper form__input-wrapper--labelled">
            <textarea id="comment-form-body" name="comment[body]" rows="5" class="form__field form__field--textarea " required="required"></textarea>
            <label for="comment-form-body" class="form__floating-label">Content</label>
          </div>

          <button type="submit" class="form__submit button button--primary button--min-width">Post comment</button>
        </div></form></div>
</article>

<script>
  // Due to the presence of the possible sidebar, we have to move the header outside the section
  document.querySelector('.blog-container').insertAdjacentElement('beforebegin', document.querySelector('#shopify-section-' + "article-template" + ' .page__header'));
</script>

</div>
    <div id="shopify-section-blog-sidebar" class="shopify-section shopify-section__blog-sidebar"><section class="blog-sidebar hidden-tablet" data-section-id="blog-sidebar" data-section-type="blog-sidebar"><div class="blog-sidebar__item blog-sidebar__item--newsletter" id="block-blog-sidebar-0" >
            <style>
              #block-blog-sidebar-0 {
                background: #dedede;
                color: #2b323f;
              }
            </style><h2 class="heading h3">Stay up to date</h2><div class="rte">
                <p>Find out immediately when we present a new exciting project or have unbeatable offers!</p>
              </div><div class="newsletter newsletter--compact"><form method="post" action="/contact#newsletter-blog-sidebar-0" id="newsletter-blog-sidebar-0" accept-charset="UTF-8" class="form newsletter__form"><input type="hidden" name="form_type" value="customer" /><input type="hidden" name="utf8" value="✓" /><input type="hidden" name="contact[tags]" value="newsletter">

                  <div class="form__input-wrapper form__input-wrapper--labelled">
                    <input type="email" name="contact[email]" class="form__field form__field--text form__field--borderless" aria-label="Your email" required>
                    <label for="newsletter[contact][email]" class="form__floating-label">Your email</label>
                  </div>

                  <button type="submit" class="form__submit form__submit--tight button button--primary button--full">Subscribe</button></form><p class="newsletter__text">100% free, unsubscribeable at any time!</p></div>
          </div><div class="blog-sidebar__item blog-sidebar__item--posts" id="block-1582140796881" ><p class="blog-sidebar__block-title heading h3">Recommended blog posts</p><ol class="blog-sidebar__post-list blog-sidebar__post-list--ranked"><li class="blog-sidebar__post-item"><a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/esp32-jetzt-mit-boardverwalter-installieren" class="blog-sidebar__post-image-wrapper">
                        <div class="blog-sidebar__post-image-overflow">
                          <img src="//cdn.shopify.com/s/files/1/1509/1638/articles/install_esp32_with_board_manager_banner_37a71c40-32dc-4873-a69d-6b99416f60df_100x80_crop_center@2x.png?v=1563479758" alt="Install ESP32 now from the board manager" class="blog-sidebar__post-image">
                        </div>
                      </a><div class="blog-sidebar__post-info">
                      <a class="blog-sidebar__post-title text--strong link" href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/esp32-jetzt-mit-boardverwalter-installieren">Install ESP32 now via the board administrator</a><div class="blog-sidebar__post-meta"><span class="blog-sidebar__post-meta-item">ESP-32</span><span class="blog-sidebar__post-meta-item">Aug 07, 2018</span></div></div>
                  </li><li class="blog-sidebar__post-item"><a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/lueftersteuerung-raspberry" class="blog-sidebar__post-image-wrapper">
                        <div class="blog-sidebar__post-image-overflow">
                          <img src="//cdn.shopify.com/s/files/1/1509/1638/articles/L.Rasp1fin_100x80_crop_center@2x.jpg?v=1589700269" alt="Lüftersteuerung Raspberry Pi" class="blog-sidebar__post-image">
                        </div>
                      </a><div class="blog-sidebar__post-info">
                      <a class="blog-sidebar__post-title text--strong link" href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/lueftersteuerung-raspberry">Lüftersteuerung Raspberry Pi</a><div class="blog-sidebar__post-meta"><span class="blog-sidebar__post-meta-item">Projekte für Anfänger</span><span class="blog-sidebar__post-meta-item">May 23, 2020</span></div></div>
                  </li><li class="blog-sidebar__post-item"><a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/arduino-ide-programmieren-fuer-einsteiger-teil-1" class="blog-sidebar__post-image-wrapper">
                        <div class="blog-sidebar__post-image-overflow">
                          <img src="//cdn.shopify.com/s/files/1/1509/1638/articles/01_Arduino_IDE_Startscreen_grande_4615d778-6a79-4a88-847f-390a572d1dee_100x80_crop_center@2x.jpg?v=1584055160" alt="Arduino IDE - Programmieren für Einsteiger - Teil 1" class="blog-sidebar__post-image">
                        </div>
                      </a><div class="blog-sidebar__post-info">
                      <a class="blog-sidebar__post-title text--strong link" href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/arduino-ide-programmieren-fuer-einsteiger-teil-1">Arduino IDE - Programmieren für Einsteiger - Teil 1</a><div class="blog-sidebar__post-meta"><span class="blog-sidebar__post-meta-item">Grundlagen Software</span><span class="blog-sidebar__post-meta-item">Mar 13, 2020</span></div></div>
                  </li><li class="blog-sidebar__post-item"><a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/esp32-das-multitalent" class="blog-sidebar__post-image-wrapper">
                        <div class="blog-sidebar__post-image-overflow">
                          <img src="//cdn.shopify.com/s/files/1/1509/1638/articles/ESP32_1fin_100x80_crop_center@2x.jpg?v=1597062499" alt="ESP32 - das Multitalent" class="blog-sidebar__post-image">
                        </div>
                      </a><div class="blog-sidebar__post-info">
                      <a class="blog-sidebar__post-title text--strong link" href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/esp32-das-multitalent">ESP32 - das Multitalent</a><div class="blog-sidebar__post-meta"><span class="blog-sidebar__post-meta-item">ESP-32</span><span class="blog-sidebar__post-meta-item">Aug 14, 2020</span></div></div>
                  </li><li class="blog-sidebar__post-item"><a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/ota-over-the-air-esp-programmieren-uber-wlan-entwurf" class="blog-sidebar__post-image-wrapper">
                        <div class="blog-sidebar__post-image-overflow">
                          <img src="//cdn.shopify.com/s/files/1/1509/1638/articles/OTA-wireless_banner_c6ecb9bf-ef6a-429e-8820-82f39e1a5b04_100x80_crop_center@2x.png?v=1563480570" alt="OTA - Over the Air - ESP programming via WLAN" class="blog-sidebar__post-image">
                        </div>
                      </a><div class="blog-sidebar__post-info">
                      <a class="blog-sidebar__post-title text--strong link" href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/ota-over-the-air-esp-programmieren-uber-wlan-entwurf">OTA - Over the Air - ESP Programming over Wi-Fi</a><div class="blog-sidebar__post-meta"><span class="blog-sidebar__post-meta-item">Grundlagen Software</span><span class="blog-sidebar__post-meta-item">Mar 30, 2018</span></div></div>
                  </li></ol>
          </div><div class="blog-sidebar__item blog-sidebar__item--products" id="block-1582140848546" ><p class="blog-sidebar__block-title heading h3">Recommended products</p><div class="product-list product-list--horizontal"><div class="product-item product-item--horizontal product-item--compact "><a href="/products/0-96zolldisplay" class="product-item__image-wrapper product-item__image-wrapper--with-secondary">

      <div class="aspect-ratio " style="padding-bottom: 100.0%">
        <img class="product-item__primary-image lazyload image--blur-up" src="//cdn.shopify.com/s/files/1/1509/1638/products/1.Main_1x_0_96ZollI2COLEDDisplay1_60x.jpg?v=1614789017" data-image-id="27934789730400" data-src="//cdn.shopify.com/s/files/1/1509/1638/products/1.Main_1x_0_96ZollI2COLEDDisplay1_{width}x.jpg?v=1614789017" data-sizes="auto" data-widths="[200,300,400,500,600,700,800]" alt="0,96 Zoll OLED SSD1306 Display I2C 128 x 64 Pixel kompatibel mit Arduino und Raspberry Pi">

          <img class="product-item__secondary-image lazyload image--blur-up" src="//cdn.shopify.com/s/files/1/1509/1638/products/0_96_Zoll_I2C_OLED_Display_front_60x.jpg?v=1581095648" data-src="//cdn.shopify.com/s/files/1/1509/1638/products/0_96_Zoll_I2C_OLED_Display_front_{width}x.jpg?v=1581095648" data-sizes="auto" data-widths="[200,300,400,500,600,700,800]" alt="0.96 inch OLED I2C Display 128 x 64 Pixels for Arduino and Raspberry Pi Display AZ Delivery "><noscript>
          <img src="//cdn.shopify.com/s/files/1/1509/1638/products/1.Main_1x_0_96ZollI2COLEDDisplay1_600x.jpg?v=1614789017" alt="0,96 Zoll OLED SSD1306 Display I2C 128 x 64 Pixel kompatibel mit Arduino und Raspberry Pi">
        </noscript>
      </div>
    </a><div class="product-item__info">
    <div class="product-item__info-inner"><a class="product-item__vendor link" href="/collections/vendors?q=AZ-Delivery">AZ-Delivery</a>
<a href="/products/0-96zolldisplay" class="product-item__title text--strong link">0,96 Zoll OLED I2C Display 128 x 64 pixels compatible with Arduino and Raspberry Pi</a><div class="product-item__price-list price-list"><span class="price">From <span data-money-convertible>£6</span></span></div>
<a class="product-item__reviews-badge link" href="/products/0-96zolldisplay#product-reviews">
          <span class="shopify-product-reviews-badge" data-id="7893742857"><div class="spr-badge" style="opacity: 100">
              <span class="spr-starrating spr-badge-starrating">
                
              </span>
            </div>
          </span>
        </a><span class="product-item__inventory inventory inventory--high">In stock</span></div></div>
</div>
<div class="product-item product-item--horizontal product-item--compact "><div class="product-item__label-list"><span class="product-label product-label--on-sale">Save <span data-money-convertible>£31</span></span></div><a href="/products/16-in-1-kit-zubehorset-fur-raspberry-pi-arduino-und-andere-mikrocontroller" class="product-item__image-wrapper product-item__image-wrapper--with-secondary">

      <div class="aspect-ratio " style="padding-bottom: 100.0%">
        <img class="product-item__primary-image lazyload image--blur-up" src="//cdn.shopify.com/s/files/1/1509/1638/products/1.Main_1x_16in1Kit-ZubehorsetfurRaspberryPi-Arduino_60x.jpg?v=1632480180" data-image-id="27947243241568" data-src="//cdn.shopify.com/s/files/1/1509/1638/products/1.Main_1x_16in1Kit-ZubehorsetfurRaspberryPi-Arduino_{width}x.jpg?v=1632480180" data-sizes="auto" data-widths="[200,300,400,500,600,700,800]" alt="16 in 1 Kit Zubehörset mit Sensoren und Modulen für Raspberry Pi kompatibel mit Arduino">

          <img class="product-item__secondary-image lazyload image--blur-up" src="//cdn.shopify.com/s/files/1/1509/1638/products/2.Front_59cf0350-a8ac-4991-a650-eeafc3537644_60x.jpg?v=1632480186" data-src="//cdn.shopify.com/s/files/1/1509/1638/products/2.Front_59cf0350-a8ac-4991-a650-eeafc3537644_{width}x.jpg?v=1632480186" data-sizes="auto" data-widths="[200,300,400,500,600,700,800]" alt="16 in 1 Kit Zubehörset mit Sensoren und Modulen für Raspberry Pi kompatibel mit Arduino"><noscript>
          <img src="//cdn.shopify.com/s/files/1/1509/1638/products/1.Main_1x_16in1Kit-ZubehorsetfurRaspberryPi-Arduino_600x.jpg?v=1632480180" alt="16 in 1 Kit Zubehörset mit Sensoren und Modulen für Raspberry Pi kompatibel mit Arduino">
        </noscript>
      </div>
    </a><div class="product-item__info">
    <div class="product-item__info-inner"><a class="product-item__vendor link" href="/collections/vendors?q=AZ-Delivery">AZ-Delivery</a>
<a href="/products/16-in-1-kit-zubehorset-fur-raspberry-pi-arduino-und-andere-mikrocontroller" class="product-item__title text--strong link">16 in 1 kit accessory set with sensors and modules compatible with Arduino and Raspberry Pi</a><div class="product-item__price-list price-list"><span class="price price--highlight">From <span data-money-convertible>£16</span></span>
              <span class="price price--compare" data-money-convertible>£47</span></div>
<a class="product-item__reviews-badge link" href="/products/16-in-1-kit-zubehorset-fur-raspberry-pi-arduino-und-andere-mikrocontroller#product-reviews">
          <span class="shopify-product-reviews-badge" data-id="9786551762"><div class="spr-badge" style="opacity: 100">
              <span class="spr-starrating spr-badge-starrating">
                
              </span>
            </div>
          </span>
        </a><span class="product-item__inventory inventory inventory--high">In stock</span></div></div>
</div>
<div class="product-item product-item--horizontal product-item--compact "><a href="/products/d1-mini" class="product-item__image-wrapper product-item__image-wrapper--with-secondary">

      <div class="aspect-ratio " style="padding-bottom: 100.0%">
        <img class="product-item__primary-image lazyload image--blur-up" src="//cdn.shopify.com/s/files/1/1509/1638/products/1.Main_1x_D1Minix3V1_60x.jpg?v=1604069387" data-image-id="17190376570976" data-src="//cdn.shopify.com/s/files/1/1509/1638/products/1.Main_1x_D1Minix3V1_{width}x.jpg?v=1604069387" data-sizes="auto" data-widths="[200,300,400,500,600,700,800]" alt="D1 Mini NodeMcu mit ESP8266-12F WLAN Modul">

          <img class="product-item__secondary-image lazyload image--blur-up" src="//cdn.shopify.com/s/files/1/1509/1638/products/2.FrontChangedWOlOGO_60x.jpg?v=1604070856" data-src="//cdn.shopify.com/s/files/1/1509/1638/products/2.FrontChangedWOlOGO_{width}x.jpg?v=1604070856" data-sizes="auto" data-widths="[200,300,400,500,600,700,800]" alt="D1 Mini NodeMcu mit ESP8266-12F WLAN Modul"><noscript>
          <img src="//cdn.shopify.com/s/files/1/1509/1638/products/1.Main_1x_D1Minix3V1_600x.jpg?v=1604069387" alt="D1 Mini NodeMcu mit ESP8266-12F WLAN Modul">
        </noscript>
      </div>
    </a><div class="product-item__info">
    <div class="product-item__info-inner"><a class="product-item__vendor link" href="/collections/vendors?q=AZ-Delivery">AZ-Delivery</a>
<a href="/products/d1-mini" class="product-item__title text--strong link">D1 Mini NodeMcu with ESP8266-12F WLAN module compatible with Arduino</a><div class="product-item__price-list price-list"><span class="price">From <span data-money-convertible>£6</span></span></div>
<a class="product-item__reviews-badge link" href="/products/d1-mini#product-reviews">
          <span class="shopify-product-reviews-badge" data-id="8669794130"><div class="spr-badge" style="opacity: 100">
              <span class="spr-starrating spr-badge-starrating">
                
              </span>
            </div>
          </span>
        </a><span class="product-item__inventory inventory inventory--high">In stock</span></div></div>
</div>
</div>
          </div><div class="blog-sidebar__item blog-sidebar__item--menu" id="block-1582140959285" ><p class="blog-sidebar__block-title heading h3">Main menu</p>

              <ul class="blog-sidebar__linklist"><li class="blog-sidebar__link-item">
                    <a href="#" class="text--strong link">All categories</a>
                  </li><li class="blog-sidebar__link-item">
                    <a href="/collections/az-sale" class="text--strong link">Offers</a>
                  </li><li class="blog-sidebar__link-item">
                    <a href="/collections/kostenlose-e-books" class="text--strong link">Free eBooks </a>
                  </li><li class="blog-sidebar__link-item">
                    <a href="/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi" class="text--strong link">Blog</a>
                  </li><li class="blog-sidebar__link-item">
                    <a href="/pages/faq-hilfe" class="text--strong link">Help</a>
                  </li><li class="blog-sidebar__link-item">
                    <a href="/collections/informatik-grundlagenbucher" class="text--strong link">Computer Science Books</a>
                  </li></ul></div></section></div>
  </div>
</div>
    </main><div id="shopify-section-static-newsletter" class="shopify-section shopify-section--isolated"><section class="section section--isolated section--tight section--text-centered" data-section-id="static-newsletter" data-section-type="newsletter">
    <div class="container container--giga-narrow"><h2 class="heading h3">The best offer and news!</h2><div class="rte">
          <p>Always be the first to learn when a new interesting project is presented. We will also inform you immediately if products are on offer at an unbeatable price! Don't miss any more e-mail and sign in now.</p>
        </div><div class="newsletter"><form method="post" action="/contact#newsletter-static-newsletter" id="newsletter-static-newsletter" accept-charset="UTF-8" class="form newsletter__form"><input type="hidden" name="form_type" value="customer" /><input type="hidden" name="utf8" value="✓" /><input type="hidden" name="contact[tags]" value="newsletter">

            <div class="form__input-row">
              <div class="form__input-wrapper form__input-wrapper--labelled">
                <input type="email" id="newsletter[contact][email]" name="contact[email]" class="form__field form__field--text form__field--borderless" required>
                <label for="newsletter[contact][email]" class="form__floating-label">Your email</label>
              </div>

              <button type="submit" class="form__submit button button--primary">Subscribe</button>
            </div></form><p class="newsletter__text">100% free. No spam. You can unsubscribe any time.</p></div>
    </div>
  </section>

  <style>
    #shopify-section-static-newsletter {
      background: #2b323f;
      color: #ffffff;
    }
  </style></div>
<div id="shopify-section-text-with-icons" class="shopify-section"><section class="section section--tight" data-section-id="text-with-icons" data-section-type="text-with-icons">
    <div class="container container--flush">
      <div class="text-with-icons text-with-icons--stacked"><div class="text-with-icons__item" data-block-index="0" >
            <div class="text-with-icons__icon-wrapper"><svg viewBox="0 0 24 24" role="presentation">
      <g stroke-width="1.5" fill="none" fill-rule="evenodd">
        <path d="M6.5 3.25l12 6" stroke="#2b323f"></path>
        <path stroke="#2b323f" d="M23 7l-10 5L1 6M13 12v11"></path>
        <path stroke="#2b323f" stroke-linecap="square" d="M23 7v10l-10 6-12-6V6l10-5z"></path>
      </g>
    </svg></div><div class="text-with-icons__content-wrapper"><p class="text-with-icons__title text--strong">Free delivery from EUR 15</p><div class="text-with-icons__content rte">
                    <p>Order more than 15€, we cover the shipping costs across the EU!</p>
                  </div></div></div><div class="text-with-icons__item" data-block-index="1" >
            <div class="text-with-icons__icon-wrapper"><svg viewBox="0 0 23 24" role="presentation">
      <g transform="translate(1 1)" stroke-width="1.5" fill="none" fill-rule="evenodd">
        <path stroke="#2b323f" d="M8 4h8v7"></path>
        <path stroke="#2b323f" stroke-linecap="square" d="M11 7L8 4l3-3"></path>
        <circle stroke="#2b323f" stroke-linecap="square" cx="6" cy="20" r="2"></circle>
        <circle stroke="#2b323f" stroke-linecap="square" cx="18" cy="20" r="2"></circle>
        <path stroke="#2b323f" stroke-linecap="square" d="M21 5l-2 10H5L3 0H0"></path>
      </g>
    </svg></div><div class="text-with-icons__content-wrapper"><p class="text-with-icons__title text--strong">Satisfaction</p><div class="text-with-icons__content rte">
                    <p>You're not satisfied? Contact us, describe your situation and we will refund your order in most cases!</p>
                  </div></div></div><div class="text-with-icons__item" data-block-index="2" >
            <div class="text-with-icons__icon-wrapper"><svg viewBox="0 0 24 24" role="presentation">
      <g stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="square">
        <path d="M10 17H4c-1.7 0-3 1.3-3 3v3h12v-3c0-1.7-1.3-3-3-3zM7 14c-1.7 0-3-1.3-3-3v-1c0-1.7 1.3-3 3-3s3 1.3 3 3v1c0 1.7-1.3 3-3 3z" stroke="#2b323f"></path>
        <path stroke="#2b323f" d="M13 1v10l4-3h6V1z"></path>
      </g>
    </svg></div><div class="text-with-icons__content-wrapper"><p class="text-with-icons__title text--strong">Free customer service</p><div class="text-with-icons__content rte">
                    <p>Write us an email and our customer service is at your disposal!</p>
                  </div></div></div><div class="text-with-icons__item" data-block-index="3" >
            <div class="text-with-icons__icon-wrapper"><svg viewBox="0 0 24 24" role="presentation">
      <g stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="square">
        <path d="M1 5h22M1 9h22M9 17H3c-1.105 0-2-.895-2-2V3c0-1.105.895-2 2-2h18c1.105 0 2 .895 2 2v10M5 13h5" stroke="#2b323f"></path>
        <path stroke="#2b323f" d="M13 16h8v7h-8zM15 16v-2c0-1.1.9-2 2-2s2 .9 2 2v2M17 19v1"></path>
      </g>
    </svg></div><div class="text-with-icons__content-wrapper"><p class="text-with-icons__title text--strong">Safe payment method</p><div class="text-with-icons__content rte">
                    <p>Pay with familiar providers in an encrypted checkout!</p>
                  </div></div></div></div>
    </div>
  </section></div>
    <div id="shopify-section-footer" class="shopify-section"><footer class="footer" data-section-id="footer" data-section-type="footer" role="contentinfo">
  <div class="container">
    <div class="footer__wrapper"><div class="footer__block-list"><div class="footer__block-item footer__block-item--links" >
                    <button class="footer__title heading h6" disabled aria-expanded="false" aria-controls="block-footer-1" data-action="toggle-collapsible">
                      <span>Über AZ-Delivery</span>
                      <span class="plus-button"></span>
                    </button>

                    <div id="block-footer-1" class="footer__collapsible">
                      <div class="footer__collapsible-content">
                        <ul class="footer__linklist list--unstyled"><li>
                              <a href="/pages/wer-wir-sind" class="footer__link-item link">who we are</a>
                            </li><li>
                              <a href="https://www.az-delivery.de/pages/karriere-bei-az-delivery" class="footer__link-item link">Career</a>
                            </li><li>
                              <a href="/pages/agb" class="footer__link-item link">Our Terms</a>
                            </li><li>
                              <a href="/pages/about-us" class="footer__link-item link">Imprint</a>
                            </li><li>
                              <a href="/pages/datenschutzerklarung-gemass-dsgvo" class="footer__link-item link">Privacy Policy in accordance with GDPR</a>
                            </li><li>
                              <a href="/pages/widerrufsrecht" class="footer__link-item link">Withdrawal</a>
                            </li><li>
                              <a href="/pages/versandinformation" class="footer__link-item link">Shipping information</a>
                            </li></ul>
                      </div>
                    </div>
                  </div><div class="footer__block-item footer__block-item--text" >
                  <button class="footer__title heading h6" disabled aria-expanded="false" aria-controls="block-1582288259362" data-action="toggle-collapsible">
                    <span>Payment methods</span>
                    <span class="plus-button"></span>
                  </button>

                  <div id="block-1582288259362" class="footer__collapsible">
                    <div class="footer__collapsible-content">
                      <div class="rte">
                        <p>PayPal.<br/>Show<br/>MasterCard<br/>American Express<br/>Immediate<br/>SEPA Directory<br/>Purchase on account (Klarna)<br/>PayPal Rate payment</p>
                      </div>
                    </div>
                  </div>
                </div><div class="footer__block-item footer__block-item--text" >
                  <button class="footer__title heading h6" disabled aria-expanded="false" aria-controls="block-1582288320463" data-action="toggle-collapsible">
                    <span>Shipping</span>
                    <span class="plus-button"></span>
                  </button>

                  <div id="block-1582288320463" class="footer__collapsible">
                    <div class="footer__collapsible-content">
                      <div class="rte">
                        <p>DHL<br/>DHL Express<br/>German Post Office<br/>UPS<br/>UPS Express<br/>DPD</p>
                      </div>
                    </div>
                  </div>
                </div><div class="footer__block-item footer__block-item--links" >
                    <button class="footer__title heading h6" disabled aria-expanded="false" aria-controls="block-1582288472543" data-action="toggle-collapsible">
                      <span>Wir helfen Ihnen</span>
                      <span class="plus-button"></span>
                    </button>

                    <div id="block-1582288472543" class="footer__collapsible">
                      <div class="footer__collapsible-content">
                        <ul class="footer__linklist list--unstyled"><li>
                              <a href="/pages/faq-hilfe" class="footer__link-item link">FAQ & Hilfe</a>
                            </li><li>
                              <a href="/pages/fragen-zur-bestellung" class="footer__link-item link">Questions about ordering</a>
                            </li><li>
                              <a href="/pages/technische-fragen" class="footer__link-item link">Technical questions</a>
                            </li><li>
                              <a href="/pages/b2b-anfragen" class="footer__link-item link">B2B inquiries</a>
                            </li><li>
                              <a href="/pages/schulen-und-universitaten" class="footer__link-item link">Schools and universities</a>
                            </li><li>
                              <a href="/pages/about-us" class="footer__link-item link">Telefon: 0991/99927827</a>
                            </li><li>
                              <a href="mailto:info@az-delivery.com" class="footer__link-item link">info@az-delivery.com</a>
                            </li></ul>
                      </div>
                    </div>
                  </div></div><aside class="footer__aside">
        <div class="footer__aside-item footer__aside-item--copyright">
          <p>© AZ-Delivery<br>Powered by Shopify</p>
        </div><div class="footer__aside-item footer__aside-item--payment">
            <p class="footer__aside-title">We Accept</p>

            <div class="payment-list">
              
                <svg class="payment-list__item" xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 38 24" width="38" height="24" aria-labelledby="pi-american_express"><title id="pi-american_express">American Express

              
                Apple Pay

              
                Google Pay

              
                Klarna
              
                Maestro
              
                Mastercard
              
                PayPal
              
                Shop Pay
              
                SOFORT
              
                Visa