Initial code
This commit is contained in:
parent
e5fef6df23
commit
b2173aba39
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"name": "HOSTNAME",
|
||||||
|
"device_id": "HOSTNAME",
|
||||||
|
"wifi": {
|
||||||
|
"ssid": "WIFISSID",
|
||||||
|
"password": "WIFIPASS"
|
||||||
|
},
|
||||||
|
"mqtt": {
|
||||||
|
"host": "raum.ctdo.de",
|
||||||
|
"port": 1883,
|
||||||
|
"auth": false
|
||||||
|
},
|
||||||
|
"ota": {
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,3 +12,8 @@
|
||||||
platform = espressif8266
|
platform = espressif8266
|
||||||
board = d1_mini
|
board = d1_mini
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
lib_deps =
|
||||||
|
https://github.com/homieiot/homie-esp8266
|
||||||
|
# bblanchon/ArduinoJson
|
||||||
|
upload_speed = 1500000
|
||||||
|
monitor_speed = 115200
|
26
src/main.cpp
26
src/main.cpp
|
@ -1,9 +1,29 @@
|
||||||
#include <Arduino.h>
|
#include <Homie.h>
|
||||||
|
#include <ArduinoOTA.h>
|
||||||
|
|
||||||
|
//D4 auf ground macht led leuchten
|
||||||
|
|
||||||
|
#define PIN_LED D4
|
||||||
|
|
||||||
|
HomieNode knobNode("blinky", "blinky", "commands");
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// put your setup code here, to run once:
|
Serial.begin(115200);
|
||||||
|
Serial << endl << endl;
|
||||||
|
|
||||||
|
pinMode(PIN_LED, OUTPUT);
|
||||||
|
|
||||||
|
Homie_setFirmware("blinky", "0.1.0");
|
||||||
|
|
||||||
|
Homie.setup();
|
||||||
|
ArduinoOTA.setHostname(Homie.getConfiguration().deviceId);
|
||||||
|
ArduinoOTA.onStart([]() {
|
||||||
|
Homie.getLogger() << "Arduino OTA angefragt" << endl;
|
||||||
|
});
|
||||||
|
ArduinoOTA.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// put your main code here, to run repeatedly:
|
Homie.loop();
|
||||||
|
ArduinoOTA.handle();
|
||||||
}
|
}
|
Loading…
Reference in New Issue