Adding Near/Far gesture control with APDS9960 ESPHome and HA

Hi all,
I’ve got gesture control set up with an ESP8266 board using an sparkfun APDS9960 sensor.
I gesture right/left to turn on/off light1 and I gesture up/down to turn on/off light2
However I’m also looking to utilise the NEAR and FAR commands. I try and add it in using code following scheme below but does not recognise it when I export the code to the ESP using ESPHome
I try and add in the below under the RIGHT command per below but get the following message
(further below)… any suggestions on how I can add in a near / far gesture?

  • platform: apds9960*
    direction: NEAR*
    name: “APDS9960 Near Movement”*

INFO Reading configuration /config/esphome/esptom.yaml…
Failed config

binary_sensor.apds9960: [source /config/esphome/esptom.yaml:56]

  • platform: apds9960*
  • Unknown value ‘NEAR’, valid options are ‘UP’, ‘DOWN’, ‘LEFT’, ‘RIGHT’.*
  • direction: NEAR*
  • name: APDS9960 Near Movement*

CODE I’M USING THAT DOES WORK FOR LEFT/RIGHT/UP/DOWN:
esphome:
name: esptom

esp8266:
board: nodemcuv2

`# Enable logging
logger:

`# Enable Home Assistant API
api:
encryption:
key: “THE ENCRYPTION KEY”

ota:
password: “THE PASSWORD”

wifi:
ssid: “MY WIFI”
password: “MY WIFI PW”

` # Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: “Esptom Fallback Hotspot”
password: “FALLBACK HOTSPOT PW”

captive_portal:

`# Configuration Entry
apds9960:
address: 0x39
update_interval: 60s

sensor:

  • platform: apds9960
    type: CLEAR
    name: “APDS9960 Clear Channel”

binary_sensor:

  • platform: apds9960
    direction: UP
    name: “APDS9960 Up Movement”

  • platform: apds9960
    direction: DOWN
    name: “APDS9960 Down Movement”

  • platform: apds9960
    direction: LEFT
    name: “APDS9960 Left Movement”

  • platform: apds9960
    direction: RIGHT
    name: “APDS9960 Right Movement”

i2c:

  • id: bus_a
    sda: D1
    scl: D2
    scan: true

i used this for testing

sensor:
  - 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"

binary_sensor: 
  - platform: apds9960
    direction: UP
    id: apds9960_up
    on_state:
      then:
        - text_sensor.template.publish:
            id: direction_state
            state: "UP"

  - platform: apds9960
    direction: DOWN
    id: apds9960_down
    on_state:
      then:
        - text_sensor.template.publish:
            id: direction_state
            state: "DOWN"

  - platform: apds9960
    direction: LEFT
    id: apds9960_left
    on_state:
      then:
        - text_sensor.template.publish:
            id: direction_state
            state: "LEFT"

  - platform: apds9960
    direction: RIGHT
    id: apds9960_right
    on_state:
      then:
        - text_sensor.template.publish:
            id: direction_state
            state: "RIGHT"    

text_sensor:
  - platform: template
    name: "direction_state"
    id: direction_state   

thanks! now working for me :slight_smile: