global state request

This commit is contained in:
Siwat Sirichai 2024-05-20 00:44:18 +07:00
parent 6b67591cc1
commit ea49576b20
2 changed files with 11 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.DS_Store .DS_Store
/ESPMegaPRO-OS-SDK

View File

@ -56,6 +56,16 @@ void ESPMegaIoT::mqttCallback(char *topic, byte *payload, unsigned int length)
{ {
callback.second(topic_without_base, payload_buffer); callback.second(topic_without_base, payload_buffer);
} }
// Check for global state request
if (!strcmp(topic_without_base,"requeststate")) {
for (int i = 0; i < 255; i++)
{
if (components[i] != NULL)
{
components[i]->publishReport();
}
}
}
// Call the respective card's mqtt callback // Call the respective card's mqtt callback
// Note that after the base topic, there should be the card id // Note that after the base topic, there should be the card id
// /base_topic/card_id/... // /base_topic/card_id/...