Skip to content

Fix AirCube ZHA quirk import on current zigpy#12

Open
georgemclaughlin wants to merge 1 commit intoStuckAtPrototype:masterfrom
georgemclaughlin:pr/fix-zha-quirk
Open

Fix AirCube ZHA quirk import on current zigpy#12
georgemclaughlin wants to merge 1 commit intoStuckAtPrototype:masterfrom
georgemclaughlin:pr/fix-zha-quirk

Conversation

@georgemclaughlin
Copy link
Copy Markdown

Summary

Fix the AirCube ZHA quirk for newer zigpy/Home Assistant versions by adding a missing device_class to the eCO2 sensor metadata.

Problem

On current Home Assistant / zigpy, the custom quirk can fail to import with:

ValueError: EntityMetadata must have a translation_key or device_class

This prevents the custom AirCube entities from loading in ZHA.

Change

Add device_class=SensorDeviceClass.CO2 to the eco2 sensor definition in zha/aircube.py.

Verification

Verified against Home Assistant logs:

  • before: custom quirk import failed
  • after: quirk loads and matches as zigpy.quirks.v2.CustomDeviceV2
  • ZHA now exposes the expected AirCube sensors, including carbon dioxide, VOC, and AQI

@StuckAtPrototype
Copy link
Copy Markdown
Owner

oh no, I pushed this on error. Thanks! That said, the values need to become eCO2 not CO2 so it is not misleading.

Copy link
Copy Markdown

@nicholas1513 nicholas1513 left a comment

Choose a reason for hiding this comment

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

@StuckAtPrototype like this? to match the fallback name on line 33/34 ?

AirQualityCluster.cluster_id,
endpoint_id=10,
unit="ppm",
device_class=SensorDeviceClass.CO2,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
device_class=SensorDeviceClass.CO2,
device_class=SensorDeviceClass.eCO2,

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.

3 participants