Google home Lazy commuter "project"

Hi,

As a new member to Home Assistant (Hassio) I just want to start by thanking everybody that made all the amazing youtube tutorials, addons, tweaks and programming that helped me setup so far:) AMAZING WORK all of you!

My first goal is to make an automation to work with Google home. I call it “Lazy commuter” :slight_smile:

As a noob on HA (and programming) I ask anyone to point me in the correct direction.

The final result should work similar to the steps below.
I speak to Google Home mini
"Ok Google, leaving for work."
Response:
Ok let’s see… there is no traffic information on your route(+traffic information if exits) and the trip is scheduled to be xx minutes, the weather is xxx. You may need to fuel up the car on your way to work (if fuel level is below commute distance) or, You may need to fuel up the car on your way back from work. (if fuel range to and back is less than total commute distance).I took the liberty to start the car heater, as the temperature is a little chilly today(below 5 C). Drive safe!

I have gotten the sensor data from my car, range etc through Volvo On Call, and I can start/stop the car heater through Google home mini by voice at the moment.

Hope to get some help setting this up.
Should it be triggers or automations from triggers somehow?
Can’t seem to get sensor data from HA to Google Home.

I have Home Assistant Cloud and use SSL DuckDNS

Thanks in advance!
Regards

Will this somehow help me?

google_actions:
   filter:
     include_entities:
       - light.kitchen
       - light.kitchen_left
     include_domains:
       - switch
     exclude_entities:
       - switch.outside
   entity_config:
     switch.kitchen:
       name: Custom Name for Google Assistant
       aliases:
        - bright lights
        - entry lights
       room: living room

I could maybe use Google home to setup Routines to perform this?

I have something vaguely similar and there’s probably more than one way to do this, but usually you have an automation which has a trigger, condition and action;

However the action can be split out into different things. My morning announcement is automation → scene → script

Here’s a bit more detail;

Edit: I don’t have a Google Home, but I’m guessing you’d probably call a scene from Google Home, I don’t think you’d be able to activate by a specific command. So you wouldn’t necessarily need an automation, just a scene which does all this and then you could say “OK Google, turn on Leaving for Work”

1 Like

Thank you for the input!
I will take a closer look at how Google Home routines can achieve the talkback based scenes from HA depending on variables in the sensors.
However I managed to get it working by using only routines in Google Home so far.
Saying: Going to work
Google Home

  1. Starts the Car heater
  2. GH tells about traffic to work
  3. GH tells about Local Weather
  4. Say: Drive safe to work

If I could get Google Home routines to work depending on a scene activation to respond back with a custom answer if the scene is activated, THEN I would be able to activate a flow of scenes with custom readback once the scene is activated.
Its really cool…

Edit: Maybe the automation could broadcast the custom response to Google Home speaker? Could work…

Ah ok I think I understand a little better; the only thing missing from your GH is some sensor information from HA. Is that correct?

Correct, but I do think I could try and trigger an Automation in HA from GH and if that Automation rule is met this activates and broadcast to GH: “You need to fuel up the car on your way home”.
If the automation condition is not met the broadcast is not activated.

…GH cant trigger Automations?
Maybe I can set up a fake Entity to be activated by GH that then activates the Automation…?

Can GH turn on a scene in HA?

I made a input_boolean that show up in GH to activate automation…

input_boolean:
  travel_to_work:
    name: Going to work
    initial: off
    icon: mdi:car

Working on an automation but I am stuck…
Trying out the Automation Editor but learning slowly how to use it.
Trying to get an action to tts.google_say ‘Heater on’ when outside temperature is less than 5c

What am I doing wrong with the condition?
When I delete condition it works.

- id: 'XXX'
  alias: Driving to work
  trigger:
  - entity_id: input_boolean.travel_to_work
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: weather.smhi_hemma
    state: 'temperature: >0'
  action:
  - alias: ''
    data:
      message: Turning on heater
    service: tts.google_say

Allright!
Got the first part done.
I tell GH: Going to work
Routines in GH turns on the input_boolean in HA, that triggers the automation, if car is home and if temperature is below 6C.
My mistake above: I had to add the sensors to the weather platform to be able to use them in a condition. Learning learning :slight_smile:
EDIT: Working code!

- id: 'XXXXX'
  alias: Driving to work
  trigger:
  - entity_id: input_boolean.travel_to_work
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: zone
    entity_id: device_tracker.volvo
    zone: zone.home
  - below: '6'
    condition: numeric_state
    entity_id: sensor.weather_temperature
  action:
  - alias: ''
    data:
      message: As it is a little chilly outside, I started the car heater for you.
        Have a safe trip .. my Master
    service: tts.google_say
  - alias: ''
    data:
      entity_id: switch.volvo_heater
    service: switch.turn_on
  - alias: ''
    data:
      entity_id: input_boolean.travel_to_work
    service: input_boolean.turn_off

Next step:
First Automation triggers second.
The second automation will check fuel range to be below travel distance to work.
If below: GH respond: You need to fuel the car on your way to work.

1 Like

New automation for checking fuel range:

  alias: Check fuelrange to work
  trigger:
  - entity_id: input_boolean.travel_to_work
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - below: '115'
    condition: numeric_state
    entity_id: sensor.volvo_range
  action:
  - delay: 00:00:7 #delay to keep playing "Automation heater on" first.
  - data:
      message: Sorry, but you need to fuel the car on your way to work.
    service: tts.google_say