[SOLVED] Send mqtt command periodically to offline device until is online

I have a sonoff wall switch and two sonoff basic switches in every ceiling lamp. These basic switches is powered (online) only when is wall switch relay on. Problem is when i turn on wall switch, i have to wait until basic switches are connected to network. Can i send command to offline switch, which is automatic resend when is switch connected? Sorry for my bad english. Thank you

Change your wiring and have the ceiling lamp sonoff always powered. That’s what I do.

Before:

After:

1 Like

This is the sorry of situation the retain but was created for. Create a broker configuration in mqtt.cfg that has the retain set to true. Use this broker for the messages to theses devices.

When the sonoff reconnects to the broker, it will receive what ever was the last message posted.

But beware. Even if the message was posted last week or last year, the sonoff will receive that message when it connects to the broker.

This is exactly what i need. Thank you!