Google Assistant not syncing sensors (min_max not exposing DeviceClass)

This may be more related to the min_max integration, but it may be a more generic issue with syncing entities with Google Assistant.
I have a couple of temperature sensors that I use min_max to average, and then I want to expose the result to Google Assistant.
The issue is that syncing the devices does not expose that sensor. I dumped the diagnostic data and confirmed that sensor device is not part of the sync data.
I think this is because min_max is not exposing the device_class, and so the integration rejects the device as not matching a known Google type (temperature).
If I use one of the temperature sensor directly, it works,

So is the assumption that any sensor that is able to sync with Google Assistant should have a valid DeviceClass?
It would seem sensible that min_max should just set the device class from one of it’s child sensors, and then the sync would work.

Welcome!

I have yet to get anything but temperature sensors to sync with Google Home/Assistant. I’ve been trying for well over 24 months now and no luck for anything beyond temperature. I think the issue is on Google end. If you have any insights on how to get other attributes through to Google, that would be much appreciated! I am a bit behind on Home Assistant version, maybe something is better with newer versions. I am running 2021.12.10. I can request temperature reading fine, but no love for humidity. Note the different, I think, DeviceClass as you point out.

I found a workaround. Using the ‘customize’ homeassistent config, you can add a ‘device_class’ attribute to any entity e.g:

homeassistant:
   customize:
      sensor.wine_cellar_temperature:
           device_class: temperature

The device_class is important as the google_assistant uses that to match the input to the Google traits for the device type: Smart Home Device Types  |  Actions on Google Smart Home  |  Google Developers
See SensorStateTrait in core/trait.py at 499c3410d1177eeec478af366e275a41b3e6ea60 · home-assistant/core · GitHub

Oh, and I didn’t have any issue with syncing a Humidity sensor, it came up fine on Google Home.

1 Like

Interesting, my sensors seem to have the proper device classes set when the sensors are defined. And these carry thru to Home Assistant. See my sensor definitions below and the result on the HA developer page. However as showed in my prior post, in the Google Home section of HA, the humidity and temperature objects seem to be different. If you can share with type of humidity sensor you are using and what the attributes look like in the HA developer page and HA Google Exposed entities page, I would appreciate this. Thx.

  • platform: mqtt
    name: “Backyard ATC_MI Temperature”
    device_class: temperature
    unique_id: “A4:C1:38:6B:80:DA-Temperature”
    expire_after: 3600
    state_topic: “homeassistant/sensor/ble-temp/A4:C1:38:6B:80:DA”
    value_template: “{{ value_json.temperature }}”
    unit_of_measurement: “°F”
    json_attributes_topic: “homeassistant/sensor/ble-temp/A4:C1:38:6B:80:DA”

  • platform: mqtt
    name: “Backyard ATC_MI Humidity”
    device_class: humidity
    unique_id: “A4:C1:38:6B:80:DA-Humidity”
    expire_after: 3600
    state_topic: “homeassistant/sensor/ble-temp/A4:C1:38:6B:80:DA”
    value_template: “{{ value_json.humidity }}”
    unit_of_measurement: “%”
    json_attributes_topic: “homeassistant/sensor/ble-temp/A4:C1:38:6B:80:DA”

The sensor is a Xiaomi WSDCGQ01LM Zigbee temperature/humidity sensor, connected by the MQTT integration. It was automatically discovered when I added that integration.
The entity info from Developer tools is:

The google assistant config is:

google_assistant:
  project_id: ...
  service_account: ...
  report_state: true
  expose_by_default: false
  exposed_domains:
    - sensor
    - switch
  entity_config:
    sensor.wine_cellar_temperature:
      name: Wine Cellar temperature
      expose: true
      room: Wine Cellar
    sensor.wine_cellar_1_humidity:
      name: Cellar humidity
      expose: true
      room: Wine Cellar
    switch.0x00158d000353d160:
      name: Switch
      expose: true
      room: Downstairs

I had removed the humidity sensor from the exposed devices, but just added it back it, and ran the ‘sync devices’ on the integration, and the humidity device appeared in my Google Home app.

Thanks for info. I gotta roll up my sleeves and get my HA server current. Highly likely I am behind the version where this started to work.

FWIW, I’m on 2022.9.6, using the latest docker stable image