Skip to content

Instantly share code, notes, and snippets.

@Resinchem
Last active July 19, 2025 12:00
Show Gist options
  • Save Resinchem/8f786d165a87ad867527fa6148393e26 to your computer and use it in GitHub Desktop.
Save Resinchem/8f786d165a87ad867527fa6148393e26 to your computer and use it in GitHub Desktop.
APDS-9960 Example ESPHome configuration used in this YouTube video: https://youtu.be/KhrSYPcA0gc
esphome:
name: apds9960-test
friendly_name: apds9960-test
esp32:
board: esp32dev
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "your-generated-key-goes-here"
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Apds9960 Fallback Hotspot"
password: !secret ap_password
captive_portal:
# APDS9960 Config Starts HERE
i2c:
sda: GPIO21
scl: GPIO22
scan: True
apds9960:
address: 0x39
update_interval: 10s
proximity_gain: 8x
ambient_light_gain: 16x
gesture_led_drive: 50ma
gesture_gain: 8x
gesture_wait_time: 2.8ms
sensor:
- platform: apds9960
type: CLEAR
name: "Clear Channel"
- platform: apds9960
type: RED
name: "Red Channel"
- platform: apds9960
type: GREEN
name: "Green Channel"
- platform: apds9960
type: BLUE
name: "Blue Channel"
- platform: apds9960
type: PROXIMITY
name: "Proximity"
binary_sensor:
- platform: apds9960
direction: UP
name: "Up Movement"
id: apds9960_up
on_state:
then:
- text_sensor.template.publish:
id: direction_state
state: "UP"
- platform: apds9960
direction: DOWN
name: "Down Movement"
id: apds9960_down
on_state:
then:
- text_sensor.template.publish:
id: direction_state
state: "DOWN"
- platform: apds9960
direction: LEFT
id: apds9960_left
name: "Left Movement"
on_state:
then:
- text_sensor.template.publish:
id: direction_state
state: "LEFT"
- platform: apds9960
direction: RIGHT
id: apds9960_right
name: "Right Movement"
on_state:
then:
- text_sensor.template.publish:
id: direction_state
state: "RIGHT"
# This sensor will hold the last gesture state
text_sensor:
- platform: template
name: "APDS Direction"
id: direction_state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment