Browse Source

Merge branch 'main' of https://github.com/grindylow/ahoy

pull/157/head
Andreas Schiffler 3 years ago
parent
commit
2df60b8ad8
  1. 21
      tools/esp8266/README.md
  2. 2
      tools/esp8266/app.cpp
  3. 2
      tools/esp8266/defines.h
  4. 2
      tools/esp8266/hmInverter.h
  5. 17
      tools/esp8266/html/convert.py
  6. 2
      tools/esp8266/html/h/setup_html.h
  7. 2
      tools/esp8266/html/h/style_css.h
  8. 76
      tools/esp8266/html/setup.html
  9. 28
      tools/esp8266/html/style.css
  10. 2
      tools/esp8266/platformio.ini

21
tools/esp8266/README.md

@ -73,7 +73,26 @@ For now the following inverters should work out of the box:
## Changelog
(*) EEPROM changes require settings to be changed, your settings will be overwritten and need to be set again!
- v0.5.9 *fix PowerLimit PowerPFDev.Desc=0x0001 for permanent
- v0.5.8 *fix #146 device name in setup
- v0.5.7 *add collapsible setup
- v0.5.6 *fix only MQTT sub after the first loop in a conenction
- v0.5.5 *fixed MQTT sub only after connection is established (HorstG-57)
+ added in app.cpp some compiler if statements
*fix: compile possible for non repository versions (if project was download as zip - lumapu)
*fix README.md - Update line 69 (`RF24` 1.4.2 -> 1.4.5) (DanielR92)
*Update hmRadio.h (lumapu)
- v0.5.4 + added Github report text with a URL (aschiffler)
+ added auto_firmware_version.py for GIT_HASH
+ added switch case AlarmData/AlarmUpdate
- v0.5.3 #Bugfix #125 PowerLimit
+ prototype webapi to get info, improved pwr limit (aschiffler)
+ Merge remote-tracking branch 'upstream/main' into pwrlimit
- v0.5.2 add #114 ntp_server_name and port to eeprom
+ stefan123t added some functions (devcontrol/cbMqtt/...)
- v0.5.1 *Merge branch 'upstream/HEAD' into control
*update revision (0.4.26 -> 0.5.1)
- v0.4.26 first poc for power set via mqtt
- v0.4.25 added default SERIAL/MQTT/SEND_INTERVAL #100, fixed env:node_mcu_v2 build #101
- v0.4.24 added fixes for #63, #88, #93. revert #36 (*) EEPROM changes
- v0.4.23 added workflow, fix index.html to load inverter info immediately, changed timestamp to 1 for stand alone ESP #90, Implement MQTT discovery for Home Assistant

2
tools/esp8266/app.cpp

