Google Assistant working with sensors?

I have finally google assistant up and working with HASS, but actually i have it only for lights and switches. I’d like to have it working also for my sensors and configured them in this way:

cloud:
  google_actions:
    filter:
      include_domains:
        - switch
        - light
      include_entities:
        - sensor.humidity_158d0001b95f60
        - sensor.humidity_158d0002009a8
        - sensor.pressure_158d0001b95f60
        - sensor.temperature_158d0001b95f60
        - sensor.temperature_158d0002009a8
        - sensor.pws_feelslike_c
        - sensor.pws_weather_2d_metric
        - sensor.solar_angle
        - group.all_lights
        - group.all_switches
        - group.media_player
      exclude_domains:
        - automation
        - script
      exclude_entities:
        - group.all_automations
        - group.all_scripts
        - group.all_devices
    entity_config:
      sensor.humidity_158d0001b95f60:
        name: Umidità Balcone
      sensor.humidity_158d0002009a82:
        name: Umidità Salotto
      sensor.pressure_158d0001b95f60:
        name: Pressione Balcone
      sensor.temperature_158d0001b95f60:
        name: Temperatura Balcone
      sensor.temperature_158d0002009a82:
        name: Temperatura Salotto
      sensor.pws_feelslike_c:
        name: Temperatura Percepita
      sensor.pws_weather_2d_metric:
        name: Previsioni domani
      sensor.solar_angle:
        name: Angolo Solare

But they are not recognized by google assistant with every command i use.
How to have sensors recognized by GAssistant? And which commands are available?
The configuration check says it’s all ok…

2 Likes

I’ll doubt you will get the humidity and pressure working as Google has no corresponding Smart Home Device Type for that.

To get the temperature sensors working you have to create generic thermostats and expose these to Google Assistant.

Example thermostat:

- platform: generic_thermostat
  name: Temperatura Balcone
  heater: input_boolean.fake_heater
  target_sensor: sensor.temperature_158d0001b95f60
  initial_operation_mode: "off"
  target_temp: 21

Example input boolean (needed for the heater attribute of the generic thermostat):

fake_heater:
  name: Fake Heater
  icon: mdi:toggle-switch-off
  initial: off

Example customization (to hide the useless input from the web ui):

input_boolean.fake_heater:
  hidden: true

Hope that helps :slight_smile:

12 Likes

And then, after this, how to configure in cloud: section?

And i must do it for all the sensors i want to expose to Google Assistant?
All i need is change the sensor? The input boolean will be always the same?
What’s the meaning of target_temp?

replace your sensor.temperature_158d0001b95f60 with climate.temperatura_balcone if you copied my example one by one.

as i said your temperature sensors can be exposed that way, other like humidity and pressure not (at least i’m not aware that you can do it)

id did not try that, but i think this should be perfectly fine.

as you are configuring a thermostat which is (usually) able to heat a room this is the desired room temperature. you can set that to whatever value you want. as long as you set initial to off it doesn’t matter.

3 Likes

Thanks, this was super helpful. Only a bit annoying that I have to ask “what is the living room thermostat temperature” :wink:

You can also ask “how warm is it in the living room?” to get that information :slight_smile:

2 Likes

I’ve noticed that Google has added thermostatHumidityAmbient to the TemperatureSetting trait for the Thermostat.

Does that mean that it should be possible to extend the generic_thermostat in Home Assistant to include humidity?

I’ve also noticed that if I ask my Google Home about the humidity in the bedroom, I’ll get a response that the bedroom could not be reached instead of the “My appologies, I don’t understand” default response.

Currently I don’t see any option to attach a humidity value to either Generic Thermostat or MQTT HVAC so I’m not sure how we can benefit from Google’s change right now.

1 Like

Maybe it would be possible to extend the generic_thermostat now that google seems to support questions about humidity. But that would require an update to home assistant.

1 Like

I’m a bit late to this party, but if you’re still looking for a way to do this, it can be done via NodeRed. If you don’t already use NR for some automations, it’s a great time to start, as it’s way easier than it sounds.

