Overview: This guide explains how I exposed the Google Away/Home mode that is updated using nest thermostats presence sensing, Nest Yale Lock and Google Cameras, but is not exposed by the crapstatic new Nest API.
In the works with Nest day, it was possible to get this status from the Thermostate mode, that was set to away automatically by Google Home, but now this is not update anymore, there is an eco preset but it is not set when Google home transition to away, now the only value that is changed is the temperature preset (thanks Google!)
Requirements:
- Working connection between Home Assistant and Google home, this could be achieved by using Nabu Casa or by connecting to it manually (more info here)
Guide:
-
Create an input_boolean helper:
-
Expose this helper variable to google home. With Nabu Casa you do that by going to Settings, Home Assistant Cloud, Google Assistant, Manage Entities
- Check in the Google Home app if the toggle shows as a switch device.
- If not change it by long pressing the item in the Google Home dashboard, clicking the cog icon on the upper right corner and them changing Device Type to Switch
- Update/Create Home and Away Google Home routines to update the exposed input_boolean helper
Please, if anyone knows a less cumbersome way of doing this let me know
Why I did this: I am using this info to complement my House Occupancy binary sensor, which is based on cellphone location and people entering and leaving the house. That way if me and my wife leaves the house and we have some guests staying with us they will not freezy during the nice Canadian winters.
Example of the Occupancy sensor from my configuration.yaml
# Templates
template:
# Sensors
# House Occupancy
- trigger:
- platform: homeassistant
event: start
- platform: event
event_type: event_template_reloaded
- platform: state
entity_id: group.occupancy_owners_phones
- platform: state
entity_id: sensor.front_door_entering_or_leaving
to:
- entering
- leaving
- platform: state
entity_id: input_boolean.google_home_mode
binary_sensor:
- name: "House Occupancy"
device_class: occupancy
state: >
{% if (is_state('group.occupancy_owners_phones', "home")) %}
on
{% elif ((is_state('group.occupancy_owners_phones', "not_home")) and (is_state('sensor.front_door_entering_or_leaving', "entering"))) %}
on
{% elif ((is_state('group.occupancy_owners_phones', "not_home")) and (is_state('input_boolean.google_home_mode', "on"))) %}
on
{% else %}
off
{% endif %}