Add Halo Smart Labs smoke and CO detector quirks#4842
Add Halo Smart Labs smoke and CO detector quirks#4842alex-savin wants to merge 5 commits intozigpy:devfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds ZHA v2 quirks for Halo Smart Labs smoke/CO detectors (Halo and Halo+ variants), defining manufacturer-specific clusters and exposing Home Assistant entities/buttons for device status, controls, CO readings, and (for Halo+) weather radio features.
Changes:
- Introduces Halo-specific custom clusters/enums and registers v2 quirks for
halo,halo+,haloWX, andSABDA1. - Adds Halo Smart Labs manufacturer package constant.
- Adds unit tests covering quirk registration/matching, enums, converters, and attribute updates.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
zhaquirks/halolabs/halo.py |
New Halo/Halo+ quirk implementations with custom clusters, entities, and command buttons. |
zhaquirks/halolabs/__init__.py |
Adds Halo Smart Labs manufacturer constant for quirk matching. |
tests/test_halo.py |
Adds tests validating quirk registration, enum mappings, converters, and attribute cache updates. |
| SMW = 0x39 | ||
| Unrecognized_S = 0x3A | ||
| Unrecognized_M = 0x3B | ||
| Unrecognized_E = 0x3C | ||
| Unrecognized_A = 0x3D | ||
| Unrecognized_W = 0x3E |
There was a problem hiding this comment.
WeatherAlertCode also introduces enum members with underscores (e.g., Unrecognized_S, Unrecognized_M, etc.). For consistency with other enums in the codebase, these should be renamed to PascalCase without underscores (e.g., UnrecognizedS) and any references updated.
zhaquirks/halolabs/halo.py
Outdated
| ( | ||
| QuirkBuilder(HALO_SMART_LABS, "halo+") | ||
| .applies_to(HALO_SMART_LABS, "haloWX") | ||
| .applies_to(HALO_SMART_LABS, "SABDA1") | ||
| .replaces(HaloColorCluster, endpoint_id=2) | ||
| .replaces(HaloStatusCluster, endpoint_id=4) | ||
| .replaces(HaloControlCluster, endpoint_id=4) | ||
| .replaces(HaloSensorsCluster, endpoint_id=4) | ||
| .replaces(HaloWeatherCluster, endpoint_id=5) | ||
| # -- IAS Zone binary sensors (same as base Halo) -- | ||
| .binary_sensor( | ||
| attribute_name=IasZone.AttributeDefs.zone_status.name, |
There was a problem hiding this comment.
The QuirkBuilder chains for halo and halo+ repeat a large block of identical entity definitions (IAS Zone derived sensors, status/control/sensors entities, and command buttons). This duplication increases the chance that future changes/fixes get applied to one model but not the other. Consider extracting a small helper (e.g., a function that takes a builder and adds the common entities) and then extend it with the Halo+ weather-specific entities.
| _CONSTANT_ATTRIBUTES = { | ||
| Color.AttributeDefs.color_capabilities.id: ( | ||
| Color.ColorCapabilities.Hue_and_saturation | ||
| | Color.ColorCapabilities.XY_attributes | ||
| ), | ||
| Color.AttributeDefs.color_temp_physical_min.id: 153, | ||
| Color.AttributeDefs.color_temp_physical_max.id: 500, | ||
| } |
There was a problem hiding this comment.
HaloColorCluster docstring says to force HS color + color temperature support, but color_capabilities is set to Hue_and_saturation | XY_attributes and does not include the Color_temperature capability bit. This likely prevents HA/ZHA from enabling color temperature control even though min/max color temps are provided. Update the constant to include the color temperature capability (or adjust the docstring/min/max attributes if the device truly does not support color temperature).
| Safe = 0x00 | ||
| Low_battery = 0x01 | ||
| End_of_life = 0x02 | ||
| Pre_smoke = 0x04 | ||
| Weather = 0x05 | ||
| Carbon_monoxide = 0x06 | ||
| Smoke = 0x07 |
There was a problem hiding this comment.
Enum members in t.enum8/t.enum16 classes are consistently written in PascalCase without underscores elsewhere in this repo (e.g., NormallyOpen, UnderfloorHeating). Here, several new enum values use underscores (Low_battery, End_of_life, Pre_smoke, Carbon_monoxide, etc.), which breaks that convention and makes the generated string representations inconsistent. Rename these enum members to PascalCase and update references accordingly.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #4842 +/- ##
==========================================
+ Coverage 92.76% 92.86% +0.10%
==========================================
Files 385 387 +2
Lines 12818 13008 +190
==========================================
+ Hits 11890 12080 +190
Misses 928 928 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Proposed change
halosmoke and CO detector and the weather-capablehalo+variantshalo+,haloWX, andSABDA1Zigbee model aliases with manufacturer-specific status, control, sensor, and weather clustersAdditional information
.venv/bin/pytest tests/test_halo.py.pre-commitas passing because the current local environment has Ruff 0.15.6 installed, and that version rejects the repository configuration entry for ruleS320. The Halo change itself was still verified with pytest.Device diagnostics
Diagnostics not attached yet.
Checklist
pre-commitchecks pass / the code has been formatted using Black