mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-06 19:46:54 +03:00
Remove Autostart parameter and make the flow to be always enabled (#3423)
* removed Autostart parameter and make it enabled by default * . * show menu entry in UI * cleanup migration * . * . * . * . * . * . * . * .
This commit is contained in:
@@ -196,7 +196,7 @@ bool ClassFlowControll::StartMQTTService()
|
|||||||
|
|
||||||
void ClassFlowControll::SetInitialParameter(void)
|
void ClassFlowControll::SetInitialParameter(void)
|
||||||
{
|
{
|
||||||
AutoStart = false;
|
AutoStart = true;
|
||||||
SetupModeActive = false;
|
SetupModeActive = false;
|
||||||
AutoInterval = 10; // Minutes
|
AutoInterval = 10; // Minutes
|
||||||
flowdigit = NULL;
|
flowdigit = NULL;
|
||||||
@@ -210,7 +210,8 @@ void ClassFlowControll::SetInitialParameter(void)
|
|||||||
|
|
||||||
bool ClassFlowControll::getIsAutoStart(void)
|
bool ClassFlowControll::getIsAutoStart(void)
|
||||||
{
|
{
|
||||||
return AutoStart;
|
//return AutoStart;
|
||||||
|
return true; // Flow must always be enabled, else the manual trigger (REST, MQTT) will not work!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -557,10 +558,6 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
|
|
||||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph)) {
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph)) {
|
||||||
splitted = ZerlegeZeile(aktparamgraph, " =");
|
splitted = ZerlegeZeile(aktparamgraph, " =");
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "AUTOSTART") && (splitted.size() > 1)) {
|
|
||||||
AutoStart = alphanumericToBoolean(splitted[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "INTERVAL") && (splitted.size() > 1)) {
|
if ((toUpper(splitted[0]) == "INTERVAL") && (splitted.size() > 1)) {
|
||||||
if (isStringNumeric(splitted[1]))
|
if (isStringNumeric(splitted[1]))
|
||||||
|
|||||||
@@ -422,8 +422,7 @@ esp_err_t handler_flow_start(httpd_req_t *req)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Flow start triggered by REST API, but flow is not active!");
|
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Flow start triggered by REST API, but flow is not active!");
|
||||||
const char *resp_str = "WARNING: Flow start triggered by REST API, but flow is not active";
|
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Flow start triggered by REST API, but flow is not active");
|
||||||
httpd_resp_send(req, resp_str, HTTPD_RESP_USE_STRLEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
|
|||||||
@@ -727,8 +727,7 @@ void migrateConfiguration(void) {
|
|||||||
}
|
}
|
||||||
else if (section == "[AutoTimer]") {
|
else if (section == "[AutoTimer]") {
|
||||||
migrated = migrated | replaceString(configLines[i], "Intervall", "Interval");
|
migrated = migrated | replaceString(configLines[i], "Intervall", "Interval");
|
||||||
migrated = migrated | replaceString(configLines[i], ";AutoStart = true", ";AutoStart = false"); // Set it to its default value
|
migrated = migrated | replaceString(configLines[i], "Autostart", ";UNUSED_PARAMETER"); // This parameter is no longer used
|
||||||
migrated = migrated | replaceString(configLines[i], ";AutoStart", "AutoStart"); // Enable it
|
|
||||||
}
|
}
|
||||||
else if (section == "[Debug]") {
|
else if (section == "[Debug]") {
|
||||||
migrated = migrated | replaceString(configLines[i], "Logfile ", "LogLevel "); // Whitespace needed so it does not match `LogfileRetentionInDays`
|
migrated = migrated | replaceString(configLines[i], "Logfile ", "LogLevel "); // Whitespace needed so it does not match `LogfileRetentionInDays`
|
||||||
@@ -741,7 +740,7 @@ void migrateConfiguration(void) {
|
|||||||
else if (section == "[System]") {
|
else if (section == "[System]") {
|
||||||
migrated = migrated | replaceString(configLines[i], "RSSIThreashold", "RSSIThreshold");
|
migrated = migrated | replaceString(configLines[i], "RSSIThreashold", "RSSIThreshold");
|
||||||
migrated = migrated | replaceString(configLines[i], "AutoAdjustSummertime", ";UNUSED_PARAMETER"); // This parameter is no longer used
|
migrated = migrated | replaceString(configLines[i], "AutoAdjustSummertime", ";UNUSED_PARAMETER"); // This parameter is no longer used
|
||||||
|
|
||||||
migrated = migrated | replaceString(configLines[i], ";SetupMode = true", ";SetupMode = false"); // Set it to its default value
|
migrated = migrated | replaceString(configLines[i], ";SetupMode = true", ";SetupMode = false"); // Set it to its default value
|
||||||
migrated = migrated | replaceString(configLines[i], ";SetupMode", "SetupMode"); // Enable it
|
migrated = migrated | replaceString(configLines[i], ";SetupMode", "SetupMode"); // Enable it
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,4 @@
|
|||||||
Default Value: `true`
|
Default Value: `true`
|
||||||
|
|
||||||
!!! Warning
|
!!! Warning
|
||||||
This is an **Expert Parameter**! Only change it if you understand what it does!
|
This parameter is no longer available. The flow is now always enabled. If you want it to be disabled, set an interval which is high enough (eg. 1440 = 24h).
|
||||||
|
|
||||||
Automatically start the Flow (Digitization Rounds) immediately after power up.
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
Typically this is set to `true`.
|
|
||||||
The main reasons to set it to `false` is when you want to trigger it manually using the
|
|
||||||
[REST API](../REST-API) or [MQTT-API](../MQTT-API) or for debugging.
|
|
||||||
@@ -4,4 +4,8 @@ Default Value: `5`
|
|||||||
Unit: Minutes
|
Unit: Minutes
|
||||||
|
|
||||||
Interval in which the Flow (Digitization Round) is run.
|
Interval in which the Flow (Digitization Round) is run.
|
||||||
|
It will run immediately on startup and then the next time after the given interval.
|
||||||
If a round takes longer than this interval, the next round gets postponed until the current round completes.
|
If a round takes longer than this interval, the next round gets postponed until the current round completes.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
If you want the flow to be disabled, set an interval which is high enough (eg. 1440 = 24h).
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ LEDNumbers = 2
|
|||||||
LEDColor = 150 150 150
|
LEDColor = 150 150 150
|
||||||
|
|
||||||
[AutoTimer]
|
[AutoTimer]
|
||||||
AutoStart = true
|
|
||||||
Interval = 5
|
Interval = 5
|
||||||
|
|
||||||
[DataLogging]
|
[DataLogging]
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ LEDNumbers = 2
|
|||||||
LEDColor = 150 150 150
|
LEDColor = 150 150 150
|
||||||
|
|
||||||
[AutoTimer]
|
[AutoTimer]
|
||||||
AutoStart = true
|
|
||||||
Interval = 1
|
Interval = 1
|
||||||
|
|
||||||
[DataLogging]
|
[DataLogging]
|
||||||
|
|||||||
@@ -1920,6 +1920,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!------------- Autotimer ------------------>
|
<!------------- Autotimer ------------------>
|
||||||
|
<!--
|
||||||
<tr style="border-bottom: 2px solid lightgray;">
|
<tr style="border-bottom: 2px solid lightgray;">
|
||||||
<td colspan="3" style="padding-left: 0px; padding-bottom: 3px;"><h4>Auto Timer</h4></td>
|
<td colspan="3" style="padding-left: 0px; padding-bottom: 3px;"><h4>Auto Timer</h4></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -1936,6 +1937,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>$TOOLTIP_AutoTimer_AutoStart</td>
|
<td>$TOOLTIP_AutoTimer_AutoStart</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
-->
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="indent1">
|
<td class="indent1">
|
||||||
@@ -2381,7 +2383,7 @@ function UpdateInput() {
|
|||||||
WriteParameter(param, category, "GPIO", "LEDNumbers", false);
|
WriteParameter(param, category, "GPIO", "LEDNumbers", false);
|
||||||
WriteParameter(param, category, "GPIO", "LEDColor", false);
|
WriteParameter(param, category, "GPIO", "LEDColor", false);
|
||||||
|
|
||||||
WriteParameter(param, category, "AutoTimer", "AutoStart", false);
|
//WriteParameter(param, category, "AutoTimer", "AutoStart", false);
|
||||||
WriteParameter(param, category, "AutoTimer", "Interval", false);
|
WriteParameter(param, category, "AutoTimer", "Interval", false);
|
||||||
|
|
||||||
WriteParameter(param, category, "DataLogging", "DataLogActive", false);
|
WriteParameter(param, category, "DataLogging", "DataLogActive", false);
|
||||||
@@ -2556,7 +2558,7 @@ function ReadParameterAll() {
|
|||||||
param["GPIO"]["LEDNumbers"]["found"] = true;
|
param["GPIO"]["LEDNumbers"]["found"] = true;
|
||||||
param["GPIO"]["LEDColor"]["found"] = true;
|
param["GPIO"]["LEDColor"]["found"] = true;
|
||||||
|
|
||||||
ReadParameter(param, "AutoTimer", "AutoStart", false);
|
//ReadParameter(param, "AutoTimer", "AutoStart", false);
|
||||||
ReadParameter(param, "AutoTimer", "Interval", false);
|
ReadParameter(param, "AutoTimer", "Interval", false);
|
||||||
|
|
||||||
ReadParameter(param, "DataLogging", "DataLogActive", false);
|
ReadParameter(param, "DataLogging", "DataLogActive", false);
|
||||||
|
|||||||
@@ -159,7 +159,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li id="ManualControl" style="display:none;"><a>Manual Control <i class="arrow down"></i></a> <!-- Workaround: Hide menu if no entry is available -->
|
<li id="ManualControl" style="display:none;"><a>Manual Control <i class="arrow down"></i></a> <!-- Workaround: Hide menu if no entry is available -->
|
||||||
<ul class="submenu" style="width: 300px">
|
<ul class="submenu" style="width: 300px">
|
||||||
<!--<li><a href="#" onclick="flow_start()">Start Round</a></li>--> <!-- Needs to be adapted on code side first to ensure proper user feedback -->
|
<li><a href="#" onclick="flow_start()">Start Round</a></li>
|
||||||
<li id="HASendDiscovery" style="width: 300px" style="display:none;"><a href="#" onclick="HA_send_discovery()">Resend Homeassistant Discovery</a></li>
|
<li id="HASendDiscovery" style="width: 300px" style="display:none;"><a href="#" onclick="HA_send_discovery()">Resend Homeassistant Discovery</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@@ -170,6 +170,7 @@
|
|||||||
|
|
||||||
<span id="Version" style="font-size: 10px; margin-top: -5px;padding-left: 10px;">Loading version...</span>
|
<span id="Version" style="font-size: 10px; margin-top: -5px;padding-left: 10px;">Loading version...</span>
|
||||||
|
|
||||||
|
<!-- # Disabled footer, since it wastes a lot of space and the images are broken
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="footer-section">
|
<div class="footer-section">
|
||||||
<span>Support & Contact Us</span>
|
<span>Support & Contact Us</span>
|
||||||
@@ -189,7 +190,7 @@
|
|||||||
<img src="https://github.com/jomjol/AI-on-the-edge-device/images/paypal.png" alt="PayPal" style="width: 60px; height: auto;">
|
<img src="https://github.com/jomjol/AI-on-the-edge-device/images/paypal.png" alt="PayPal" style="width: 60px; height: auto;">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
LoadHostname();
|
LoadHostname();
|
||||||
@@ -203,13 +204,14 @@
|
|||||||
console.log("Loading page: " + getCookie("page"));
|
console.log("Loading page: " + getCookie("page"));
|
||||||
document.getElementById('maincontent').src = getCookie("page");
|
document.getElementById('maincontent').src = getCookie("page");
|
||||||
|
|
||||||
/*
|
|
||||||
function flow_start() {
|
function flow_start() {
|
||||||
var url = getDomainname() + '/flow_start';
|
var url = getDomainname() + '/flow_start';
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
if (xhttp.responseText.substring(0,3) == "001") {
|
firework.launch(xhttp.responseText, 'success', 5000);
|
||||||
|
/*if (xhttp.responseText.substring(0,3) == "001") {
|
||||||
firework.launch('Flow start triggered', 'success', 5000);
|
firework.launch('Flow start triggered', 'success', 5000);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
@@ -218,13 +220,13 @@
|
|||||||
}
|
}
|
||||||
else if (xhttp.responseText.substring(0,3) == "099") {
|
else if (xhttp.responseText.substring(0,3) == "099") {
|
||||||
firework.launch('Flow start triggered, but start not possible (no flow task available)', 'danger', 5000);
|
firework.launch('Flow start triggered, but start not possible (no flow task available)', 'danger', 5000);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xhttp.open("GET", url, true);
|
xhttp.open("GET", url, true);
|
||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
function HA_send_discovery_visibility() {
|
function HA_send_discovery_visibility() {
|
||||||
loadConfig(domainname);
|
loadConfig(domainname);
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ function ParseConfig() {
|
|||||||
category[catname]["enabled"] = false;
|
category[catname]["enabled"] = false;
|
||||||
category[catname]["found"] = false;
|
category[catname]["found"] = false;
|
||||||
param[catname] = new Object();
|
param[catname] = new Object();
|
||||||
ParamAddValue(param, catname, "AutoStart");
|
//ParamAddValue(param, catname, "AutoStart");
|
||||||
ParamAddValue(param, catname, "Interval");
|
ParamAddValue(param, catname, "Interval");
|
||||||
|
|
||||||
var catname = "DataLogging";
|
var catname = "DataLogging";
|
||||||
|
|||||||
Reference in New Issue
Block a user