victron-esp32-ble-mqtt/include/example.config.h

65 lines
3.5 KiB
C

#pragma once
// ── WiFi ──────────────────────────────────────────────────────────────────────
#define WIFI_SSID "your_wifi_ssid"
#define WIFI_PASSWORD "your_wifi_password"
// 1 = disable WiFi modem sleep (recommended: lower latency, fewer dropped
// MQTT keepalives). 0 = allow modem sleep for lower power draw.
#define WIFI_DISABLE_POWER_SAVE 1
// ── MQTT broker ───────────────────────────────────────────────────────────────
#define MQTT_HOST "192.168.1.x" // IP address of your MQTT broker
#define MQTT_PORT 1883
#define MQTT_CLIENT_ID "esp32-victron"
// Leave blank if your broker has no auth:
#define MQTT_USER ""
#define MQTT_PASSWORD ""
// ── MQTT topics ───────────────────────────────────────────────────────────────
#define MQTT_TOPIC_DATA "solar/mppt/data"
#define MQTT_TOPIC_STATUS "solar/mppt/status"
// Runtime diagnostics: uptime, RSSI, heap, reconnect counts, BLE age
#define MQTT_TOPIC_DIAG "solar/mppt/diag"
// ── Victron SmartSolar MPPT ───────────────────────────────────────────────────
// MAC address of your Victron device (lowercase, colon-separated)
// Find it in Victron Connect app → device → top-right menu → Product Info
#define VICTRON_MAC "xx:xx:xx:xx:xx:xx"
// 32-character hex encryption key
// Find it in Victron Connect app → device → top-right menu → Product Info → Instant readout details
#define VICTRON_ENC_KEY "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
// ── Home Assistant discovery ──────────────────────────────────────────────────
// 1 = publish MQTT discovery configs, 0 = only publish data/status/diag.
#define HA_DISCOVERY_ENABLED 1
// Discovery topic prefix used by Home Assistant (usually "homeassistant").
#define HA_DISCOVERY_PREFIX "homeassistant"
// Device identity. Change both for a second MPPT so the entities do not collide.
// HA_DEVICE_ID forms the discovery topic path and the device identifier.
// HA_UNIQUE_PREFIX prefixes each entity's unique_id.
#define HA_DEVICE_ID "victron_smartsolar_garage"
#define HA_UNIQUE_PREFIX "victron_mppt"
#define HA_DEVICE_NAME "Victron SmartSolar MPPT"
#define HA_MODEL "SmartSolar MPPT 100/20"
#define HA_MANUFACTURER "Victron Energy"
// ── Timing ────────────────────────────────────────────────────────────────────
// How often to publish to MQTT (milliseconds)
#define PUBLISH_INTERVAL_MS 10000
// BLE passive scan timing (milliseconds). Window must be <= interval.
// 50/100 = 50% duty cycle: reliable reception without starving WiFi.
#define BLE_SCAN_INTERVAL_MS 100
#define BLE_SCAN_WINDOW_MS 50
// Scan in blocks; NimBLE 1.4.x frees its result list only when a scan ends.
#define BLE_SCAN_PERIOD_S 30
#define BLE_SCAN_PAUSE_MS 1000
// How often to publish the diagnostics payload (milliseconds)
#define DIAG_INTERVAL_MS 60000