From 983c61ac016ff5dcef9728becbee565ecb3685c3 Mon Sep 17 00:00:00 2001 From: Bram van Deventer Date: Wed, 28 Apr 2021 22:17:31 +0200 Subject: [PATCH] Adding OTA --- README.md | 6 ++---- esp8266-dsmr.ino | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ccacd00..bf6da32 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,14 @@ The code should work on DSRM v2.2 and higher, only tested on V4.2. ![esp8266-dsmr](https://github.com/bram2202/esp8266-dsmr/blob/master/docs/esp8266-dsmr.jpg "esp8266-dsmr") ## Requirements +* Arduino IDE * ESP8266 (Wemos/LOLIN D1 mini/ESP01/NodeMCU) * Basic soldering and wiring skills -* Arduino core for ESP8266 WiFi chip [[link]](https://github.com/esp8266/Arduino) * (For Wemos d1 mini) CH340G driver [[link]](https://wiki.wemos.cc/downloads) -* Arduino IDE -* Hardware package for arduino [[LINK]](https://github.com/esp8266/Arduino) ## Library dependencies - [PubSubClient](https://pubsubclient.knolleary.net) - MQTT client -- [WifiManager](https://github.com/esp8266/Arduino) - Wifi client +- [Arduino core](https://github.com/esp8266/Arduino) - Arduino core for ESP8266 WiFi chip ## Supported messages diff --git a/esp8266-dsmr.ino b/esp8266-dsmr.ino index 5cc2151..78c4252 100644 --- a/esp8266-dsmr.ino +++ b/esp8266-dsmr.ino @@ -3,6 +3,7 @@ #include #include #include "MQTTPublisher.h" +#include #include "WifiConnector.h" #include "ESP8266mDNS.h" #include "Settings.h" @@ -81,6 +82,10 @@ void setup() // Setup MQTT mqttPublisher = MQTTPublisher(); mqttPublisher.start(); + + // Setup OTA + ArduinoOTA.setHostname(WIFI_HOSTNAME); + ArduinoOTA.begin(); } void loop() @@ -88,6 +93,8 @@ void loop() wifiConnector.handle(); yield(); + ArduinoOTA.handle(); + yield(); mqttPublisher.handle(); yield();