mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 14:57:16 +00:00
Add command `Rule0
`
Add command ``Rule0`` to change global rule parameters
This commit is contained in:
parent
70f51b78fe
commit
e1fbf64037
@ -53,3 +53,5 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
||||
## Changelog
|
||||
|
||||
### Version 8.3.1.1
|
||||
|
||||
- Add command ``Rule0`` to change global rule parameters
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
### 8.3.1.1 20200518
|
||||
|
||||
- Add command ``Rule0`` to change global rule parameters
|
||||
|
||||
## Released
|
||||
|
||||
### 8.3.1 20200518
|
||||
|
@ -1040,7 +1040,7 @@ void CmndModules(void)
|
||||
uint32_t j = i ? midx +1 : 0;
|
||||
if ((ResponseAppend_P(PSTR("\"%d\":\"%s\""), j, AnyModuleName(midx).c_str()) > (LOGSZ - TOPSZ)) || (i == sizeof(kModuleNiceList))) {
|
||||
ResponseJsonEndEnd();
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, UpperCase(XdrvMailbox.command, XdrvMailbox.command));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, XdrvMailbox.command);
|
||||
jsflg = false;
|
||||
lines++;
|
||||
}
|
||||
@ -1149,7 +1149,7 @@ void CmndGpios(void)
|
||||
char stemp1[TOPSZ];
|
||||
if ((ResponseAppend_P(PSTR("\"%d\":\"%s\""), ridx, GetTextIndexed(stemp1, sizeof(stemp1), midx, kSensorNames)) > (LOGSZ - TOPSZ)) || (i == ARRAY_SIZE(kGpioNiceList) -1)) {
|
||||
ResponseJsonEndEnd();
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, UpperCase(XdrvMailbox.command, XdrvMailbox.command));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, XdrvMailbox.command);
|
||||
jsflg = false;
|
||||
lines++;
|
||||
}
|
||||
|
@ -1954,6 +1954,26 @@ void RulesPreprocessCommand(char *pCommands)
|
||||
|
||||
void CmndRule(void)
|
||||
{
|
||||
if (0 == XdrvMailbox.index) {
|
||||
char data = '\0';
|
||||
if (XdrvMailbox.data_len > 0) { // Allow show all if 0
|
||||
if (!((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 10))) {
|
||||
if ('"' == XdrvMailbox.data[0]) {
|
||||
data = '"'; // Save data as XdrvMailbox.data is destroyed
|
||||
} else {
|
||||
XdrvMailbox.data_len = 0; // Discard any additional text
|
||||
}
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 1; i <= MAX_RULE_SETS; i++) {
|
||||
XdrvMailbox.index = i;
|
||||
XdrvMailbox.data[0] = data; // Only 0 or "
|
||||
CmndRule();
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, XdrvMailbox.command);
|
||||
}
|
||||
mqtt_data[0] = '\0'; // Disable further processing
|
||||
return;
|
||||
}
|
||||
uint8_t index = XdrvMailbox.index;
|
||||
if ((index > 0) && (index <= MAX_RULE_SETS)) {
|
||||
// if ((XdrvMailbox.data_len > 0) && (XdrvMailbox.data_len < sizeof(Settings.rules[index -1]))) { // TODO postpone size calculation
|
||||
|
@ -45,7 +45,6 @@
|
||||
#define D_CMND_CFGDUMP "CfgDump"
|
||||
#define D_CMND_CFGPEEK "CfgPeek"
|
||||
#define D_CMND_CFGPOKE "CfgPoke"
|
||||
#define D_CMND_CFGSHOW "CfgShow"
|
||||
#define D_CMND_CFGXOR "CfgXor"
|
||||
#define D_CMND_CPUCHECK "CpuChk"
|
||||
#define D_CMND_EXCEPTION "Exception"
|
||||
@ -459,7 +458,9 @@ void CmndCfgXor(void)
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
Web.config_xor_on_set = XdrvMailbox.payload;
|
||||
}
|
||||
ResponseCmndNumber(Web.config_xor_on_set);
|
||||
char temp[10];
|
||||
snprintf_P(temp, sizeof(temp), PSTR("0x%02X"), Web.config_xor_on_set);
|
||||
ResponseCmndChar(temp);
|
||||
}
|
||||
#endif // USE_WEBSERVER
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user