WIFI Switch with ESP32 using MQTT

Job ID: 40449450

Budget: ₹1,500 – ₹12,500 INR

I already have a custom board built around an ESP32-D, the accompanying PlatformIO project, and fully working low-level drivers for Wi-Fi, MQTT, GPIO and storage. What I still need is the high-level logic that ties everything together so the device behaves like an intelligent Wi-Fi switch.

Here is what the finished sketch must do:

• Subscribe to a dedicated MQTT topic and parse the JSON commands coming from my mobile app.
• Execute each command immediately, switching the relay output on or off and publishing an acknowledgement with a timestamp.
• Monitor the on-board push-button; every manual activation should be time-stamped, stored locally, and later pushed to the same MQTT broker so that no event is ever lost if the connection drops.
• Run both daily and weekly schedules defined in the incoming JSON (for example “every day at 06:30” or “Mon–Fri at 18:00, Sat-Sun at 20:00”). The schedule must survive resets and resume automatically after power loss.
• On-demand timer needs to be turned on when the signal is provided through the MQTT subscribed topic.
• Keep the code clean, modular and easy to extend; all constants (topics, pins, debounce time, etc.) should be grouped in one place for quick edits.

Operational libraries and boilerplate are already present in the project; you only have to write the state-machine / scheduler layer and integrate it with the existing MQTT and storage helpers. Once complete, deliver the full PlatformIO source tree so I can compile and flash it myself.

The project is time-sensitive, so please be ready to start right away and hand over a working, well-commented solution as soon as possible.