mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
Added extra backup for updates
This commit is contained in:
@@ -322,13 +322,17 @@ void MyESP::_OTACallback() {
|
||||
(_ota_callback)(); // call custom function to handle mqtt receives
|
||||
}
|
||||
}
|
||||
|
||||
ESP8266WebServer httpServer(80);
|
||||
ESP8266HTTPUpdateServer httpUpdater;
|
||||
// OTA Setup
|
||||
void MyESP::_ota_setup() {
|
||||
if (!_wifi_ssid) {
|
||||
return;
|
||||
}
|
||||
|
||||
MDNS.begin(_app_hostname);
|
||||
httpUpdater.setup(&httpServer);
|
||||
httpServer.begin();
|
||||
MDNS.addService("http", "tcp", 80);
|
||||
//ArduinoOTA.setPort(OTA_PORT);
|
||||
ArduinoOTA.setHostname(_app_hostname);
|
||||
|
||||
@@ -1161,7 +1165,8 @@ void MyESP::begin(const char * app_hostname, const char * app_name, const char *
|
||||
void MyESP::loop() {
|
||||
_calculateLoad();
|
||||
_telnetHandle(); // Telnet/Debugger
|
||||
|
||||
httpServer.handleClient();
|
||||
MDNS.update();
|
||||
jw.loop(); // WiFi
|
||||
|
||||
// do nothing else until we've got a wifi connection
|
||||
|
||||
@@ -15,19 +15,21 @@
|
||||
#include <ArduinoOTA.h>
|
||||
#include <AsyncMqttClient.h> // https://github.com/marvinroger/async-mqtt-client and for ESP32 see https://github.com/marvinroger/async-mqtt-client/issues/127
|
||||
#include <DNSServer.h>
|
||||
|
||||
#include <FS.h>
|
||||
#include <JustWifi.h> // https://github.com/xoseperez/justwifi
|
||||
#include <TelnetSpy.h> // modified from https://github.com/yasheena/telnetspy
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
//#include <ESPmDNS.h>
|
||||
#include <ESPmDNS.h>
|
||||
#include <SPIFFS.h> // added for ESP32
|
||||
#define ets_vsnprintf vsnprintf // added for ESP32
|
||||
#define OTA_PORT 8266
|
||||
#else
|
||||
//#include <ESP8266mDNS.h>
|
||||
#include <ESP8266HTTPUpdateServer.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#include <ESPAsyncTCP.h>
|
||||
#define OTA_PORT 3232
|
||||
#define OTA_PORT 8266
|
||||
#endif
|
||||
|
||||
#define MYEMS_CONFIG_FILE "/config.json"
|
||||
|
||||
28
src/ems.cpp
28
src/ems.cpp
@@ -119,7 +119,7 @@ const _EMS_Type EMS_Types[] = {
|
||||
{EMS_MODEL_EASY, EMS_TYPE_EasyStatusMessage, "EasyStatusMessage", _process_EasyStatusMessage},
|
||||
{EMS_MODEL_BOSCHEASY, EMS_TYPE_EasyStatusMessage, "EasyStatusMessage", _process_EasyStatusMessage},
|
||||
//Ems plus
|
||||
{EMSP_MODEL_RC10, EMS_TYPE_EmsPlusStatusMessage, "EMSPStatusMessage", _process_EmsPlusStatusMessage}
|
||||
{EMSP_MODEL_RC10, EMSP_TYPE_EmsPlusStatusMessage, "EMSPStatusMessage", _process_EmsPlusStatusMessage}
|
||||
|
||||
|
||||
};
|
||||
@@ -1051,19 +1051,19 @@ void _process_EasyStatusMessage(uint8_t type, uint8_t * data, uint8_t length) {
|
||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||
}
|
||||
void _process_EmsPlusStatusMessage(uint8_t type, uint8_t * data, uint8_t length) {
|
||||
if (data[3] == 3 || data[3] == 6 || data[3] == 10) {
|
||||
EMS_Thermostat.setpoint_roomTemp = ((float)data[6]) / (float)2;
|
||||
if (true) {
|
||||
char str[300];
|
||||
char buffer[16];
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
strlcat(str, _hextoa(data[i], buffer), sizeof(str));
|
||||
strlcat(str, " ", sizeof(str)); // add space
|
||||
}
|
||||
myDebug(str);
|
||||
if (true) {
|
||||
char str[300];
|
||||
char buffer[16];
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
strlcat(str, _hextoa(data[i], buffer), sizeof(str));
|
||||
strlcat(str, " ", sizeof(str)); // add space
|
||||
}
|
||||
myDebug(str);
|
||||
}
|
||||
//EMS_Sys_Status.emsLogging = EMS_SYS_LOGGING_NONE;
|
||||
if (data[EMSP_TYPE] == EMSP_TYPE_EmsPlusStatusMessage_setpoint)
|
||||
EMS_Thermostat.setpoint_roomTemp = ((float)data[6]) / (float)2;
|
||||
if (data[EMSP_TYPE] == EMSP_TYPE_EmsPlusStatusMessage_curr)
|
||||
EMS_Thermostat.curr_roomTemp = ((float)data[7]) / (float)10;
|
||||
}
|
||||
/*
|
||||
strlcat(output_str, ", type 0x", sizeof(output_str));
|
||||
@@ -1587,13 +1587,13 @@ void ems_sendRawTelegram(char * telegram) {
|
||||
EMS_Sys_Status.txRetryCount = 0; // reset retry counter
|
||||
|
||||
// get first value, which should be the src
|
||||
if ( (p = strtok(telegram, " ,")) ) { // delimiter
|
||||
if ((p = strtok(telegram, " ,"))) { // delimiter
|
||||
strlcpy(value, p, sizeof(value));
|
||||
EMS_TxTelegram.data[0] = (uint8_t)strtol(value, 0, 16);
|
||||
}
|
||||
// and interate until end
|
||||
while (p != 0) {
|
||||
if ( (p = strtok(NULL, " ,")) ) {
|
||||
if ((p = strtok(NULL, " ,"))) {
|
||||
strlcpy(value, p, sizeof(value));
|
||||
uint8_t val = (uint8_t)strtol(value, 0, 16);
|
||||
EMS_TxTelegram.data[++count] = val;
|
||||
|
||||
@@ -84,9 +84,10 @@
|
||||
#define EMS_TYPE_EasyStatusMessage_setpoint 10 // setpoint temp
|
||||
#define EMS_TYPE_EasyStatusMessage_curr 8 // current temp
|
||||
// Ems plus
|
||||
#define EMS_TYPE_EmsPlusStatusMessage 0xFF // reading values on an Easy Thermostat
|
||||
#define EMS_TYPE_EmsPlusStatusMessage_setpoint 0 // setpoint temp
|
||||
#define EMS_TYPE_EmsPlusStatusMessage_curr 0 // current temp
|
||||
#define EMSP_TYPE_EmsPlusStatusMessage 0xFF // reading values on an Easy Thermostat
|
||||
#define EMSP_TYPE 3
|
||||
#define EMSP_TYPE_EmsPlusStatusMessage_setpoint 10 // setpoint temp
|
||||
#define EMSP_TYPE_EmsPlusStatusMessage_curr 0 // current temp
|
||||
// Known EMS types
|
||||
typedef enum {
|
||||
EMS_MODEL_NONE,
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define APP_NAME "EMS-ESP"
|
||||
#define APP_NAME "ems-emmeloord-2"
|
||||
#define APP_VERSION "1.5.6"
|
||||
#define APP_HOSTNAME "ems-esp"
|
||||
#define APP_HOSTNAME "ems-emmeloord-2"
|
||||
|
||||
Reference in New Issue
Block a user