deconz-rest-plugin icon indicating copy to clipboard operation
deconz-rest-plugin copied to clipboard

Adapt approach to auto-reset presence/vibration for DDF devices

Open SwoopX opened this issue 3 years ago • 2 comments

This PR is aimed at circumventing usage of durationDue, which is one of the reasons the new code ignoring the cluster handlers cannot be more widely applied (e.g. occupancy sensing cluster).

In essence, a new resource item, config/autoreset, is introduced, which shall indicate if e.g. the presence state of a device needs to be reset automatically. As this item will be only available on DDF supported devices, it shall also serve for distinction. The actual role of durationDue will be taken over by item->lastZclReport(). In conjuction with config/duration, which must be present as well if auto-reset is required, it is checked if the current time is larger than the last report time + duration.

This has successfully been tested with the Xiaomi presence sensor lumi.sensor_motion.aq2. Further devices which are affected by this are the Aqara vibration sensor lumi.vibration.aq1(#6167), Aqara high presicion sensor lumi.motion.agl04 (#6168) and Aqara P1 presence sensor lumi.motion.ac02. The legacy code path is still followed for devices without DDF.

SwoopX avatar Jul 03 '22 14:07 SwoopX

After some discussion with ebaauw I'm not too sure anymore if config/autoreset is really required, as config/duration might already be enough to indicate a reset is required. No idea though if that was consistently applied/used back in the days...

SwoopX avatar Jul 05 '22 21:07 SwoopX

Indeed.

The obvious inconsistency being the Trådfri motion sensors, that send On with Timed Off. You want to reset state.presence based on the command parameter exposed as (read-only) config.delay, (so it becomes false when the bound lights go off), instead of using config.duration. The old model has a dial to set the delay between 1 and 10 minutes; the new model is fixed to 3 minutes.

ebaauw avatar Jul 05 '22 21:07 ebaauw

No consensus

SwoopX avatar Jun 03 '23 19:06 SwoopX