Files
voice_assistant/config.h
Sam Rolfe 611fdf812b Directive 3: ESP32 MQTT auto-reconnect, heartbeat, MQTT-state LED, drop logging
- Reconnect and re-subscribe on every (re)connect; log the subscribe result.
- Heartbeat every 5 min on voice/audio_stream (valid silent PCM frame) so the
  Directive-1 watchdog can tell "device dead" from "nobody spoke". voice_bridge
  treats it as silence and ignores it.
- Retained LWT "offline" / "online" presence on voice/status for layer
  attribution in the watchdog.
- LED: green now means MQTT connected AND publishing. Wi-Fi down = red blink,
  Wi-Fi up but MQTT down = amber blink. Never green without MQTT.
- Log the reason on every drop: PubSubClient state code, or the Wi-Fi
  disconnect reason from the Wi-Fi event.
- Bound the I2S read (50 ms) so Wi-Fi/MQTT housekeeping cannot stall; reset a
  stale streaming state on disconnect (the stuck-green bug).
- Document the MQTT/LED contract in README; flag config.h and led_control.h as
  stale drafts so they cannot creep back as a second config.
- Credentials stay placeholders; nothing secret is committed.

Not flashed/tested: no ESP32 and no arduino-cli is reachable from the build
environment. Hardware-in-the-loop verification needs a human at the device.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-14 10:59:19 +11:00

38 lines
1.3 KiB
C

#pragma once
// STALE / UNUSED. This file is an early draft and is NOT compiled: the sketch
// voice_assistant.ino does not include it and holds the live config itself.
// The values below are wrong for the running device (broker .30 and the
// homeassistant/voice/* topics belong to an older design). Kept only so old
// checkouts do not break; do not add a second config here.
// --- WiFi ---
const char* WIFI_SSID = "Aussie Broadband 8729";
const char* WIFI_PASS = "WIFI_PASS_REDACTED";
// --- MQTT ---
const char* MQTT_BROKER = "192.168.20.30";
const int MQTT_PORT = 1883;
const char* MQTT_USER = "MQTT_USER_REDACTED";
const char* MQTT_PASS = "MQTT_PASS_REDACTED";
// --- MQTT Topics ---
const char* TOPIC_AUDIO = "homeassistant/voice/audio";
const char* TOPIC_ACK = "homeassistant/voice/ack"; // HA replies here
// --- Hardware Pins (ESP32-S3) ---
// CHECK YOUR BOARD IMAGE FOR THESE PINS
#define I2S_SD 10 // Serial Data (INMP441 SD)
#define I2S_WS 11 // Word Select (INMP441 WS/LRCK)
#define I2S_SCK 12 // Serial Clock (INMP441 SCK/BCLK)
// --- LED Ring ---
#define LED_PIN 48 // CHECK PIN (Often 48 on S3-Zero, or 21, 38, etc)
#define NUM_LEDS 12
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
// --- Audio ---
#define SAMPLE_RATE 16000
#define BUFFER_LEN 1024 // Buffer size for MQTT chunks