Device State (lamp.device_state)
Records screen on/off events, lock/unlock events, and battery level. This sensor does not record time spent in specific apps or notification counts.
Configurationโ
- SensorSpec:
lamp.device_state - Sampling: Continuous (one event per state change)
- Platform: iOS, Android
Usageโ
Events are generated automatically whenever the device state changes. No participant action is required.
Dataโ
Fieldsโ
| Field | Type | Description |
|---|---|---|
value | integer | Numeric state code (see table below) |
representation | string | Human-readable state name |
battery_level | float | Battery level as a decimal (e.g., 0.85 = 85%) |
State Codesโ
| Value | Representation | Meaning |
|---|---|---|
0 | screen_on | Screen turned on (by user or notification) |
1 | screen_off | Screen turned off (by user or timeout) |
2 | locked | Device locked (by user or timeout) |
3 | unlocked | Device unlocked by user |
Exampleโ
{
"timestamp": 1649465295573,
"sensor": "lamp.device_state",
"data": {
"value": 1,
"representation": "screen_off",
"battery_level": 0.07
}
}
Cortex Featuresโ
device_state (raw) โ screen_active (primary) โ screen_duration, screen_unlocks, screen_unlock_duration, screen_wakes, inactive_duration, battery_level (secondary)
View in Portal | Python SDK | API Reference