Light sensor in API 6¶
The light sensor we use is a phototransistor. Although the device cannot tell you precise lumen values because of several reasons, the sensor can work with a threshold which can be adjusted to fit almost any use case where detecting light is required.
Light sensor functionality:
There is one User mode that works with the light sensor: Light on/off (+ WiFi variants). Details below.
The state of the light sensor can be sent as appended payload.
You can also receive independent alerts from the light sensor in other modes.
Light on/off (+ WiFi variants)¶
Works with a light threshold and send a light detected message when over the threshold and a darkness detected message when below.
WiFi-enabled variants of this mode exist - see the Comparison of Mode Types for more information!
|Register hex||Register name||Value range||What it is and what it does||Useful for|
|0x36||Light sensor measurement interval period||SimpleTime||How often the light sensor wakes up. Value>0 turns on independent light events in other modes.||Light on/off, all modes|
|0x43||Light sensitivity threshold*||0-100% in hex||Threshold that triggers light on/off alerts.||Light on/off, all modes|
|0x44||Light sensitivity hysteresis||0-100% in hex||Light sensor hysteresis. When light hovers around the threshold, hysteresis blocks sending of wasteful events.||Light on/off, all modes|
|0x4C||Light sensor detection delay||SimpleTime||How long should the change of state last before the message is triggered.||Light on/off, all modes|
*The default value of the threshold register is 30% of daylight, so change that however you want. Generally, the darker the place, the more sensitive the sensor should be. Minimal working value is around 10%, anything less than that is too sensitive. With clients who want to monitor package opening in the dark (night), we've had success with values 12-15%.