Fix support bundle reporting 0 AMS units

raw_data["ams"] is stored as a list by the MQTT handler, but the
support info code only checked for a nested dict format. AMS unit
and tray counts were always 0.
This commit is contained in:
maziggy
2026-02-10 12:17:53 +01:00
parent 31c8334538
commit a5706fe20a
2 changed files with 11 additions and 7 deletions
+1
View File
@@ -41,6 +41,7 @@ All notable changes to Bambuddy will be documented in this file.
- **Energy Cost Shows 0.00 in "Total Consumption" Mode** ([#284](https://github.com/maziggy/bambuddy/issues/284)) — Statistics Quick Stats showed 0.00 energy cost when Energy Display Mode was set to "Total Consumption" with Home Assistant smart plugs. The `homeassistant_service` was not configured with HA URL/token before querying plug energy data, causing it to silently return nothing.
- **H2D Pro Prints Fail at ~75% With Extrusion Motor Overload** ([#245](https://github.com/maziggy/bambuddy/issues/245)) — H2D Pro firmware interprets `use_ams: 1` (integer) as a nozzle index, routing filament to the deputy nozzle instead of the main nozzle. Bambu Studio sends `use_ams: true` (boolean) while using integers for other fields. Fixed by keeping `use_ams` as boolean for all printers including H2D series.
- **GitHub Backup Description Misleading** — The "App Settings" backup card said "excludes sensitive data" but the complete database is pushed. Updated description to "complete database."
- **Support Bundle Shows 0 AMS Units** — The support info always reported `ams_unit_count: 0` because it expected `raw_data["ams"]` to be a nested dict (`{"ams": [...]}`) but the MQTT handler stores it as a flat list. Now handles both formats.
### Documentation
- **Supported Printers Updated** — Updated README, website, and wiki to list all 12 supported Bambu Lab printer models: X1, X1C, X1E, P1P, P1S, P2S, A1, A1 Mini, H2D, H2D Pro, H2C, H2S. Removed outdated "Testers Needed" messaging and Tested/Needs Testing distinctions — all models are now uniformly listed as supported. Added H2C printer image to website. Added H2D Pro, H2C columns to wiki feature comparison tables and new P2 Series section.
+10 -7
View File
@@ -463,13 +463,16 @@ async def _collect_support_info() -> dict:
has_vt_tray = False
if state:
ams_data = state.raw_data.get("ams")
if isinstance(ams_data, dict) and "ams" in ams_data:
ams_units = ams_data["ams"]
if isinstance(ams_units, list):
ams_unit_count = len(ams_units)
for unit in ams_units:
trays = unit.get("tray", [])
ams_tray_count += len([t for t in trays if t.get("tray_type")])
if isinstance(ams_data, list):
ams_units = ams_data
elif isinstance(ams_data, dict) and "ams" in ams_data:
ams_units = ams_data["ams"] if isinstance(ams_data["ams"], list) else []
else:
ams_units = []
ams_unit_count = len(ams_units)
for unit in ams_units:
trays = unit.get("tray", [])
ams_tray_count += len([t for t in trays if t.get("tray_type")])
has_vt_tray = state.raw_data.get("vt_tray") is not None
info["printers"].append(