mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-03-26 18:33:12 +00:00
Some serious restructuring to be able to swap between implementations
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,7 +7,7 @@
|
||||
.vscode
|
||||
.pio
|
||||
platformio-user.ini
|
||||
/src/version.h
|
||||
/lib/AmsConfiguration/include/version.h
|
||||
/src/web/root
|
||||
/src/AmsToMqttBridge.ino.cpp
|
||||
/test
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
1
lib/ClassicUi/include/.gitignore
vendored
Normal file
1
lib/ClassicUi/include/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
root/*.h
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "EnergyAccounting.h"
|
||||
#include "Uptime.h"
|
||||
#include "RemoteDebug.h"
|
||||
#include "entsoe/EntsoeApi.h"
|
||||
#include "EntsoeApi.h"
|
||||
|
||||
#if defined(ESP8266)
|
||||
#include <ESP8266WiFi.h>
|
||||
@@ -25,8 +25,8 @@ except:
|
||||
print("WARN: Unable to load minifier")
|
||||
|
||||
|
||||
webroot = "web"
|
||||
srcroot = "src/web/root"
|
||||
webroot = "lib/ClassicUi/html"
|
||||
srcroot = "lib/ClassicUi/include/root"
|
||||
|
||||
version = os.environ.get('GITHUB_TAG')
|
||||
if version == None:
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Arduino.h"
|
||||
#include "AmsData.h"
|
||||
#include "AmsDataStorage.h"
|
||||
#include "entsoe/EntsoeApi.h"
|
||||
#include "EntsoeApi.h"
|
||||
|
||||
struct EnergyAccountingPeak {
|
||||
uint8_t day;
|
||||
@@ -201,7 +201,7 @@ bool EntsoeApi::retrieve(const char* url, Stream* doc) {
|
||||
https.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
|
||||
https.setReuse(false);
|
||||
https.setTimeout(50000);
|
||||
https.setUserAgent("ams2mqtt/" + String(VERSION));
|
||||
https.setUserAgent("ams2mqtt");
|
||||
#if defined(ESP32)
|
||||
if(https.begin(url)) {
|
||||
printD("Connection established");
|
||||
@@ -2,8 +2,14 @@
|
||||
extra_configs = platformio-user.ini
|
||||
|
||||
[common]
|
||||
lib_deps = Timezone@1.2.4, 256dpi/MQTT@2.5.0, OneWireNg@0.10.0, DallasTemperature@3.9.1, EspSoftwareSerial@6.14.1, https://github.com/gskjold/RemoteDebug.git, Time@1.6.1
|
||||
lib_deps = EEPROM, LittleFS, DNSServer, 256dpi/MQTT@2.5.0, OneWireNg@0.10.0, DallasTemperature@3.9.1, EspSoftwareSerial@6.14.1, https://github.com/gskjold/RemoteDebug.git, Time@1.6.1, Timezone@1.2.4, AmsConfiguration, AmsData, AmsDataStorage, HwTools, Uptime, EntsoePriceApi, EnergyAccounting, ClassicUi
|
||||
lib_ignore = OneWire
|
||||
extra_scripts =
|
||||
pre:scripts/addversion.py
|
||||
lib/ClassicUi/scripts/generate_includes.py
|
||||
|
||||
[esp32]
|
||||
lib_deps = WiFi, ESPmDNS, WiFiClientSecure, HTTPClient, FS, Update, HTTPUpdate, WebServer, ${common.lib_deps}
|
||||
|
||||
[env:esp8266]
|
||||
platform = espressif8266@3.2.0
|
||||
@@ -11,11 +17,10 @@ framework = arduino
|
||||
board = esp12e
|
||||
board_build.ldscript = eagle.flash.4m2m.ld
|
||||
build_flags = -D WEBSOCKET_DISABLED=1
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ldf_mode = off
|
||||
lib_deps = ESP8266WiFi, ESP8266mDNS, ESP8266WebServer, ESP8266HTTPClient, ESP8266httpUpdate, ${common.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
extra_scripts =
|
||||
pre:scripts/addversion.py
|
||||
scripts/makeweb.py
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
|
||||
# Sticking to v2.0.3 because of #298
|
||||
|
||||
@@ -25,11 +30,10 @@ framework = arduino
|
||||
board = esp32dev
|
||||
board_build.f_cpu = 160000000L
|
||||
build_flags = -D WEBSOCKET_DISABLED=1 -fexceptions
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ldf_mode = off
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
extra_scripts =
|
||||
pre:scripts/addversion.py
|
||||
scripts/makeweb.py
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
|
||||
# Tasmota has pre-built platform for C3, S2, S3 and Solo, more information at:
|
||||
# https://github.com/Jason2866/esp32-arduino-lib-builder
|
||||
@@ -45,11 +49,10 @@ board_build.flash_mode = qio
|
||||
board_build.f_cpu = 160000000L
|
||||
board_build.f_flash = 40000000L
|
||||
build_flags = -D WEBSOCKET_DISABLED=1
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ldf_mode = off
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
extra_scripts =
|
||||
pre:scripts/addversion.py
|
||||
scripts/makeweb.py
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
|
||||
[env:esp32solo]
|
||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/v.2.0.3/platform-espressif32-solo1-v.2.0.3.zip
|
||||
@@ -57,8 +60,7 @@ framework = arduino
|
||||
board = esp32dev
|
||||
board_build.f_cpu = 160000000L
|
||||
build_flags = -D WEBSOCKET_DISABLED=1 -fexceptions
|
||||
lib_deps = ${common.lib_deps}
|
||||
lib_ldf_mode = off
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
lib_ignore = ${common.lib_ignore}
|
||||
extra_scripts =
|
||||
pre:scripts/addversion.py
|
||||
scripts/makeweb.py
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
import subprocess
|
||||
from time import time
|
||||
|
||||
FILENAME_VERSION_H = 'src/version.h'
|
||||
FILENAME_VERSION_H = 'lib/AmsConfiguration/include/version.h'
|
||||
version = os.environ.get('GITHUB_TAG')
|
||||
if version == None:
|
||||
try:
|
||||
|
||||
@@ -49,9 +49,9 @@ ADC_MODE(ADC_VCC);
|
||||
#include "hexutils.h"
|
||||
#include "HwTools.h"
|
||||
|
||||
#include "entsoe/EntsoeApi.h"
|
||||
#include "EntsoeApi.h"
|
||||
|
||||
#include "web/AmsWebServer.h"
|
||||
#include "AmsWebServer.h"
|
||||
#include "AmsConfiguration.h"
|
||||
|
||||
#include "mqtt/AmsMqttHandler.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "AmsConfiguration.h"
|
||||
#include "EnergyAccounting.h"
|
||||
#include "HwTools.h"
|
||||
#include "entsoe/EntsoeApi.h"
|
||||
#include "EntsoeApi.h"
|
||||
|
||||
class AmsMqttHandler {
|
||||
public:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "DomoticzMqttHandler.h"
|
||||
#include "web/root/domoticz_json.h"
|
||||
#include "root/domoticz_json.h"
|
||||
|
||||
bool DomoticzMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea) {
|
||||
bool ret = false;
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
#include "hexutils.h"
|
||||
#include "Uptime.h"
|
||||
#include "version.h"
|
||||
#include "web/root/ha1_json.h"
|
||||
#include "web/root/ha2_json.h"
|
||||
#include "web/root/ha3_json.h"
|
||||
#include "web/root/jsonsys_json.h"
|
||||
#include "web/root/jsonprices_json.h"
|
||||
#include "web/root/hadiscover_json.h"
|
||||
#include "root/ha1_json.h"
|
||||
#include "root/ha2_json.h"
|
||||
#include "root/ha3_json.h"
|
||||
#include "root/jsonsys_json.h"
|
||||
#include "root/jsonprices_json.h"
|
||||
#include "root/hadiscover_json.h"
|
||||
|
||||
bool HomeAssistantMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea) {
|
||||
if(topic.isEmpty() || !mqtt->connected())
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
#include "version.h"
|
||||
#include "hexutils.h"
|
||||
#include "Uptime.h"
|
||||
#include "web/root/json1_json.h"
|
||||
#include "web/root/json2_json.h"
|
||||
#include "web/root/json3_json.h"
|
||||
#include "web/root/json4_json.h"
|
||||
#include "web/root/jsonsys_json.h"
|
||||
#include "web/root/jsonprices_json.h"
|
||||
#include "root/json1_json.h"
|
||||
#include "root/json2_json.h"
|
||||
#include "root/json3_json.h"
|
||||
#include "root/json4_json.h"
|
||||
#include "root/jsonsys_json.h"
|
||||
#include "root/jsonprices_json.h"
|
||||
|
||||
bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea) {
|
||||
if(topic.isEmpty() || !mqtt->connected())
|
||||
|
||||
Reference in New Issue
Block a user