Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Commit

Permalink
Adding OTA
Browse files Browse the repository at this point in the history
  • Loading branch information
bram2202 committed Apr 28, 2021
1 parent 237c707 commit 983c61a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions esp8266-dsmr.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <ESP8266HTTPClient.h>
#include <WiFiUdp.h>
#include "MQTTPublisher.h"
#include <ArduinoOTA.h>
#include "WifiConnector.h"
#include "ESP8266mDNS.h"
#include "Settings.h"
Expand Down Expand Up @@ -81,13 +82,19 @@ void setup()
// Setup MQTT
mqttPublisher = MQTTPublisher();
mqttPublisher.start();

// Setup OTA
ArduinoOTA.setHostname(WIFI_HOSTNAME);
ArduinoOTA.begin();
}

void loop()
{

wifiConnector.handle();
yield();
ArduinoOTA.handle();
yield();
mqttPublisher.handle();
yield();

Expand Down

0 comments on commit 983c61a

Please sign in to comment.