Initial code

This commit is contained in:
starcalc 2022-08-30 17:34:15 +02:00
parent e5fef6df23
commit b2173aba39
3 changed files with 45 additions and 4 deletions

16
data/homie/config.json Normal file
View File

@ -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
}
}

View File

@ -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

View File

@ -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();
} }