I’m trying to create a basic automation using the Sonoff presence sensor (SNZB-06P) connected via zigbee2mqtt. The automation will turn on the lights when presence is detected under the condition that it is dim.
Turns out it wasn’t as straightforward, as the SNZB-06P updates its Illuminance only upon presence. This creates a race condition between presence being detected and the update of Illuminance values in an automation. The odd thing is, this setup works for a regular zigbee motion and Illuminance combo sensor, but why not the SNZB-06P.
Has anyone encountered this? The workaround was to have presence detected for 1 sec before triggering the automation, but that would delay the trigger, which is not optimal. I’m attaching a screenshot which shows the order of entities being updated.
In a scenario where the last known Illuminance value was ‘bright’: when presence triggers the automation, the illuminance value doesn’t get updated to ‘dim’ on time, missing the automation window. In this case, the lights won’t turn on since Illuminance remained as ‘bright’ and didn’t change to ‘dim’ until after the automation has executed completely. As noted, the SNZB-06P updates its illuminance value only when presence is detected.