[PR #185] [MERGED] Add MQTT smart plug support for energy monitoring (Issue #173) #946

Closed
opened 2026-05-06 12:34:07 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/maziggy/bambuddy/pull/185
Author: @maziggy
Created: 1/30/2026
Status: Merged
Merged: 1/31/2026
Merged by: @maziggy

Base: 0.1.6-finalHead: feature/173


📝 Commits (4)

  • 00e3478 Add MQTT smart plug support for energy monitoring (Issue #173)
  • 04f4dcc Enhanced MQTT support with separate topics and multipliers (#173)
  • 140087e Make MQTT JSON path optional for smart plug monitoring (#173)
  • a965afa Merge branch '0.1.6-final' into feature/173

📊 Changes

24 files changed (+2211 additions, -9796 deletions)

View changed files

📝 CHANGELOG.md (+11 -53)
📝 README.md (+2 -1)
📝 backend/app/api/routes/archives.py (+15 -3)
📝 backend/app/api/routes/settings.py (+57 -1)
📝 backend/app/api/routes/smart_plugs.py (+171 -1)
📝 backend/app/core/database.py (+40 -92)
📝 backend/app/main.py (+34 -1)
📝 backend/app/models/smart_plug.py (+33 -6)
📝 backend/app/schemas/smart_plug.py (+52 -2)
📝 backend/app/services/mqtt_relay.py (+32 -1)
backend/app/services/mqtt_smart_plug.py (+488 -0)
📝 backend/tests/conftest.py (+34 -0)
📝 backend/tests/integration/test_smart_plugs_api.py (+191 -136)
📝 frontend/src/__tests__/components/SmartPlugCard.test.tsx (+88 -0)
📝 frontend/src/api/client.ts (+50 -3)
📝 frontend/src/components/AddSmartPlugModal.tsx (+290 -177)
📝 frontend/src/components/SmartPlugCard.tsx (+122 -150)
📝 frontend/src/components/SwitchbarPopover.tsx (+57 -64)
📝 frontend/src/pages/SettingsPage.tsx (+10 -6)
📝 static/assets/index-BJQC4Kk-.js (+431 -431)

...and 4 more files

📄 Description

Add support for MQTT-based smart plugs that subscribe to external MQTT topics and extract power/energy data from JSON payloads. This enables integration with Zigbee2MQTT, Shelly, Tasmota discovery, and other MQTT-enabled energy monitoring devices.

Features:

  • New "mqtt" plug type alongside tasmota and homeassistant
  • Subscribe to any MQTT topic with configurable JSON paths
  • Extract power, energy, and state values using dot notation
  • Optional multiplier for unit conversion (mW to W, etc.)
  • Monitor-only mode (no on/off control) with teal color scheme
  • Reuses existing MQTT broker settings from network configuration
  • Energy data included in statistics and per-print tracking
  • Full backup/restore support for MQTT plug configurations

Closes #173


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/maziggy/bambuddy/pull/185 **Author:** [@maziggy](https://github.com/maziggy) **Created:** 1/30/2026 **Status:** ✅ Merged **Merged:** 1/31/2026 **Merged by:** [@maziggy](https://github.com/maziggy) **Base:** `0.1.6-final` ← **Head:** `feature/173` --- ### 📝 Commits (4) - [`00e3478`](https://github.com/maziggy/bambuddy/commit/00e3478a3ebc03f0780c2dd913f0d47e5156597b) Add MQTT smart plug support for energy monitoring (Issue #173) - [`04f4dcc`](https://github.com/maziggy/bambuddy/commit/04f4dccd411530981b82d507f35f87f33f859bce) Enhanced MQTT support with separate topics and multipliers (#173) - [`140087e`](https://github.com/maziggy/bambuddy/commit/140087eeb74b04350b728c284711721fcd5786e3) Make MQTT JSON path optional for smart plug monitoring (#173) - [`a965afa`](https://github.com/maziggy/bambuddy/commit/a965afa6cb3064c9086f9f37ebe546813e6af730) Merge branch '0.1.6-final' into feature/173 ### 📊 Changes **24 files changed** (+2211 additions, -9796 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+11 -53) 📝 `README.md` (+2 -1) 📝 `backend/app/api/routes/archives.py` (+15 -3) 📝 `backend/app/api/routes/settings.py` (+57 -1) 📝 `backend/app/api/routes/smart_plugs.py` (+171 -1) 📝 `backend/app/core/database.py` (+40 -92) 📝 `backend/app/main.py` (+34 -1) 📝 `backend/app/models/smart_plug.py` (+33 -6) 📝 `backend/app/schemas/smart_plug.py` (+52 -2) 📝 `backend/app/services/mqtt_relay.py` (+32 -1) ➕ `backend/app/services/mqtt_smart_plug.py` (+488 -0) 📝 `backend/tests/conftest.py` (+34 -0) 📝 `backend/tests/integration/test_smart_plugs_api.py` (+191 -136) 📝 `frontend/src/__tests__/components/SmartPlugCard.test.tsx` (+88 -0) 📝 `frontend/src/api/client.ts` (+50 -3) 📝 `frontend/src/components/AddSmartPlugModal.tsx` (+290 -177) 📝 `frontend/src/components/SmartPlugCard.tsx` (+122 -150) 📝 `frontend/src/components/SwitchbarPopover.tsx` (+57 -64) 📝 `frontend/src/pages/SettingsPage.tsx` (+10 -6) 📝 `static/assets/index-BJQC4Kk-.js` (+431 -431) _...and 4 more files_ </details> ### 📄 Description Add support for MQTT-based smart plugs that subscribe to external MQTT topics and extract power/energy data from JSON payloads. This enables integration with Zigbee2MQTT, Shelly, Tasmota discovery, and other MQTT-enabled energy monitoring devices. Features: - New "mqtt" plug type alongside tasmota and homeassistant - Subscribe to any MQTT topic with configurable JSON paths - Extract power, energy, and state values using dot notation - Optional multiplier for unit conversion (mW to W, etc.) - Monitor-only mode (no on/off control) with teal color scheme - Reuses existing MQTT broker settings from network configuration - Energy data included in statistics and per-print tracking - Full backup/restore support for MQTT plug configurations Closes #173 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:34:07 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy#946
No description provided.