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.

Does this work with the Google Nest integration? Google Nest - Home Assistant

Iā€™m having some trouble setting this upā€¦

When I add

binary_sensor:
   - platform: ping
     host: 192.168.##.##
     count: 1
     scan_interval: 1
     name: ping_nest

I get:

Not possible to configure ping binary_sensor by adding platform: ping to the binary_sensor configuration. Please check the documentation for more information on how to set up this integration.

To resolve this:

  1. Remove platform: ping occurences from the binary_sensor: configuration in your YAML configuration file.
  2. Restart Home Assistant.

Example that should be removed:

binary_sensor:

  • platform: ping

Also, when I create a new automation and try replacing the YAML code, I get this error:

Message malformed: extra keys not allowed @ data[ā€˜0ā€™]

Am I doing something wrong? I donā€™t have any experience with YAML yet.

You canā€™t setup the ping integration via YAML anymore, only the UI.

1 Like

Awesome find! Been looking for something like this myself for some time.

I tried to set it up locally myself, but it seems the ping sensor is always showing as connected (or on, in your example).

image

My expectation is that this would flip on and off from your example automation. Anyone know if this still works? Iā€™ve got the regular Nest Thermostat (shows as `Thermostat-1.4" in the Google Home App ā€“ not the ā€œThermostat Eā€).

@Antaras does your integration still function today?