@ -86,7 +86,7 @@ void app::setup(uint32_t timeout) {
if(NULL != iv) {
mEep->read(ADDR_INV_PWR_LIM + (i * 2),(uint16_t *)&(iv->powerLimit[0]));
if (iv->powerLimit[0] != 0xffff) { // only set it, if it is changed by user. Default value in the html setup page is -1 = 0xffff
iv->powerLimit[1] = 0x0100; // set the limit as persistent
iv->powerLimit[1] = 0x0001; // set the limit as persistent
iv->devControlCmd = ActivePowerContr; // set active power limit
iv->devControlRequest = true; // set to true to update the active power limit from setup html page
DPRINTLN(DBG_INFO, F("add inverter: ") + String(name) + ", SN: " + String(invSerial, HEX) + ", Power Limit: " + String(iv->powerLimit[0]));

2
tools/esp8266/defines.h

@ -21,7 +21,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
#define VERSION_PATCH 6
#define VERSION_PATCH 9
//-------------------------------------

2
tools/esp8266/hmInverter.h

@ -84,7 +84,7 @@ class Inverter {
Inverter() {
ts = 0;
powerLimit[0] = -1; // 65535 W Limit -> unlimited
powerLimit[1] = 0x0100; // 0x0000 --> set temporary , 0x0100 --> set persistent
powerLimit[1] = 0x0001; // 0x0000 --> set temporary , 0x0001 --> set persistent
devControlRequest = false;
devControlCmd = 0xff;
}

17
tools/esp8266/html/convert.py

@ -1,8 +1,19 @@
import re
import sys
import os
def convert2Header(inFile):
outName = "h/" + inFile.replace(".", "_") + ".h"
fileType = inFile.split(".")[1]
define = inFile.split(".")[0].upper()
define2 = inFile.split(".")[1].upper()
inFileVarName = inFile.replace(".", "_")
if os.getcwd()[-4:] != "html":
print("ok")
outName = "html/" + "h/" + inFileVarName + ".h"
inFile = "html/" + inFile
else:
outName = "h/" + inFileVarName + ".h"
f = open(inFile, "r")
data = f.read().replace('\n', '')
@ -14,12 +25,10 @@ def convert2Header(inFile):
else:
data = re.sub(r"(\;|\}|\:|\{)\s+", r'\1', data) # whitespaces inner css
define = inFile.split(".")[0].upper()
define2 = inFile.split(".")[1].upper()
f = open(outName, "w")
f.write("#ifndef __{}_{}_H__\n".format(define, define2))
f.write("#define __{}_{}_H__\n".format(define, define2))
f.write("const char {}[] PROGMEM = \"{}\";\n".format(inFile.replace(".", "_"), data))
f.write("const char {}[] PROGMEM = \"{}\";\n".format(inFileVarName, data))
f.write("#endif /*__{}_{}_H__*/\n".format(define, define2))
f.close()

2
tools/esp8266/html/h/setup_html.h

File diff suppressed because one or more lines are too long

2
tools/esp8266/html/h/style_css.h

@ -1,4 +1,4 @@
#ifndef __STYLE_CSS_H__
#define __STYLE_CSS_H__
const char style_css[] PROGMEM = "h1 {margin:0;padding:20pt;font-size:22pt;color:#fff;background-color:#006ec0;display:block;text-transform:uppercase;}html, body {font-family:Arial;margin:0;padding:0;}p {text-align:justify;font-size:13pt;}p.lic, p.lic a {font-size:8pt;color:#999;}.des {margin-top:35px;font-size:13pt;color:#006ec0;}.subdes {font-size:12pt;color:#006ec0;margin-left:7px;}.subsubdes {font-size:12pt;color:#006ec0;margin:0 0 7px 12px;}.hide {display:none;}a:link, a:visited {text-decoration:none;font-size:13pt;color:#006ec0;}a:hover, a:focus {color:#f00;}a.erase {background-color:#006ec0;color:#fff;padding:7px;display:inline-block;margin-top:30px;float:right;}#content {padding:15px 15px 60px 15px;}#footer {position:fixed;bottom:0px;height:45px;background-color:#006ec0;width:100%;border-top:5px solid #fff;}#footer p, #footer a {color:#fff;padding:0 7px 0 7px;font-size:10pt !important;}div.content {background-color:#fff;padding-bottom:65px;overflow:auto;}input, select {padding:7px;font-size:13pt;}input.text, select {width:70%;box-sizing:border-box;margin-bottom:10px;border:1px solid #ccc;}input.sh {max-width:150px !important;margin-right:10px;}input.btn {background-color:#006ec0;color:#fff;border:0px;float:right;margin:10px 0 30px;text-transform:uppercase;}input.cb {margin-bottom:20px;}label {width:20%;display:inline-block;font-size:12pt;padding-right:10px;margin-left:15px;}.left {float:left;}.right {float:right;}div.ch-iv {width:100%;background-color:#32b004;display:inline-block;margin-bottom:15px;padding-bottom:20px;overflow:auto;}div.ch {width:220px;min-height:350px;background-color:#006ec0;display:inline-block;margin:0 10px 15px 10px;overflow:auto;padding-bottom:20px;}div.ch .value, div.ch .info, div.ch .head, div.ch-iv .value, div.ch-iv .info, div.ch-iv .head {color:#fff;display:block;width:100%;text-align:center;}.subgrp {float:left;width:220px;}div.ch .unit, div.ch-iv .unit {font-size:19px;margin-left:10px;}div.ch .value, div.ch-iv .value {margin-top:20px;font-size:24px;}div.ch .info, div.ch-iv .info {margin-top:3px;font-size:10px;}div.ch .head {background-color:#003c80;padding:10px 0 10px 0;}div.ch-iv .head {background-color:#1c6800;padding:10px 0 10px 0;}div.iv {max-width:960px;margin-bottom:40px;}div.ts {font-size:13px;background-color:#ddd;border-top:7px solid #999;padding:7px;}#note {margin:50px 10px 10px 10px;padding-top:10px;width:100%;border-top:1px solid #bbb;}@media(max-width:500px) {div.ch .unit, div.ch-iv .unit {font-size:18px;}div.ch {width:170px;min-height:100px;}.subgrp {width:180px;}}";
const char style_css[] PROGMEM = "h1 {margin:0;padding:20pt;font-size:22pt;color:#fff;background-color:#006ec0;display:block;text-transform:uppercase;}html, body {font-family:Arial;margin:0;padding:0;}p {text-align:justify;font-size:13pt;}p.lic, p.lic a {font-size:8pt;color:#999;}.des {margin-top:20px;font-size:13pt;color:#006ec0;}.s_active, .s_collapsible:hover {background-color:#006ec0;}.s_content {display:none;overflow:hidden;margin-bottom:20px;}.s_collapsible {background-color:#044e86;color:white;cursor:pointer;padding:18px;width:100%;border:none;text-align:left;outline:none;font-size:15px;margin-bottom:4px;}.subdes {font-size:12pt;color:#006ec0;margin-left:7px;}.subsubdes {font-size:12pt;color:#006ec0;margin:0 0 7px 12px;}.hide {display:none;}a:link, a:visited {text-decoration:none;font-size:13pt;color:#006ec0;}a:hover, a:focus {color:#f00;}a.erase {background-color:#006ec0;color:#fff;padding:7px;display:inline-block;margin-top:30px;float:right;}#content {padding:15px 15px 60px 15px;}#footer {position:fixed;bottom:0px;height:45px;background-color:#006ec0;width:100%;border-top:5px solid #fff;}#footer p, #footer a {color:#fff;padding:0 7px 0 7px;font-size:10pt !important;}div.content {background-color:#fff;padding-bottom:65px;overflow:auto;}input, select {padding:7px;font-size:13pt;}input.text, select {width:70%;box-sizing:border-box;margin-bottom:10px;border:1px solid #ccc;}input.sh {max-width:150px !important;margin-right:10px;}input.btn {background-color:#006ec0;color:#fff;border:0px;float:right;margin:10px 0 30px;text-transform:uppercase;}input.cb {margin-bottom:20px;}label {width:20%;display:inline-block;font-size:12pt;padding-right:10px;margin-left:15px;}.left {float:left;}.right {float:right;}div.ch-iv {width:100%;background-color:#32b004;display:inline-block;margin-bottom:15px;padding-bottom:20px;overflow:auto;}div.ch {width:220px;min-height:350px;background-color:#006ec0;display:inline-block;margin:0 10px 15px 10px;overflow:auto;padding-bottom:20px;}div.ch .value, div.ch .info, div.ch .head, div.ch-iv .value, div.ch-iv .info, div.ch-iv .head {color:#fff;display:block;width:100%;text-align:center;}.subgrp {float:left;width:220px;}div.ch .unit, div.ch-iv .unit {font-size:19px;margin-left:10px;}div.ch .value, div.ch-iv .value {margin-top:20px;font-size:24px;}div.ch .info, div.ch-iv .info {margin-top:3px;font-size:10px;}div.ch .head {background-color:#003c80;padding:10px 0 10px 0;}div.ch-iv .head {background-color:#1c6800;padding:10px 0 10px 0;}div.iv {max-width:960px;margin-bottom:40px;}div.ts {font-size:13px;background-color:#ddd;border-top:7px solid #999;padding:7px;}#note {margin:50px 10px 10px 10px;padding-top:10px;width:100%;border-top:1px solid #bbb;}@media(max-width:500px) {div.ch .unit, div.ch-iv .unit {font-size:18px;}div.ch {width:170px;min-height:100px }.subgrp {width:180px;}}";
#endif /*__STYLE_CSS_H__*/

76
tools/esp8266/html/setup.html

@ -52,44 +52,53 @@
<h1>Setup</h1>
<div id="setup" class="content">
<div id="content">
<p>
Enter the credentials to your prefered WiFi station. After rebooting the device tries to connect with this information.
</p>
<a class="erase" href="/erase">ERASE SETTINGS (not WiFi)</a>
<form method="post" action="{IP}/save">
<p class="des">WiFi</p>
<label for="ssid">SSID</label>
<input type="text" class="text" name="ssid" value="{SSID}"/>
<label for="pwd">Password</label>
<input type="password" class="text" name="pwd" value="{PWD}"/>
<p class="des">Device Host Name</p>
<label for="device">Device Name</label>
<input type="text" class="text" name="device" value="{DEVICE}"/>
<button type="button" class="s_collapsible">WiFi</button>
<div class="s_content">
<fieldset>
<legend class="des">WiFi</legend>
<p>Enter the credentials to your prefered WiFi station. After rebooting the device tries to connect with this information.</p>
<label for="ssid">SSID</label>
<input type="text" class="text" name="ssid" value="{SSID}"/>
<label for="pwd">Password</label>
<input type="password" class="text" name="pwd" value="{PWD}"/>
</fieldset>
</div>
<a class="erase" href="/erase">ERASE SETTINGS (not WiFi)</a>
<p class="des">Inverter</p>
<button type="button" class="s_collapsible">Inverter</button>
<div class="s_content">
<fieldset>
<legend class="des">Inverter</legend>
{INVERTERS}<br/>
<p class="subdes">General</p>
<label for="invInterval">Interval [s]</label>
<input type="text" class="text" name="invInterval" value="{INV_INTVL}"/>
<label for="invRetry">Max retries per Payload</label>
<input type="text" class="text" name="invRetry" value="{INV_RETRIES}"/>
</fieldset>
</div>
<p class="des">Pinout (Wemos)</p>
{PINOUT}
<p class="des">Radio (NRF24L01+)</p>
<label for="rf24Power">Amplifier Power Level</label>
<select name="rf24Power">{RF24}</select>
<p class="des">NTP Server</p>
<button type="button" class="s_collapsible">NTP Server</button>
<div class="s_content">
<fieldset>
<legend class="des">NTP Server</legend>
<label for="ntpAddr">NTP Server / IP</label>
<input type="text" class="text" name="ntpAddr" value="{NTP_ADDR}"/>
<label for="ntpPort">NTP Port</label>
<input type="text" class="text" name="ntpPort" value="{NTP_PORT}"/>
</fieldset>
</div>
<p class="des">MQTT</p>
<button type="button" class="s_collapsible">MQTT</button>
<div class="s_content">
<fieldset>
<legend class="des">MQTT</legend>
<label for="mqttAddr">Broker / Server IP</label>
<input type="text" class="text" name="mqttAddr" value="{MQTT_ADDR}"/>
<label for="mqttPort">Port</label>
@ -102,6 +111,19 @@
<input type="text" class="text" name="mqttTopic" value="{MQTT_TOPIC}"/>
<label for="mqttIntvl">Interval [s] (read-only)</label>
<input type="text" class="text" name="mqttIntvl" value="{MQTT_INTVL}" readonly/>
</fieldset>
</div>
<button type="button" class="s_collapsible">System Config</button>
<div class="s_content">
<fieldset>
<legend class="des">System Config</legend>
<p class="des">Pinout (Wemos)</p>
{PINOUT}
<p class="des">Radio (NRF24L01+)</p>
<label for="rf24Power">Amplifier Power Level</label>
<select name="rf24Power">{RF24}</select>
<p class="des">Serial Console</p>
<label for="serEn">print inverter data</label>
@ -110,6 +132,8 @@
<input type="checkbox" class="cb" name="serDbg" {SER_DBG_CB}/><br/>
<label for="serIntvl">Interval [s]</label>
<input type="text" class="text" name="serIntvl" value="{SER_INTVL}"/>
</fieldset>
</div>
<p class="des">&nbsp;</p>
<label for="reboot">Reboot device after successful save</label>
@ -126,5 +150,17 @@
<p class="right"><a href="{IP}/factory">Factory Reset</a></p>
<p class="right"><a href="{IP}/reboot">Reboot</a></p>
</div>
<script type="text/javascript">
var coll = document.getElementsByClassName("s_collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
content.style.display = (content.style.display === "block") ? "none" : "block";
});
}
</script>
</body>
</html>

28
tools/esp8266/html/style.css

@ -25,11 +25,35 @@ p.lic, p.lic a {
}
.des {
margin-top: 35px;
margin-top: 20px;
font-size: 13pt;
color: #006ec0;
}
.s_active, .s_collapsible:hover {
background-color: #006ec0;
}
.s_content {
display: none;
overflow: hidden;
margin-bottom: 20px;
}
.s_collapsible {
background-color: #044e86;
color: white;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
margin-bottom: 4px;
}
.subdes {
font-size: 12pt;
color: #006ec0;
@ -218,7 +242,7 @@ div.ts {
div.ch {
width: 170px;
min-height: 100px;
min-height: 100px
}
.subgrp {

2
tools/esp8266/platformio.ini

@ -34,6 +34,7 @@ monitor_filters =
extra_scripts =
pre:scripts/auto_firmware_version.py
pre:html/convert.py
lib_deps =
nrf24/RF24@1.4.5
@ -72,6 +73,7 @@ upload_port = /dev/ttyUSB0
extra_scripts =
pre:scripts/auto_firmware_version.py
pre:html/convert.py html/
lib_deps =
nrf24/RF24@1.4.5

Loading…
Cancel
Save