Google nest thermostat motion detection

Hello,

I would like to share my google nest thermostat motion detection code.
This way motion can be detected by your google nest and for example lights can be turned on.

In order to make this work:

add this into configuration.yaml

binary_sensor:
   - platform: ping
     host: ip adress nest
     count: 1
     scan_interval: 1
     name: ping_nest

Then create the following automation:

- id: '1692558832489'
  alias: Lights on by Nest motion
  description: ''
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.ping_nest
    to: 'on'
    for:
      hours: 0
      minutes: 0
      seconds: 25
  condition:
  - condition: sun
    after: sunset
  - condition: state
    entity_id: light.wiz_rgbw_tunable_0cd8e8
    state: 'off'
  - condition: state
    entity_id: automation.robert_slaapt_aan
    state: 'off'
  action:
  - service: light.turn_on
    data:
      rgb_color:
      - 255
      - 255
      - 255
      brightness_pct: 40
    target:
      entity_id:
      - light.wiz_rgbw_tunable_dff821
      - light.wiz_rgbw_tunable_523086
      - light.wiz_rgbw_tunable_0cd8e8
  - service: switch.turn_on
    data: {}
    target:
      entity_id:
      - switch.qn_wp01_2_socket_1
      - switch.qn_wp01_socket_1
  mode: single

Make sure the nest ping is “on” for 25 seconds in order it not to be triggered by other connections it will make frequently. Change entity’s to your own.

Greetings,

Robert

2 Likes

lol amazing you noticed this. I just had to test it out… Amazing it responds to pings only when you’re in front of it. lol

Agreed, this is wild. @Antaras does the 25 second delay imply that there is significant latency before motion is finally detected? So this is really more for non time sensitive use cases?

@Liveforlaughs76 Thats right the 25 seconds is needed or else it will respond to ping from the device itself also.