Skip to content

feat: switch HA transport to MQTT and move fan PWM to GPIO 16 - #11

Merged
basmeerman merged 2 commits into
mainfrom
feat/mqtt-transport-gpio16
Jun 26, 2026
Merged

basmeerman merged 2 commits into
mainfrom
feat/mqtt-transport-gpio16

Conversation

@basmeerman

Copy link
Copy Markdown
Owner

Summary

Two hardware-driven changes, both verified on the assembled rig during the first USB flash (2026-06-26):

  • HA transport → MQTT. The native encrypted ESPHome api: block is commented out; mqtt: is enabled (broker auto-discovery, fancontrol topic prefix, online/offline birth & will messages). mqtt_host / mqtt_user / mqtt_password come from secrets.yaml — note mqtt_host is a bare IP (the port is the separate port: key). Revert by swapping the two blocks back.
  • Fan PWM GPIO 25 → 16 to match the wiring. GPIO 16 is free on the plain LOLIN D32 (WROOM-32, no PSRAM); only the D32 Pro (WROVER) reserves 16/17 for PSRAM. Pin map updated in CLAUDE.md, PROJECT_PLAN.md, and docs/wiring_diagram.md.

Verification

  • esphome config fancontrol.yaml ✅
  • esphome compile fancontrol.yaml ✅ (RAM 13.2%, Flash 53.4%)
  • Flashed over USB; device boots, joins WiFi (~−50 dBm), connects to the broker, and publishes live temperature (25.5 °C), humidity (75.1 %), fan_speed (52 %), plus diagnostics. restart_counter increments on each boot.

🤖 Generated with Claude Code

basmeerman and others added 2 commits June 26, 2026 21:14
Two hardware-driven changes, both verified on the assembled rig during the
first USB flash (2026-06-26):

- Home Assistant integration moved from the native encrypted ESPHome api:
  to mqtt:. The api: block is commented out; mqtt: is enabled with broker
  auto-discovery, the fancontrol topic prefix, and online/offline birth &
  will messages. mqtt_host/mqtt_user/mqtt_password come from secrets.yaml
  (mqtt_host is a bare IP — the port is the separate port: key).

- Fan PWM output moved GPIO 25 -> GPIO 16 to match the wiring. GPIO 16 is
  free on the plain LOLIN D32 (WROOM-32, no PSRAM); only the D32 Pro
  (WROVER) reserves 16/17 for PSRAM. Pin map updated in CLAUDE.md,
  PROJECT_PLAN.md, and docs/wiring_diagram.md.

Verified: device boots, joins WiFi, connects to the broker, and publishes
live temperature/humidity/fan-speed plus diagnostics.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The MQTT transport switch added mqtt_host/mqtt_user/mqtt_password !secret
references. CI/release generate a throwaway secrets.yaml inline and didn't
include these, so `esphome config` failed with "Secret 'mqtt_host' not
defined". Seed dummy values (192.0.2.1, RFC 5737 documentation IP) in both
ci.yml and release.yml.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@basmeerman
basmeerman merged commit d91bd9b into main Jun 26, 2026
1 check passed
@basmeerman
basmeerman deleted the feat/mqtt-transport-gpio16 branch June 26, 2026 19:27
basmeerman added a commit that referenced this pull request Jun 28, 2026
Two leftover native-API references in README.md after the api: -> mqtt:
switch (PR #11):

- Quick start: replaced "generate an API encryption key" with the MQTT
  broker host/user/password setup (mqtt_host is a bare IP, no port). The
  api_encryption_key is unused now that the api: block is commented out.
- Home Assistant integration: rewrote the auto-discovery paragraph to
  describe MQTT broker auto-discovery instead of the native ESPHome
  integration.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant