mirror of https://github.com/arendst/Tasmota.git
Added %color% variable to rules
This commit is contained in:
parent
692b7ec8c3
commit
b6aff6a41a
|
@ -471,6 +471,12 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all
|
||||||
rule_param = String(SunMinutes(1));
|
rule_param = String(SunMinutes(1));
|
||||||
}
|
}
|
||||||
#endif // USE_TIMERS and USE_SUNRISE
|
#endif // USE_TIMERS and USE_SUNRISE
|
||||||
|
#if defined(USE_LIGHT)
|
||||||
|
char scolor[LIGHT_COLOR_SIZE];
|
||||||
|
if (rule_param.startsWith(F("%COLOR%"))) {
|
||||||
|
rule_param = LightGetColor(scolor);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
// #ifdef USE_ZIGBEE
|
// #ifdef USE_ZIGBEE
|
||||||
// if (rule_param.startsWith(F("%ZBDEVICE%"))) {
|
// if (rule_param.startsWith(F("%ZBDEVICE%"))) {
|
||||||
// snprintf_P(stemp, sizeof(stemp), PSTR("0x%04X"), Z_GetLastDevice());
|
// snprintf_P(stemp, sizeof(stemp), PSTR("0x%04X"), Z_GetLastDevice());
|
||||||
|
@ -772,6 +778,10 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
|
||||||
RulesVarReplace(commands, F("%SUNRISE%"), String(SunMinutes(0)));
|
RulesVarReplace(commands, F("%SUNRISE%"), String(SunMinutes(0)));
|
||||||
RulesVarReplace(commands, F("%SUNSET%"), String(SunMinutes(1)));
|
RulesVarReplace(commands, F("%SUNSET%"), String(SunMinutes(1)));
|
||||||
#endif // USE_TIMERS and USE_SUNRISE
|
#endif // USE_TIMERS and USE_SUNRISE
|
||||||
|
#if defined(USE_LIGHT)
|
||||||
|
char scolor[LIGHT_COLOR_SIZE];
|
||||||
|
RulesVarReplace(commands, F("%COLOR%"), LightGetColor(scolor));
|
||||||
|
#endif
|
||||||
#ifdef USE_ZIGBEE
|
#ifdef USE_ZIGBEE
|
||||||
snprintf_P(stemp, sizeof(stemp), PSTR("0x%04X"), Z_GetLastDevice());
|
snprintf_P(stemp, sizeof(stemp), PSTR("0x%04X"), Z_GetLastDevice());
|
||||||
RulesVarReplace(commands, F("%ZBDEVICE%"), String(stemp));
|
RulesVarReplace(commands, F("%ZBDEVICE%"), String(stemp));
|
||||||
|
|
Loading…
Reference in New Issue