deconz-rest-plugin
deconz-rest-plugin copied to clipboard
Adapt approach to auto-reset presence/vibration for DDF devices
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.
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...
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.
No consensus