From 237c707aed7a4f051e6b6380d17f9486145a2d56 Mon Sep 17 00:00:00 2001
From: Bram van Deventer <6704538+bram2202@users.noreply.github.com>
Date: Wed, 28 Apr 2021 21:22:41 +0200
Subject: [PATCH 1/2] Add Arduino core dep.
Adding Arduino core dependency
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6ba8631..ccacd00 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@ The code should work on DSRM v2.2 and higher, only tested on V4.2.
## Requirements
* 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)
@@ -120,4 +121,4 @@ Connecting to the DSMR witn a RJ11 in Port 1 (P1), found on most smart meters.
- If the level shifter inverter is connected, it's impossible to flash the firmware.
Pin RX is used, disconnect the pin to flash new firmware.
- Some DSMR cannot deliver enough power to run the Wemos stably.
-Connect a 5V usb supply to fix this.
\ No newline at end of file
+Connect a 5V usb supply to fix this.
From 983c61ac016ff5dcef9728becbee565ecb3685c3 Mon Sep 17 00:00:00 2001
From: Bram van Deventer
Date: Wed, 28 Apr 2021 22:17:31 +0200
Subject: [PATCH 2/2] 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();