mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
Update support_button_v2.ino
This commit is contained in:
parent
639968c0ab
commit
ad18dc76e1
@ -304,7 +304,7 @@ void ButtonHandler(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttButtonTopic(uint8_t index, uint8_t action, uint8_t hold)
|
void MqttButtonTopic(uint8_t button_id, uint8_t action, uint8_t hold)
|
||||||
{
|
{
|
||||||
char scommand[CMDSZ];
|
char scommand[CMDSZ];
|
||||||
char stopic[TOPSZ];
|
char stopic[TOPSZ];
|
||||||
@ -312,8 +312,8 @@ void MqttButtonTopic(uint8_t index, uint8_t action, uint8_t hold)
|
|||||||
|
|
||||||
GetTextIndexed(mqttstate, sizeof(mqttstate), action, kMultiPress);
|
GetTextIndexed(mqttstate, sizeof(mqttstate), action, kMultiPress);
|
||||||
|
|
||||||
SendKey(KEY_BUTTON, index, (hold) ? 3 : action +9);
|
SendKey(KEY_BUTTON, button_id, (hold) ? 3 : action +9);
|
||||||
snprintf_P(scommand, sizeof(scommand), PSTR("BUTTON%d"), index);
|
snprintf_P(scommand, sizeof(scommand), PSTR("BUTTON%d"), button_id);
|
||||||
GetTopic_P(stopic, STAT, mqtt_topic, scommand);
|
GetTopic_P(stopic, STAT, mqtt_topic, scommand);
|
||||||
Response_P(S_JSON_COMMAND_SVALUE, "ACTION", (hold) ? SettingsText(SET_STATE_TXT4) : mqttstate);
|
Response_P(S_JSON_COMMAND_SVALUE, "ACTION", (hold) ? SettingsText(SET_STATE_TXT4) : mqttstate);
|
||||||
MqttPublish(stopic);
|
MqttPublish(stopic);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user