Skip to content

fix: Deprecated CONCENTRATION_* constants (HA 2027.8) - #1569

Merged
Ernst79 merged 2 commits into
custom-components:masterfrom
shomanjk:fix/concentration-unit-deprecations
Aug 22, 2026
Merged

fix: Deprecated CONCENTRATION_* constants (HA 2027.8)#1569
Ernst79 merged 2 commits into
custom-components:masterfrom
shomanjk:fix/concentration-unit-deprecations

Conversation

@shomanjk

@shomanjk shomanjk commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #1568

Replace deprecated CONCENTRATION_* constants in const.py with UnitOfRatio / UnitOfDensity (formaldehyde, CO2, PM2.5, PM10, TVOC). Same string values (ppm, µg/m³, mg/m³); unique_ids unchanged.

https://developers.home-assistant.io/blog/2026/06/30/new-unit-enumerators/

hacs.json homeassistant 2026.6.02026.7.0 so HACS does not offer this to Core versions that lack those enums (same approach as #1556).

Replace CONCENTRATION_* with UnitOfRatio/UnitOfDensity and raise the
HACS minimum to 2026.7.0.

Co-authored-by: Cursor <cursoragent@cursor.com>
@shomanjk

Copy link
Copy Markdown
Contributor Author

The Run tests job is red because CI still installs pytest-homeassistant-custom-component==0.13.193 (Home Assistant 2024.12.3 on Python 3.12). This change follows the 2026.7 unit enumerators (UnitOfDensity / UnitOfRatio), which that Core version does not have, so collection fails with ImportError: cannot import name 'UnitOfDensity'.

HACS and Hassfest are green. I did not bump the test harness; that would be a repo-wide CI policy change and is out of scope for this deprecation fix.

@Ernst79

Ernst79 commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Will have a look at it, but I have to look into that, as it requires an update of python to >= 3.14 as well

@Ernst79

Ernst79 commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

If you merge master into your branch, it should be working again. I've updated pytest-homeassistant-custom-component.

@Ernst79 Ernst79 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If you merge master into your branch, it should be working again. I've updated pytest-homeassistant-custom-component.

Pick up the pytest-homeassistant-custom-component / Python 3.14 CI bump from custom-components#1570 so tests can import UnitOfDensity.
@Ernst79
Ernst79 merged commit 22bf1b4 into custom-components:master Aug 22, 2026
6 checks passed
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.

[Bug]: Deprecated CONCENTRATION_* constants (removed in HA 2027.8)

2 participants