Skip to content

feat: add ambient light sensor (illuminance) support#191

Open
CoRfr wants to merge 1 commit intoleukipp:developfrom
CoRfr:feature/illuminance-sensor
Open

feat: add ambient light sensor (illuminance) support#191
CoRfr wants to merge 1 commit intoleukipp:developfrom
CoRfr:feature/illuminance-sensor

Conversation

@CoRfr
Copy link
Copy Markdown

@CoRfr CoRfr commented Mar 17, 2026

Summary

  • Adds support for reading ambient light level (illuminance) from Linux IIO ALS devices via sysfs (/sys/bus/iio/devices/*/in_illuminance_raw)
  • Exposes an illuminance sensor (lux) through MQTT with Home Assistant auto-discovery (device_class: illuminance)
  • Devices without an ALS gracefully skip the sensor via removeConfig

Implementation

  • hardware.js: getIlluminancePath() scans IIO devices for one named als with in_illuminance_raw, getIlluminance() reads the raw lux value, illuminance added to checkSupport()
  • integration.js: initIlluminance() / updateIlluminance() following the existing sensor pattern, updated in the 1-minute periodic cycle

Testing

Tested on:

  • Surface Pro 3 (HID-SENSOR-200041 via hid-sensor-als driver) — working, reports lux values
  • Surface 3 (same driver, dead hardware) — gracefully detects ALS support but sensor returns 0; removeConfig would apply on devices with no IIO ALS at all

Notes

The IIO ambient light sensor is commonly available on tablets and laptops with HID sensor hubs (Surface devices, ThinkPads, etc.). The sensor name als is the standard name used by the hid-sensor-als kernel driver.

🤖 Generated with Claude Code

Read illuminance from IIO ALS devices via sysfs (/sys/bus/iio/devices).
Exposes an illuminance sensor (lux) through MQTT with HA auto-discovery.

Tested on Surface Pro 3 with HID-SENSOR-200041 ambient light sensor.
Devices without an ALS gracefully skip the sensor (removeConfig).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant