1
mirror of https://github.com/rvdbreemen/OTGW-firmware synced 2024-11-16 04:33:49 +01:00

fixing doAutoconfigure for all ids

This commit is contained in:
Robert van den Breemen 2022-01-04 01:24:04 +01:00
parent 6bc1df7fdc
commit acfa6cce31
3 changed files with 18 additions and 13 deletions

View File

@ -348,6 +348,7 @@ String trimVal(char *in)
} // trimVal()
void PrintMQTTError(){
MQTTDebugln();
switch (MQTTclient.state())
{
case MQTT_CONNECTION_TIMEOUT : MQTTDebugTln(F("Error: MQTT connection timeout"));break;
@ -504,10 +505,14 @@ void clearMQTTConfigDone()
}
//===========================================================================================
void doAutoConfigure(){
//force all sensors to be sent to auto configuration
for (int i=0; i<255; i++){
doAutoConfigureMsgid((byte)i);
}
// bool success = doAutoConfigure("config"); // the string "config" should match every line non-comment in mqttha.cfg
}
//===========================================================================================
bool doAutoConfigure(byte OTid)
bool doAutoConfigureMsgid(byte OTid)
{
bool _result = false;

View File

@ -1442,16 +1442,16 @@ void processOT(const char *buf, int len){
// check wheter MQTT topic needs to be configuered
if (is_value_valid(OTdata, OTlookupitem) && settingMQTTenable ) {
if(getMQTTConfigDone(OTdata.id)==false) {
Debugf("Need to set MQTT config for message %s (%d)\r\n", OTlookupitem.label, OTdata.id);
bool success = doAutoConfigure(OTdata.id);
MQTTDebugTf("Need to set MQTT config for message %s (%d)\r\n", OTlookupitem.label, OTdata.id);
bool success = doAutoConfigureMsgid(OTdata.id);
if(success) {
Debugf("Successfully sent MQTT config for message %s (%d)\r\n", OTlookupitem.label, OTdata.id);
MQTTDebugTf("Successfully sent MQTT config for message %s (%d)\r\n", OTlookupitem.label, OTdata.id);
setMQTTConfigDone(OTdata.id);
} else {
Debugf("Not able to complete MQTT configuration for message %s (%d)\r\n", OTlookupitem.label, OTdata.id);
MQTTDebugTf("Not able to complete MQTT configuration for message %s (%d)\r\n", OTlookupitem.label, OTdata.id);
}
} else {
// Debugf("No need to set MQTT config for message %s (%d)\r\n", OTlookupitem.label, OTdata.id);
// MQTTDebugTf("No need to set MQTT config for message %s (%d)\r\n", OTlookupitem.label, OTdata.id);
}
}

View File

@ -2,15 +2,15 @@
#define _VERSION_MAJOR 0
#define _VERSION_MINOR 9
#define _VERSION_PATCH 2
#define _VERSION_BUILD 1557
#define _VERSION_GITHASH "0419734"
#define _VERSION_BUILD 1565
#define _VERSION_GITHASH "6bc1df7"
#define _VERSION_PRERELEASE beta
#define _VERSION_DATE "04-01-2022"
#define _VERSION_TIME "00:49:41"
#define _VERSION_TIME "01:23:28"
#define _SEMVER_CORE "0.9.2"
#define _SEMVER_BUILD "0.9.2+1557"
#define _SEMVER_GITHASH "0.9.2+0419734"
#define _SEMVER_FULL "0.9.2-beta+0419734"
#define _SEMVER_BUILD "0.9.2+1565"
#define _SEMVER_GITHASH "0.9.2+6bc1df7"
#define _SEMVER_FULL "0.9.2-beta+6bc1df7"
#define _SEMVER_NOBUILD "0.9.2-beta (04-01-2022)"
#define _VERSION "0.9.2-beta+0419734 (04-01-2022)"
#define _VERSION "0.9.2-beta+6bc1df7 (04-01-2022)"
//The version information is created automatically, more information here: https://github.com/rvdbreemen/autoinc-semver