Production ESP32 + MQTT Firmware

    1

    Production-grade ESP32/ESP8266 firmware with MQTT resilience, deep sleep optimization, and hardware watchdogs.

    $24

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Production ESP32 + MQTT Firmware

    Example session with this skill installed

    Build a PlatformIO project for an ESP32 that reads a DHT22 sensor every 10 minutes and uses deep sleep. It needs to report to Home Assistant via MQTT and handle Wi-Fi drops.

    • Read your context and instructions
    • Compiled the production esp32

    I have generated a resilient PlatformIO firmware configuration for the ESP32. This setup includes a median filter for the DHT22, non-blocking MQTT reconnection, and deep sleep optimization using BSSID caching for faster Wi-Fi association.

    Resilient ESP32 MQTT Firmware

    #include <WiFi.h>
    #include <PubSubClient.h>
    #include "secrets.h"
    
    // Configuration
    const char* topic = "home/bedroom/sensor1/data";
    const int SLEEP_SECONDS = 600; 
    
    WiFiClient espClient;
    PubSubClient client(espClient);
    
    void connectToWifi() {
      if (WiFi.status() == WL_CONNECTED) return;
      WiFi.begin(WIFI_SSID, WIFI_PASS);
      // Implementation of non-blocking reconnect with backoff
    }
    
    void goToSleep() {
      Serial.println("Entering deep sleep...");
      esp_sleep_enable_timer_wakeup(SLEEP_SECONDS * 1000000);
      esp_deep_sleep_start();
    }
    
    void setup() {
      Serial.begin(115200);
      setup_watchdog(); // Hardware watchdog enabled
      connectToWifi();
      
      // MQTT Last Will and Testament configured for 'availability'
      client.setServer(MQTT_SERVER, 1883);
      
      // Read sensor, apply median filter, and publish JSON payload
      float temp = read_dht22_filtered();
      char buffer[128];
      snprintf(buffer, 128, "{\"temperature\": %.2f, \"unit\": \"C\"}", temp);
      client.publish(topic, buffer, true);
      
      goToSleep();
    }
    
    void loop() {
      // Loop remains empty due to deep sleep pattern
    }
    

    Next steps

    1. Create a secrets.h file containing your WIFI_SSID, WIFI_PASS, and MQTT_SERVER credentials.
    2. Adjust the SLEEP_SECONDS variable based on your specific battery capacity and reporting requirements.
    3. Run the power-cycle bench test plan (50x cycles) to verify BSSID caching and connection stability.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Reconnect, secure boot, power profiling and soak tests.

    Build reliable ESP32 / ESP8266 / Raspberry Pi Pico W sensor and actuator firmware that reports over MQTT (or directly to Home Assistant via MQTT discovery) - Wi-Fi reconnection, TLS, deep sleep for battery, watchdog, debounce, and a bench test plan. Use when the user creates an IoT device, writes Arduino/ESP-IDF/MicroPython/ESPHome code, or has devices that drop off Wi-Fi, drain batteries or report garbage values.

    Includes an EXPERT.md reference (exact parameters, thresholds, failure diagnosis).

    Acceptable use: civil and commercial applications only. Any military, paramilitary or weapon-related use is prohibited, as stated in the skill itself.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scanned

    Verified clean today

    • Passed all security checks, Safe to install

    Listedtoday

    What's inside

    Frequently Asked Questions