Merge pull request #9142 from blakadder/deviceid

add %DEVICEID% to possible rule variables
This commit is contained in:
Theo Arends 2020-08-22 18:05:45 +02:00 committed by GitHub
commit 2891628de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -719,6 +719,9 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
RulesVarReplace(commands, F("%UPTIME%"), String(MinutesUptime())); RulesVarReplace(commands, F("%UPTIME%"), String(MinutesUptime()));
RulesVarReplace(commands, F("%TIMESTAMP%"), GetDateAndTime(DT_LOCAL)); RulesVarReplace(commands, F("%TIMESTAMP%"), GetDateAndTime(DT_LOCAL));
RulesVarReplace(commands, F("%TOPIC%"), mqtt_topic); RulesVarReplace(commands, F("%TOPIC%"), mqtt_topic);
char unique_id[7];
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X"), ESP_getChipId());
RulesVarReplace(commands, F("%DEVICEID%"), unique_id);
#if defined(USE_TIMERS) && defined(USE_SUNRISE) #if defined(USE_TIMERS) && defined(USE_SUNRISE)
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)));