Skip to content

Fix deprecated concentration constants - #2906

Open
hmmbob wants to merge 1 commit into
al-one:masterfrom
hmmbob:agent/fix-concentration-constants
Open

Fix deprecated concentration constants#2906
hmmbob wants to merge 1 commit into
al-one:masterfrom
hmmbob:agent/fix-concentration-constants

Conversation

@hmmbob

@hmmbob hmmbob commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #2905.

Partially addresses #2870 and #2897.

What changed

  • Use UnitOfDensity and UnitOfRatio for concentration units on Home Assistant 2026.7 and newer.
  • Define matching local StrEnum fallbacks in core/const.py for older supported Home Assistant versions.
  • Replace CONCENTRATION_PARTS_PER_CUBIC_METER with its recommended p/m³ literal.
  • Add unit assertions that run in both the stable and minimum-version test jobs.

Why

Home Assistant 2026.8 deprecated the four CONCENTRATION_* constants used by miot_spec.py, which emits warnings whenever the integration is imported.

UnitOfDensity and UnitOfRatio were introduced in Home Assistant 2026.7, while this repository declares and tests Home Assistant 2025.6.0 as its minimum. The compatibility definitions preserve that existing minimum rather than requiring it to be raised.

Home Assistant references:

Validation

  • Compiled the integration with python -m compileall.
  • Imported core.const and core.miot_spec on Home Assistant 2026.8.0b2 without concentration deprecation warnings.
  • Exercised the pre-2026.7 fallback path in isolation and verified μg/m³, mg/m³, and ppm.
  • The repository CI matrix will run the added assertions against stable Home Assistant and the declared 2025.6.0 minimum.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@hmmbob
hmmbob marked this pull request as ready for review July 31, 2026 09:30
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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.

HA 2026.8.0 beta deprecation warnings for "concentration"

1 participant