You’d start with an event state node, which would be binary_sensor.yoursensornameinHA, then you would run the message payload properties of your humidity or whatever sensor into a change node to set the value as the global payload of a random topic name. This topic name is your variable that contains the value of the sensor, we can call this global.livingroomhumidity.

At this point, you just need to set a phrase on your google app to trigger a routine that just flips an input boolean. For something like this, you’d need an input boolean for each sensor. call it input_boolean.livingroomhumidity.

Last is piecing together the node red flow, which is simple from here. Your trigger is the input boolean turning on, then on the side, you need a 2 second delay node and a call service node to turn the input boolean back off. On another branchn off of the initial trigger, you would have a function node with the google tty_say command, the entity of your google home, volume, and then for the speach, you list the variable that contains the value. So it would be something like “The livingroom humidity is currently global.livingroomhumidity”

If you have multiple google homes and want it to read back on the one you asked from, you would need one additional level of input booleans. One for each sensor/google home. So the same sensor would need an input boolean for each google home. Not really terrible if you already have your sensors. NR allows you to copy paste, and it definitely sounds more complicating than it is. I use google home with variables for my alarm system, to announce which sensor tripped while I was away, or while I was sleeping, etc.

Thanks for this! I just configured Google Assistant and recently also installed Node-Red.
I am just starting to lear NR, and your solution is a bit complicated for me being a newbie :blush:
Can you share your Node-Red Json?

a PR to add temperature sensors natively to HA’s google assistant support just landed for 0.94

https://github.com/home-assistant/home-assistant/pull/24264

I haven’t done this yet, but I’m working up to an easier way with function node(s). I have a fairly good grasp of NR at this point but still not an expert and my overly complicated flows proves that. Im at the point where I’m slowly going back to try to consolidate my flows and the one I’m currently working on that will help with these sensor style readouts is my “just got home debreifing” flow. I basically have sensors that get tripped throughout the day (mainly doorbell and/or motion for package deliveries, etc., And of course a dog that trips my I side motion sensors, along with leak detectors and door sensors. So if say a leak is detected while the house is empty, I get a notification but forget about it when I get home. When I get home and walk into my breezeway, motion trips and it starts reading out what sensors were tripped that day, and then it resets all of the msg.Objects that keeps track of this.

Well anyway, to keep from a longer story, I found a way yesterday to consolidate these complex and hard to manage flows with a single function node that has multiple outputs. Once I get it fixed up, I’ll create a flow for sensor readouts, depending on which Google home is asked. Also when leak is detected, it’s going to figure out where I am (based on motion) and read out the leak message on that Google home.

NR is definitely amazing, but it easily and quickly becomes unmanageable. I’ll see what I can do to help you keep these simple.

Yay! Right on time.

A temp sensor its probably being supported on 0.94 as tube0013 said , but anyway NR could be a good alternative in some other cases. Thank you!

Hm,

I have tried to expose sensors to Google Home.

After re-sync - they got listed, with a funny, shield like icon.

They also don’t really show any temperature information.

Have anyone got them successfully exposed?

Thanks.

1 Like

I too have a similar issue. I have a DHT11 temp/humidity sensor that is being pulled from an ESP8266. Home Assistant is getting the data from the ESP via the ESPHome Add-on.

Google Assistant to Home Assistant (using the free integration, not cloud) works great for me for “exposed_domains” like “light” and “switch” but if I use “sensor” and “climate” (which my entity name for ESP is sensor.living_room_temperature) Google Assistant doesn’t show any of my sensor devices.

google_assistant:
  project_id: xxxxxxx
  api_key: xxxxxxx
  exposed_domains:
    - sensor
    - climate
  expose_by_default: true

Any way to get sensor entities to be visible in Google Assistant devices?

I have exactly same here.
No reading, just the shield icon.

Anyone who got something?

Just as a follow up: update to 0.96 - didn’t fix it.
Still the same shields.

Seeing the same thing have some esp with dht 11 and 22 can’t get them to show up in Google Assistant. Posted about it here: Expose sensor to Google Assistant. HA isn’t giving me any error. Thought it didn’t like the decimal but that still didn’t fix it…