From 10e5ab60e36d730c69a70a0e3f388ac9da75b4f1 Mon Sep 17 00:00:00 2001 From: blakadder Date: Sat, 22 Aug 2020 15:43:57 +0200 Subject: [PATCH] add %DEVICEID% to rule variables --- tasmota/xdrv_10_rules.ino | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasmota/xdrv_10_rules.ino b/tasmota/xdrv_10_rules.ino index c2c9af422..5f232d9bd 100644 --- a/tasmota/xdrv_10_rules.ino +++ b/tasmota/xdrv_10_rules.ino @@ -718,6 +718,9 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved) RulesVarReplace(commands, F("%UPTIME%"), String(MinutesUptime())); RulesVarReplace(commands, F("%TIMESTAMP%"), GetDateAndTime(DT_LOCAL)); 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) RulesVarReplace(commands, F("%SUNRISE%"), String(SunMinutes(0))); RulesVarReplace(commands, F("%SUNSET%"), String(SunMinutes(1)));