Fix carbon monoxide IAS zone device class mapping#713
Merged
TheJulianJES merged 2 commits intozigpy:devfrom Mar 23, 2026
Merged
Fix carbon monoxide IAS zone device class mapping#713TheJulianJES merged 2 commits intozigpy:devfrom
TheJulianJES merged 2 commits intozigpy:devfrom
Conversation
c65f47c to
c7195ef
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Updates ZHA’s IAS Zone binary sensor device class mapping so Zigbee Carbon Monoxide zone types are represented as carbon_monoxide rather than generic gas, aligning entity metadata and diagnostics with the correct Home Assistant device class.
Changes:
- Map
IasZone.ZoneType.Carbon_Monoxide_SensortoBinarySensorDeviceClass.COinstead ofGAS. - Update affected device diagnostics fixtures to expect
device_class: "carbon_monoxide".
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
zha/application/platforms/binary_sensor/const.py |
Corrects IAS Zone → HA binary sensor device class mapping for Carbon Monoxide. |
tests/data/devices/tze284-rjxqso4a-ts0601.json |
Updates expected diagnostics device_class from gas to carbon_monoxide. |
tests/data/devices/tze200-hr0tdd47-ts0601.json |
Updates expected diagnostics device_class from gas to carbon_monoxide. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
puddly
approved these changes
Mar 20, 2026
4 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #713 +/- ##
=======================================
Coverage 97.62% 97.62%
=======================================
Files 62 62
Lines 10954 10954
=======================================
Hits 10694 10694
Misses 260 260 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
This changes the device class for the
IasZone.ZoneType.Carbon_Monoxide_SensorfromBinarySensorDeviceClass.GAStoCO. This is needed for the Frient US smoke sensorAdditional information
zone_type0x0227, which is not mapped. The quirk will change it using_CONSTANT_ATTRIBUTES, as ZHA unsets the device class ifzone_typeis set, but doesn't contain a known value.change_entity_metadatatakes astrfornew_device_class, not the actualStrEnummember forBinarySensorDeviceClass. See: Change Third Reality soil moisture sensor device class3RSM0147Zzha-device-handlers#3780 (comment)_CONSTANT_ATTRIBUTESfor this due to the two issues mentioned above, both ZHA issues can be addressed later.