APDS9960 has invalid id!

Hi I have a bedroom sensor
I keep getting in APDS9960 has invalid id! in the logs but not sure what is incorrect my yaml file is below any help would be appreciated just cant figure out how to set the ID do I need to set for the sensor or binary sensors ??

Confused
Andrew

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: 60s    
  id: Gesture_Sensor 
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
    direction: UP
    name: "APDS960 Up Movement"
    
  - platform: apds9960
    direction: DOWN
    name: "APDS960 Down Movement"
     
  - platform: apds9960
    direction: LEFT
    name: "APDS960 Left Movement"
    
  - platform: apds9960
    direction: RIGHT
    name: "APDS960 Right Movement"    
    
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
    type: CLEAR
    name: "APDS9960 Clear Channel"
    
  - platform: apds9960
    type: RED
    name: "APDS9960 Red Channel"
    
  - platform: apds9960
    type: GREEN
    name: "APDS9960 Green Channel"
    
  - platform: apds9960
    type: BLUE
    name: "APDS9960 Blue Channel"
    
#  - platform: apds9960
#    type: PROXIMITY
#    name: "APDS9960 Proximity Channel"
   

    
  - platform: uptime
    name: Master Bedroom Uptime 
    update_interval: 60s
time:
  - platform: homeassistant
    id: time_
    

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
# BELOW WILL READ OUT THE ANALOG SIGNAL
# sensor:
#  - platform: adc
#    pin: 33
#    name: "Sound level"
#    update_interval: 1s
#    attenuation: 11db
#    filters:
#      - multiply: 6


i2c:
  sda: 21
  scl: 22
  scan: True
  id: bus_a   

At a guess, use lower case for the id, eg

id: gesture_sensor

Hello
Thanks but tried that but still showing error **[15:24:38][E][apds9960:134]: APDS9960 has invalid id!
** ??

Yeah I am wrong anyway - https://esphome.io/guides/configuration-types.html#config-id

Is this while compiling? Or in use?

I don’t think the Id goes on the main component but on the associated sensors for the apds9960 which you don’t appear to have defined. Relook at the definition of the ads9960.

Hi
Both the sensor: and binary_sensor: do you think

I guess it depends on what sensor you need. But the IDs are attached to them not the main component definition.

Bugger that dint work added ID to all of the sensors and binary sensors but still not working ???
Not to sure what to do next now thanks for your sugestions.

Andrew

Compiles fine here, so I’ll ask again: where are you seeing this message, while compiling or during use?

Also, why do you want the id anyway? You don’t seem to use it anywhere in your code?

Hi Complies fine no errors The error shows up in the logs.
And no I don’t need an ID with that sensor it just keeps coming up with the error so I thought it must need an ID to be used. ??

[17:05:46][C][i2c:028]: I2C Bus:
[17:05:46][C][i2c:029]:   SDA Pin: GPIO21
[17:05:46][C][i2c:030]:   SCL Pin: GPIO22
[17:05:46][C][i2c:031]:   Frequency: 50000 Hz
[17:05:46][I][i2c:033]: Scanning i2c bus for active devices...
[17:05:46][I][i2c:040]: Found i2c device at address 0x39
[17:05:46][C][logger:137]: Logger:
[17:05:46][C][logger:138]:   Level: DEBUG
[17:05:46][C][logger:139]:   Log Baud Rate: 115200
[17:05:46][C][logger:140]:   Hardware UART: UART0
[17:05:46][C][apds9960:124]: APDS9960:
[17:05:46][C][apds9960:125]:   Address: 0x39
[17:05:46][C][apds9960:127]:   Update Interval: 30.0s
[17:05:46][E][apds9960:134]: APDS9960 has invalid id!
[17:05:46][C][ota:029]: Over-The-Air Updates:
[17:05:46][C][ota:030]:   Address: 192.168.1.33:3232
[17:05:46][C][ota:032]:   Using Password.
[17:05:46][C][api:103]: API Server:
[17:05:46][C][api:104]:   Address: 192.168.1.33:6053

I’m wondering if the Sensor is fualty

Ive stripped back the
YMAL file to below and still the error shows on in the logs

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: "####"
  
apds9960:
  address: 0x39
  update_interval: 30s    
  
  


i2c:
  sda: 21
  scl: 22
  scan: True
     

Found this info on another forum https://forum.arduino.cc/index.php?topic=526733.0
Im thinking my sensors of eBay are crap

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]

same problem over here. cheap aliexpress clone

I have the same shit sensor. Does anyone managed this sensor working? Or are there any ideas how i can get this working?

Hi.
No i didn’t get it working reordered some more from ebay they where more expensive and they worked

I was also facing the same issue and pulling hair out.

The issue is with the id values returned from the 9960 board. As mentioned earlier the Id value returned is 0xA8 and the device library code is looking for 0xAB.
see line 26 in
https://esphome.io/api/apds9960_8cpp_source.html

To fix, find the file (e.g. find / -name apds9960.cpp) and change the AB to A8.

This was tested with a WEMOS d1 Mini.
INT → GPIO12
SDA → GPIO4
SCL → GPIO5

extract from yml file

i2c:
sda: GPIO4
scl: GPIO5

apds9960:
#address: 0x39 #Default
update_interval: 60s
id: gesture

binary_sensor:

  • platform: apds9960
    direction: UP
    name: “APDS960 Up Movement”
  • platform: apds9960
    direction: DOWN
    name: “APDS960 Down Movement”
  • platform: apds9960
    direction: RIGHT
    name: “APDS960 Right Movement”
  • platform: apds9960
    direction: LEFT
    name: “APDS960 Left Movement”

Please post your code properly.