mirror of https://github.com/arendst/Tasmota.git
Merge pull request #7234 from gemu2015/scripter-update
scripter FUNC_SET_POWER into separate section >P
This commit is contained in:
commit
246e026970
|
@ -1030,8 +1030,10 @@ char *isvar(char *lp, uint8_t *vtype,struct T_INDEX *tind,float *fp,char *sp,Jso
|
|||
if ((*jo).is<char*>(vn)) {
|
||||
if (!strncmp(str_value,"ON",2)) {
|
||||
if (fp) *fp=1;
|
||||
goto nexit;
|
||||
} else if (!strncmp(str_value,"OFF",3)) {
|
||||
if (fp) *fp=0;
|
||||
goto nexit;
|
||||
} else {
|
||||
*vtype=STR_RES;
|
||||
tind->bits.constant=1;
|
||||
|
@ -1039,6 +1041,7 @@ char *isvar(char *lp, uint8_t *vtype,struct T_INDEX *tind,float *fp,char *sp,Jso
|
|||
if (sp) strlcpy(sp,str_value,SCRIPT_MAXSSIZE);
|
||||
return lp+len;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (fp) {
|
||||
if (!strncmp(vn.c_str(),"Epoch",5)) {
|
||||
|
@ -1047,6 +1050,7 @@ char *isvar(char *lp, uint8_t *vtype,struct T_INDEX *tind,float *fp,char *sp,Jso
|
|||
*fp=CharToFloat((char*)str_value);
|
||||
}
|
||||
}
|
||||
nexit:
|
||||
*vtype=NUM_RES;
|
||||
tind->bits.constant=1;
|
||||
tind->bits.is_string=0;
|
||||
|
@ -4843,6 +4847,12 @@ bool Xdrv10(uint8_t function)
|
|||
result = ScriptCommand();
|
||||
break;
|
||||
case FUNC_SET_POWER:
|
||||
#ifdef SCRIPT_POWER_SECTION
|
||||
if (bitRead(Settings.rule_enabled, 0)) Run_Scripter(">P",2,0);
|
||||
#else
|
||||
if (bitRead(Settings.rule_enabled, 0)) Run_Scripter(">E",2,0);
|
||||
#endif
|
||||
break;
|
||||
case FUNC_RULES_PROCESS:
|
||||
if (bitRead(Settings.rule_enabled, 0)) Run_Scripter(">E",2,mqtt_data);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue