Move Sonoff occupancy config entities to quirks, or expose the ultrasonic delay for all occupancy sensors
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
The entities are in zha/application/platforms/number/init.py (SonoffPresenceSenorTimeout, PIROccupiedToUnoccupiedDelayConfigurationEntity) and zha/application/platforms/select.py (SonoffPresenceDetectionSensitivity). Compare them with the SNZB-06P and SNZB-03P quirks in zhaquirks/sonoff/, then check which snapshots in tests/data/devices hold ultrasonic_o_to_u_delay. Done when the chosen option is agreed in the thread and the affected snapshot tests still pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
ZHA creates the "presence detection timeout" number entity only for two Sonoff models. SonoffPresenceSenorTimeout is a ZHA-native entity on OccupancySensing.ultrasonic_o_to_u_delay (0x0020), matched by models=frozenset({"SNZB-06P", "SNZB-03P"}), range 15–60 s, unique ID {ieee}-1-1030-presence_detection_timeout. Its sibling SonoffPresenceDetectionSensitivity (ultrasonic_u_to_o_threshold, unique ID suffix detection_sensitivity) uses the same model match.
So device-specific config lives in the ZHA library, and quirks have to work around it. The SNZB-03P quirk in zigpy/zha-device-handlers#4628 imports SonoffPresenceSenorTimeout from zha.application.platforms.number and uses .replaces_entity() only to change the minimum to 5 s and add a unit and device class. Meanwhile any other sensor exposing ultrasonic_o_to_u_delay gets no entity for it, while the PIR equivalent, PIROccupiedToUnoccupiedDelayConfigurationEntity, matches every OccupancySensing server cluster (0–65535 s, created when the attribute is supported and cached).
Raised in zigpy/zha-device-handlers#4628 (review thread on zhaquirks/sonoff/snzb03p.py). We need to decide between two directions:
Option A: move it to quirks entirely
- The SNZB-06P quirk (zhaquirks/sonoff/snzb06p.py) and the SNZB-03P quirk from zigpy/zha-device-handlers#4628 declare the timeout with
.number(...)onultrasonic_o_to_u_delayand the sensitivity with.enum(...)onultrasonic_u_to_o_threshold, each with its own range. - Existing entity IDs are kept with
unique_id_suffix="1030-presence_detection_timeout"andunique_id_suffix="1030-detection_sensitivity". v2 IDs don't include the cluster ID, so it has to be in the suffix. - After that quirks release, ZHA removes both Sonoff classes and
SonoffPresenceDetectionSensitivityEnum. This is the same coupled order used for the Inovelli and STARKVIND moves: quirks first, then ZHA bumps its quirks pin and drops the classes. - The ZHA match is on the model string alone (
eWeLink SNZB-03P,SONOFF SNZB-06Pin the snapshots). Check that the quirks cover every manufacturer string that currently gets the entities.
Option B: a generic ultrasonic delay entity for all occupancy sensors
- Add an
UltrasonicOccupiedToUnoccupiedDelayConfigurationEntityto ZHA next to the PIR one: no model filter, 0–65535 s, duration device class, seconds. Optionally add the u→o delay too, like the PIR pair. - The Sonoff devices must not end up with both the generic and the Sonoff entity, and their existing unique ID (
presence_detection_timeout) has to stay. Either the generic class takes over and keeps that suffix for those models, or the Sonoff-specific range moves to the quirks (Option A for the range only). - Other devices gain the entity. Of the current snapshots in
tests/data/devices,ultrasonic_o_to_u_delayis supported and cached onsunricher-hk-dim-0x00000036(value 0) andtze200-jva8ink8-ts0601(value 600, a Tuya TS0601 whose occupancy cluster comes from thetuya_motionquirk). For the Tuya one, check whether a write reaches the device at all before exposing it there. - The sensitivity select stays Sonoff-specific. Its 1/2/3 enum is not a generic meaning of
ultrasonic_u_to_o_threshold.
Either way
zigpy/zha-device-handlers#4628 imports SonoffPresenceSenorTimeout from ZHA. Removing or renaming that class breaks the quirk's import, so the quirk has to be updated in the same release step.
- Lingua principale
- Python
- Stelle
- 96
- Fork
- 84
- Merge medio
- 2g 4h
- PR unite (30g)
- 30
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di zigpy/zha
-
Device override creates the generic entity instead of the vendor-specific one (Light instead of HueLight, ForceOnLight, MinTransitionLight)Forse già presa @zigpy-review-bot l’ha presa oggi. Apertabot: code audit
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Each time a device becomes available again, ZHA adds another firmware update listener that is never releasedForse già presa @zigpy-review-bot l’ha presa 1 giorno fa. Apertabot: code audit
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Devices that left the network are re-initialized on every availability check, reading attributes from a device that is goneForse già presa @zigpy-review-bot l’ha presa 1 giorno fa. Apertabot: code audit
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
device specific quirks
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pimutils/vdirsyncer#1242 ·
-
priority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
QuantConnect/lean-cli#792 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
open-webui/open-webui#35360 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100