Add function KeyTopicActive(key)

Add function KeyTopicActive(key)
This commit is contained in:
Theo Arends 2020-03-12 12:11:33 +01:00
parent b0399a550e
commit 057ff37263
1 changed files with 10 additions and 0 deletions

View File

@ -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
\*********************************************************************************************/