diff --git a/tasmota/xdrv_02_mqtt.ino b/tasmota/xdrv_02_mqtt.ino index c766ab247..2a15c33df 100644 --- a/tasmota/xdrv_02_mqtt.ino +++ b/tasmota/xdrv_02_mqtt.ino @@ -719,6 +719,16 @@ bool ButtonTopicActive(void) return ((strlen(key_topic) != 0) && strcmp(key_topic, "0")); } +bool KeyTopicActive(uint32_t key) +{ + // key = 0 - Button topic + // key = 1 - Switch topic + key &= 1; + char key_topic[TOPSZ]; + Format(key_topic, SettingsText(SET_MQTT_BUTTON_TOPIC + key), sizeof(key_topic)); + return ((strlen(key_topic) != 0) && strcmp(key_topic, "0")); +} + /*********************************************************************************************\ * Commands \*********************************************************************************************/