Home Assistant and Google assistant : how to link HA buttons and Google automation

Hello,
I have created buttons in HA that are associated to a MQTT platform for the activation of a pool filtration pump.

button:
  - platform: mqtt
    name: "Pump activation"
    command_topic: "CMD/PUMP"
    qos: 0
    retain: false
    payload_press: "ON"

I have also completed the integration of Google Home in HA.
Then I have created an automation in Google Home that can successfully activate the pump with a voice command because Google home recognizes my HA buttons as actionable actions.

I would like now to create a button that could send sensor information through a voice message on Google assistant and that could be triggered by an incoming voice message recognized by my Google assistant.
I first tried with a button card on the GUI.

type: button
icon: mdi:gesture-tap-button
show_state: true
name: Test
hold_action:
  action: none
tap_action:
  action: call-service
  service: tts.google_translate_say
  service_data:
    entity_id: media_player.chromecast_de_beatrice
    message: >-
      Le niveau de CO2 est {{ states('sensor.netatmo_maison_nancras_indoor_co2')
      }} ppm ! La température extérieure est de {{
      states('sensor.netatmo_maison_nancras_indoor_exterieur_temperature') }}
      degré'Bonsoir: ceci est un nouvel essai..'
    language: fr
  target: {}

The button is working fine from HA GUI but is not recognized by home assistant as an action.
I have also tried also to declare a button inside the configuration file but didn’t find the correct syntax.

How can I declare in the configuration.yaml file, a button similar to my “MQTT” button but associated to the service “google_translate_say” and not to a MQTT topic ?

i am afraid you can’t create a button in hassio.
u can import buttons from integration.
and there is no button domain for google assistant:
Google Assistant - Home Assistant (home-assistant.io)

domains are :

  • alarm_control_panel (arm/disarm)
  • camera (streaming, requires compatible camera)
  • group (on/off)
  • input_boolean (on/off)
  • input_select (option/setting/mode/value)
  • scene (on)
  • script (on)
  • switch (on/off)
  • fan (on/off/speed percentage/preset mode)
  • light (on/off/brightness/rgb color/color temp)
  • lock
  • cover (on/off/set position)
  • media_player (on/off/set volume (via set volume)/source (via set input source)/control playback)
  • climate (temperature setting, hvac_mode)
  • vacuum (dock/start/stop/pause)
  • sensor (temperature setting for temperature sensors and humidity setting for humidity sensors)
  • humidifier (humidity setting/on/off/mode)

biensur tu peu toujour lancer un script , ou un switch qui turn_on/turn_off en 500ms
j’essairai meme un sensor.

template:
  - sensor:
    - name: "CO2 nancras"
      unit_of_measurement: "PPM"
      state: >
        {{ states('sensor.netatmo_maison_nancras_indoor_co2')

Hello,
thank you tomdudu38 for your reply and for the list of domains that can be exposed.
Actually, in the latest version of HA, “buttons” that are created in the back-end can be exposed to Google Assistant but I didn’t find a way to use it in a trigger.
I have now found a method which is not straightforward but it works.

  1. Create in the back-end configuration file, a button that sends a MQTT message
button:
  - platform: mqtt
    name: "Google info meteo"
    command_topic: "GOOGLE/REQUEST"
    qos: 0
    retain: false
    payload_press: "METEO"
  1. Expose the button to Google assistant
google_assistant:
  project_id: <my project ID>
  service_account: !include <my json file>
  report_state: true
  entity_config:
    button.google_info_meteo:
      expose: true
      name: STATION_METEO
      room: SALON
  1. Create an automation that uses the MQTT message as a trigger
automation:
  - id: '1544483297492'
    alias: Google say meteo
    trigger:
    - payload: 'METEO'
      platform: mqtt
      topic: 'GOOGLE/REQUEST'
    condition: []
    action:
    - service: tts.google_translate_say
      data:
        language: fr
        message: >-
          The outdoor temperature is {{
          states('sensor.netatmo_house_indoor_exterieur_temperature') }}
          deegres
        entity_id: 
        - media_player.salon
        - media_player.90670561_875c9add
    - service: browser_mod.toast
      data:
        message: Voice message transmitted
        duration: 2000
  1. Define a routine in Google home that will trigger the button

Of course, you need a MQTT broker in your system.
In my configuration, I use a Raspberry PI 3 with Mosquitto and Home Assistant running in docker.

I am pretty sure however that an alternative method without the MQTT channel might exist, may be though a python script. I will explore this solution later on.