Skip to content

feat: add BGT and WBGT temperature data point support - #1401

Open
timothybrown wants to merge 2 commits into
bachya:devfrom
timothybrown:feat/add-bgt-wbgt-support
Open

feat: add BGT and WBGT temperature data point support#1401
timothybrown wants to merge 2 commits into
bachya:devfrom
timothybrown:feat/add-bgt-wbgt-support

Conversation

@timothybrown

Copy link
Copy Markdown

Reopens #1388, which was auto-closed by the stale bot after a period of maintainer inactivity. The branch is unchanged and still mergeable; resubmitting since the original could not be reopened. Original discussion: #1388

Describe what the PR does:

Adds explicit data point support for BGT (Black Globe Temperature) and WBGT (Wet Bulb Globe Temperature), which are reported by Ecowitt gateways (e.g., GW3000B) when a WH32-based black globe thermometer sensor is connected.

Currently, bgt and wbgt payload keys are not recognized by the CALCULATOR_MAP. When --output-unit-system metric is set, the TemperatureCalculator is never invoked for these fields, so the raw Fahrenheit values are passed through to MQTT unconverted. Downstream consumers receive values in Fahrenheit despite requesting metric output.

This PR adds DATA_POINT_BGT and DATA_POINT_WBGT constants and maps them to TemperatureCalculator, so they follow the same unit conversion path as all other temperature data points.

bgtbatt (the BGT sensor's battery status) already works correctly via glob_search substring matching on "batt" — no changes needed, but a test is included to confirm this.

Does this fix a specific issue?

No existing issue — discovered while building a dashboard that consumes ecowitt2mqtt output.

Checklist:

  • Confirm that one or more new tests are written for the new functionality.
  • Run tests and ensure everything passes (with 100% test coverage).
  • Update README.md with any new documentation.

README update not included — BGT/WBGT are standard Ecowitt payload fields that now "just work" like any other temperature field. Happy to add documentation if preferred.

Ecowitt gateways with WH32/WN38 BGT sensors send `bgt` (Black Globe
Temperature) and `wbgt` (Wet Bulb Globe Temperature) fields in their
HTTP payload. These values are always in Fahrenheit and were previously
unrecognized, causing raw values to pass through without unit conversion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (69e55b6) to head (3825675).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #1401   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           33        33           
  Lines         1797      1799    +2     
=========================================
+ Hits          1797      1799    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request recently, so it has automatically been marked as stale and will be closed if no further action occurs within 7 days. Thank you for your contributions.

@github-actions github-actions Bot added the stale There has not been activity on this issue or PR for some time label Jul 25, 2026

@bachya bachya left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good once CI is fixed!

@github-actions github-actions Bot removed the stale There has not been activity on this issue or PR for some time label Jul 26, 2026
The `format` pre-commit hook (ruff 0.7.3) collapsed three multi-line
signatures and two parametrize entries that fit on one line, failing the
Linting & Static Analysis CI job.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@timothybrown

Copy link
Copy Markdown
Author

Should be fixed. The only failing hook was ruff format; it wanted a few test signatures and parametrize entries collapsed onto single lines. Reformatted with ruff 0.7.3 to match the lockfile, and the full pre-commit run is clean locally.

One I can't fix from here: the Docker publish job fails with "Username and password required" since fork PRs don't get the repo secrets. It failed the same way on the previous run.

Looks like CI needs your approval to run on the new commit.

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.

2 participants