feat: add ambient light sensor (illuminance) support#191
Open
CoRfr wants to merge 1 commit intoleukipp:developfrom
Open
feat: add ambient light sensor (illuminance) support#191CoRfr wants to merge 1 commit intoleukipp:developfrom
CoRfr wants to merge 1 commit intoleukipp:developfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/sys/bus/iio/devices/*/in_illuminance_raw)device_class: illuminance)removeConfigImplementation
getIlluminancePath()scans IIO devices for one namedalswithin_illuminance_raw,getIlluminance()reads the raw lux value,illuminanceadded tocheckSupport()initIlluminance()/updateIlluminance()following the existing sensor pattern, updated in the 1-minute periodic cycleTesting
Tested on:
hid-sensor-alsdriver) — working, reports lux valuesremoveConfigwould apply on devices with no IIO ALS at allNotes
The IIO ambient light sensor is commonly available on tablets and laptops with HID sensor hubs (Surface devices, ThinkPads, etc.). The sensor name
alsis the standard name used by thehid-sensor-alskernel driver.🤖 Generated with Claude Code