Hi, I purchased an APDS9960 sensor. While installing my .yaml file, I’m getting an error.
[17:48:42][E][apds9960:147]: APDS9960 has invalid id!
[17:48:42][E][component:082]: Component apds9960 is marked FAILED
.yaml code
esphome:
name: esphome-web-a10a90
friendly_name: PIRmotion
min_version: 2024.11.0
name_add_mac_suffix: false
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
logger:
api:
ota:
platform: esphome
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
i2c:
sda: GPIO7
scl: GPIO8
scan: true
apds9960:
address: 0x39
update_interval: 1s
ambient_light_gain: 16X
binary_sensor:
- platform: apds9960
direction: UP
id: apds960_up
on_state:
then:
- text_sensor.template.publish:
id: direction_status
state: "UP"
- platform: apds9960
direction: DOWN
id: apds960_down
on_state:
then:
- text_sensor.template.publish:
id: direction_status
state: "DOWN"
- platform: apds9960
direction: LEFT
id: apds960_left
on_state:
then:
- text_sensor.template.publish:
id: direction_status
state: "LEFT"
- platform: apds9960
direction: RIGHT
id: apds960_right
on_state:
then:
- text_sensor.template.publish:
id: direction_status
state: "RIGHT"
text_sensor:
- platform: template
name: "direction_status"
id: direction_status
I read a few similar forum topics suggesting that it might be a low-quality Chinese clone sensor. Could that be the case, or is there something wrong with my code?
Karosm
(Karosm)
March 26, 2025, 4:14pm
2
Yes.
Error is for id, so it’s not problem of your code.
opened 11:37AM - 14 Oct 19 UTC
closed 07:26PM - 15 Oct 19 UTC
integration: apds9960
integration: sensor
**Operating environment/Installation (Hass.io/Docker/pip/etc.):**
Hass.io
**… ESP (ESP32/ESP8266, Board/Sonoff):**
ESP32
**Affected component:**
APDS9960
https://esphome.io/components/sensor/apds9960.html
**Description of problem:**
In the logs its showing "[apds9960:134]: APDS9960 has invalid id!"
**Problem-relevant YAML-configuration entries:**
```yaml
PASTE YAML FILE HERE
esphome:
name: master_bedroom_sensor
platform: ESP32
board: esp-wrover-kit
wifi:
ssid: "----"
password: "----"
power_save_mode: none
manual_ip:
# # Set this to the IP of the ESP
static_ip: ----
# # Set this to the IP address of the router. Often ends with .1
gateway: ----
# # The subnet of the network. 255.255.255.0 works for most home networks.
subnet: ----
dns1: ----
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "----"
ota:
password: "----"
esp32_ble_tracker:
scan_interval: 60s
web_server:
port: 80
text_sensor:
- platform: wifi_info
ip_address:
name: "Master Bedroom Sensor IP address"
ssid:
name: "Master Bedroom Sensor SSID"
- platform: version
name: "Master Bedroom Sensor ESPHome Version"
apds9960:
address: 0x39
update_interval: 30s
switch:
- platform: restart
name: "Master Bedroom Sensor Restart"
- platform: shutdown
name: "Master Bedroom Sensor Shutdown"
binary_sensor:
- platform: status
name: "Master Bedroom Sensor Status"
- platform: gpio
pin: 34
name: "Master Bedroom Motion"
device_class: motion
- platform: gpio
pin: 33
name: "Sound level"
filters:
- delayed_off: 6s
- platform: ble_presence
mac_address: ----
name: "----"
- platform: ble_presence
mac_address: ----
name: "----"
- platform: ble_presence
mac_address: ----
name: "----"
- platform: apds9960
name: "APDS960 Up Movement"
direction: UP
- platform: apds9960
name: "APDS960 Down Movement"
direction: DOWN
- platform: apds9960
name: "APDS960 Left Movement"
direction: LEFT
- platform: apds9960
name: "APDS960 Right Movement"
direction: RIGHT
sensor:
- platform: wifi_signal
name: "Master Bedroom Sensor WiFi Signal"
update_interval: 60s
- platform: bmp280
temperature:
name: "BME280 Temperature"
id: mb_temp
oversampling: 16x
pressure:
name: "BME280 Pressure"
id: mb_press
address: 0x76
update_interval: 60s
- platform: apds9960
name: "APDS9960 Clear Channel"
type: CLEAR
- platform: apds9960
name: "APDS9960 Red Channel"
type: RED
- platform: apds9960
name: "APDS9960 Green Channel"
type: GREEN
- platform: apds9960
name: "APDS9960 Blue Channel"
type: BLUE
- platform: apds9960
name: "APDS9960 Proximity Channel"
type: PROXIMITY
- platform: uptime
name: Master Bedroom Uptime
update_interval: 60s
display:
- platform: ssd1306_i2c
model: "SH1106 128x64"
address: 0x3C
lambda: |-
// Print "Bedroom Sensor" in top center.
it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "Bedroom Sensor");
// Print Master Bedroom Temperature (from master_bedroom_sensor)
if (id(mb_temp).has_state()) {
it.printf(3, 60, id(font2), TextAlign::BASELINE_LEFT , "%.1f°", id(mb_temp).state);
}
// Print Master Bedroom Pressure (from master_bedroom_sensor)
if (id(mb_press).has_state()) {
it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT , "%.1f°", id(mb_press).state);
}
font:
- file: 'slkscr.ttf'
id: font1
size: 8
- file: 'BebasNeue-Regular.ttf'
id: font2
size: 36
- file: 'arial.ttf'
id: font3
size: 14
i2c:
sda: 21
scl: 22
scan: True
```
**Logs (if applicable):**
INFO Reading configuration...
INFO Starting log output from 192.168.1.33 using esphome API
INFO Connecting to 192.168.1.33:6053 (192.168.1.33)
INFO Successfully connected to 192.168.1.33
[21:33:55][I][app:096]: esphome version 1.13.6 compiled on Oct 14 2019, 18:02:51
[21:33:55][C][wifi:372]: WiFi:
[21:33:55][C][wifi:254]: SSID: [redacted]
[21:33:55][C][wifi:255]: IP Address: 192.168.1.33
[21:33:55][C][wifi:257]: BSSID: [redacted]
[21:33:55][C][wifi:258]: Hostname: 'master_bedroom_sensor'
[21:33:55][C][wifi:262]: Signal strength: -33 dB ▂▄▆█
[21:33:55][C][wifi:263]: Channel: 4
[21:33:55][C][wifi:264]: Subnet: 255.255.255.0
[21:33:55][C][wifi:265]: Gateway: 192.168.1.1
[21:33:55][C][wifi:266]: DNS1: 192.168.1.12
[21:33:55][C][wifi:267]: DNS2: 0.0.0.0
[21:33:55][C][i2c:028]: I2C Bus:
[21:33:55][C][i2c:029]: SDA Pin: GPIO21
[21:33:55][C][i2c:030]: SCL Pin: GPIO22
[21:33:55][C][i2c:031]: Frequency: 50000 Hz
[21:33:55][I][i2c:033]: Scanning i2c bus for active devices...
[21:33:55][I][i2c:040]: Found i2c device at address 0x39
[21:33:55][I][i2c:040]: Found i2c device at address 0x3C
[21:33:55][I][i2c:040]: Found i2c device at address 0x76
[21:33:55][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Master Bedroom Motion'
[21:33:55][C][gpio.binary_sensor:015]: Device Class: 'motion'
[21:33:55][C][gpio.binary_sensor:016]: Pin: GPIO34 (Mode: INPUT)
[21:33:55][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Sound level'
[21:33:55][C][gpio.binary_sensor:016]: Pin: GPIO33 (Mode: INPUT)
[21:33:55][C][logger:137]: Logger:
[21:33:55][C][logger:138]: Level: DEBUG
[21:33:55][C][logger:139]: Log Baud Rate: 115200
[21:33:55][C][logger:140]: Hardware UART: UART0
[21:33:55][C][esp32_ble_tracker:459]: BLE Tracker:
[21:33:55][C][esp32_ble_tracker:460]: Scan Interval: 60 s
[21:33:55][C][apds9960:124]: APDS9960:
[21:33:55][C][apds9960:125]: Address: 0x39
[21:33:55][C][apds9960:127]: Update Interval: 30.0s
[21:33:55][E][apds9960:134]: APDS9960 has invalid id!
[21:33:55][C][restart:021]: Restart Switch 'Master Bedroom Sensor Restart'
[21:33:55][C][restart:021]: Icon: 'mdi:restart'
[21:33:55][C][shutdown.switch:010]: Shutdown Switch 'Master Bedroom Sensor Shutdown'
[21:33:55][C][shutdown.switch:010]: Icon: 'mdi:power'
[21:33:55][C][status:034]: Status Binary Sensor 'Master Bedroom Sensor Status'
[21:33:55][C][status:034]: Device Class: 'connectivity'
[21:33:55][C][ble_presence:011]: BLE Presence '----'
[21:33:55][C][ble_presence:011]: BLE Presence '----'
[21:33:55][C][ble_presence:011]: BLE Presence '----'
[21:33:55][C][bmp280.sensor:098]: BMP280:
[21:33:55][C][bmp280.sensor:099]: Address: 0x76
[21:33:55][C][bmp280.sensor:111]: IIR Filter: OFF
[21:33:55][C][bmp280.sensor:112]: Update Interval: 60.0s
[21:33:55][C][bmp280.sensor:114]: Temperature 'BME280 Temperature'
[21:33:55][C][bmp280.sensor:114]: Unit of Measurement: '°C'
[21:33:55][C][bmp280.sensor:114]: Accuracy Decimals: 1
[21:33:55][C][bmp280.sensor:114]: Icon: 'mdi:thermometer'
[21:33:55][C][bmp280.sensor:115]: Oversampling: 16x
[21:33:55][C][bmp280.sensor:116]: Pressure 'BME280 Pressure'
[21:33:55][C][bmp280.sensor:116]: Unit of Measurement: 'hPa'
[21:33:55][C][bmp280.sensor:116]: Accuracy Decimals: 1
[21:33:55][C][bmp280.sensor:116]: Icon: 'mdi:gauge'
[21:33:55][C][bmp280.sensor:117]: Oversampling: 16x
[21:33:55][C][version.text_sensor:015]: Version Text Sensor 'Master Bedroom Sensor ESPHome Version'
[21:33:55][C][version.text_sensor:015]: Icon: 'mdi:new-box'
[21:33:55][C][ssd1306_i2c:023]: I2C SSD1306
[21:33:55][C][ssd1306_i2c:023]: Rotations: 0 °
[21:33:55][C][ssd1306_i2c:023]: Dimensions: 128px x 64px
[21:33:55][C][ssd1306_i2c:024]: Address: 0x3C
[21:33:55][C][ssd1306_i2c:025]: Model: SH1106 128x64
[21:33:55][C][ssd1306_i2c:027]: External VCC: NO
[21:33:55][C][ssd1306_i2c:028]: Update Interval: 1.0s
[21:33:55][C][web_server:125]: Web Server:
[21:33:55][C][web_server:126]: Address: 192.168.1.33:80
[21:33:55][C][ota:029]: Over-The-Air Updates:
[21:33:55][C][ota:030]: Address: 192.168.1.33:3232
[21:33:55][C][ota:032]: Using Password.
[21:33:55][C][api:103]: API Server:
[21:33:55][C][api:104]: Address: 192.168.1.33:6053
[21:33:55][C][wifi_signal.sensor:009]: WiFi Signal 'Master Bedroom Sensor WiFi Signal'
[21:33:55][C][wifi_signal.sensor:009]: Unit of Measurement: 'dB'
[21:33:55][C][wifi_signal.sensor:009]: Accuracy Decimals: 0
[21:33:55][C][wifi_signal.sensor:009]: Icon: 'mdi:wifi'
```
PASTE DEBUG LOG HERE
```
**Additional information and things you've tried:**
Found on another forum
https://forum.arduino.cc/index.php?topic=526733.0
Re: APDS 9960 Gesture sensor not working
#14
Aug 18, 2019, 10:21 pm Last Edit: Aug 18, 2019, 10:27 pm by ronin_boss
I solved the problem with the Chinese clones !!!!!!!!!!!!!! After about 2 months of torment. The ones that do not go to read the gestures but the other functionalities go .... those that receive the message "Something went wrong during APDS-9960 init!"... In the library, check if the sensor id is 0xAB .. but the id of the Chinese ones is 0xA8 . at least mine ... So ... you need to change in SpurkFun_APDS9960.h line #define APDS9960_ID_1 0xAB with 0xA8 .. and ready. if you use ESP8266 you still have to play with GAINE and BOOST on LEDs for more precise functionality .. other modules may have other ids.
aa. and something else. you can use gestures without interrupting pin.
In setup, at apds.enableGestureSensor (true) use (false) and modify the sketch.
Anyone who wants more details can contact me at [email protected]
1 Like