Skip to content

Add Halo Smart Labs smoke and CO detector quirks#4842

Open
alex-savin wants to merge 5 commits intozigpy:devfrom
alex-savin:halo-smart-labs-pr
Open

Add Halo Smart Labs smoke and CO detector quirks#4842
alex-savin wants to merge 5 commits intozigpy:devfrom
alex-savin:halo-smart-labs-pr

Conversation

@alex-savin
Copy link
Copy Markdown

Proposed change

  • add Halo Smart Labs quirks for the base halo smoke and CO detector and the weather-capable halo+ variants
  • support the halo+, haloWX, and SABDA1 Zigbee model aliases with manufacturer-specific status, control, sensor, and weather clusters
  • expose diagnostic entities and command buttons for alert state, test state, hush state, CO ppm, weather radio controls, station selection, and location programming
  • fix the EP2 color cluster capabilities for the integrated night-light LED
  • add focused Halo unit tests covering quirk registration, model matching, enum mappings, attribute converters, and cluster attribute updates

Additional information

  • Halo-focused tests passed locally with .venv/bin/pytest tests/test_halo.py.
  • I did not mark pre-commit as passing because the current local environment has Ruff 0.15.6 installed, and that version rejects the repository configuration entry for rule S320. The Halo change itself was still verified with pytest.
  • Device diagnostics still need to be attached manually in GitHub if required by maintainers.

Device diagnostics

Diagnostics not attached yet.

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works
  • Device diagnostics data has been attached

Copilot AI review requested due to automatic review settings March 20, 2026 21:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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, and SABDA1.
  • 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.

Comment on lines +162 to +167
SMW = 0x39
Unrecognized_S = 0x3A
Unrecognized_M = 0x3B
Unrecognized_E = 0x3C
Unrecognized_A = 0x3D
Unrecognized_W = 0x3E
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

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.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +535 to +546
(
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,
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +335 to +342
_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,
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +46
Safe = 0x00
Low_battery = 0x01
End_of_life = 0x02
Pre_smoke = 0x04
Weather = 0x05
Carbon_monoxide = 0x06
Smoke = 0x07
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

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.

Copilot generated this review using guidance from repository custom instructions.
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.86%. Comparing base (c5634ab) to head (6c32f09).

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.
📢 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.

Copilot AI review requested due to automatic review settings March 20, 2026 22:04
@alex-savin alex-savin review requested due to automatic review settings March 20, 2026 22:04
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