Skip to content

Add quirk for HOBEIAN ZG-102ZM vibration and door sensor#4872

Open
Idskov wants to merge 3 commits intozigpy:devfrom
Idskov:hobeian-zg-102zm
Open

Add quirk for HOBEIAN ZG-102ZM vibration and door sensor#4872
Idskov wants to merge 3 commits intozigpy:devfrom
Idskov:hobeian-zg-102zm

Conversation

@Idskov
Copy link
Copy Markdown

@Idskov Idskov commented Mar 28, 2026

Proposed change

Add a ZHA quirk for the HOBEIAN ZG-102ZM door and vibration sensor.

This device reports as a standard IAS Zone device (zone_type 0x0015, Vibration/Movement) but uses Tuya datapoints on cluster 0xEF00 for its actual sensor data. Without this quirk, ZHA only creates a single IAS Zone binary sensor for contact — vibration is completely missing.

The quirk uses TuyaQuirkBuilder to expose:

  • Vibration binary sensor (DP 1)
  • Contact/Opening binary sensor (DP 101)
  • Battery sensor (DP 4, 1× CR2032)
  • Sensitivity number entity (DP 6, range 1–50)

The default IAS Zone entity is disabled by default since the Tuya DPs provide complete and separated sensor data.

Reference: Z2M converter (uses same Tuya DPs), Community thread

Additional information

  • Tested on HA 2026.3.4 with ZHA 1.0.2
  • Device was factory reset, removed from ZHA, and re-paired to verify clean entity creation
  • The device also has a standard IAS Zone cluster (0x0500) that handles contact via zone_status, but vibration data only comes through Tuya DPs
  • This quirk was co-authored with Claude Code (Claude Opus 4.6)

Device diagnostics

diagnostics.json

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 — purely declarative v2 quirk with no custom logic; no tests required per contribution guidelines
  • Device diagnostics data has been attached

Idskov and others added 2 commits March 28, 2026 12:30
The ZG-102ZM reports as a standard IAS Zone device but uses Tuya
datapoints for vibration, contact, battery, and sensitivity. Without
this quirk, only a single binary sensor is created via IAS Zone,
missing the vibration functionality entirely.

This quirk uses TuyaQuirkBuilder to expose:
- Vibration binary sensor (DP 1)
- Contact/opening binary sensor (DP 101)
- Battery sensor (DP 4, 1x CR2032)
- Sensitivity number (DP 6, range 1-50)

The default IAS Zone entity is disabled since the Tuya DPs provide
complete and separated sensor data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.05%. Comparing base (380135d) to head (2ba1feb).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #4872   +/-   ##
=======================================
  Coverage   93.04%   93.05%           
=======================================
  Files         397      399    +2     
  Lines       13248    13256    +8     
=======================================
+ Hits        12327    12335    +8     
  Misses        921      921           

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

The device requires the Tuya "spell" (attribute reads on Basic cluster)
during configuration to start sending datapoints. Without it, the device
joins but never reports vibration, contact, or battery data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant