#ZHA: Building a v2 quirk - confused by code base

1 messages · Page 1 of 1 (latest)

edgy acorn
#

Hello! I am currently working on support for the Sonoff SNZB-03P, but I am a bit confused about the current code base(s).

This is my quirk in question: https://github.com/zigpy/zha-device-handlers/issues/3188#issuecomment-2585694831

I wanted to add presence detection timeout based on the specifications from the manufacturer. However, in the current Quirk it will show 2 configurations while I only defined one.

After searching around through multiple repositories, I was able to figure out that this PR https://github.com/zigpy/zha/pull/215 added support for SNZB-03P but only in this code base and I assume that the code detects OccupancySensing cluster after I added the .number() and thefor it will show up twice with different min_value's?

My question: are my assumptions correct? and what is the way forward? I assume that the V2 builder is the new approach since this doesn't require adding code into multiple repositories?

hoary cipher
#

It shows up twice because presence_detection_timeout is used as the unique ID suffix for the ZHA entity, whilst the quirk v2 entity automatically uses the attribute name, which is ultrasonic_o_to_u_delay.

#

I'd just adjust the min value in the ZHA PR for now (and not include that entity in your v2 quirk), assuming it applies to all Sonoff sensors.