home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.43k stars 30.67k forks source link

Nabu Casa Google Home CO2 and PM sensors #100791

Closed Mikescotland closed 7 months ago

Mikescotland commented 1 year ago

The problem

For a moment i could see CO2 and PM2.5 levels in Google Home (it happens from time to time). Now, the tiles are blue and Unknown values. Both, PM2.5 and CO2 levels are supported by Google home which means something isn't right with link between HA and Google Home.

What version of Home Assistant Core has the issue?

2023.9.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

N/a

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @allenporter, mind taking a look at this issue as it has been labeled with an integration (google) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `google` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign google` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


google documentation google source (message by IssueLinks)

home-assistant[bot] commented 1 year ago

Hey there @home-assistant/cloud, mind taking a look at this issue as it has been labeled with an integration (cloud) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `cloud` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign cloud` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


cloud documentation cloud source (message by IssueLinks)

allenporter commented 1 year ago

What integration is this for? is this for https://www.home-assistant.io/integrations/google_assistant/ ?

Mikescotland commented 1 year ago

What integration is this for? is this for https://www.home-assistant.io/integrations/google_assistant/ ?

HA > Nabu Casa > Google Home Something is not right how Nabu Casa Cloud reports values of CO2 and PM to Google Home. Sometimes it shows in Google Home for a few seconds and then goes unavailable, sometimes it's always unavailable. Looking at Google docs, these sensors are supported.

home-assistant[bot] commented 1 year ago

Hey there @home-assistant/cloud, mind taking a look at this issue as it has been labeled with an integration (google_assistant) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `google_assistant` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign google_assistant` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


google_assistant documentation google_assistant source (message by IssueLinks)

dexn commented 10 months ago

I'm having this issue also. Opened an issue before seeing this one.

charlesflc commented 9 months ago

What integration is this for? is this for https://www.home-assistant.io/integrations/google_assistant/ ?

I'm having the same issue with google_assistant integration for my co2 sensor. I guess nabu casa ready-to-use integration and google_assistant are correlated.

I use a homemade CO2 sensor with an ESP32 and esphome. CO2 value is is properly transmitted with the right unit in homeassistant as shown in the image below.

image
The CO2 value is certainly incorrect

According to the Google developer page, the CO2 level is supported by Google Assistant (if I'm lookin at the right page) :

image
https://developers.home.google.com/cloud-to-cloud/traits/sensorstate?hl=fr#supported-sensors

It would be so cool to have a fix!

Sloth-on-meth commented 8 months ago

Having thissame issue

cermakjn commented 8 months ago

I already tried to debug this issue and it's the same on the Home Assistant Container without a Nabu Casa Cloud.

I looked at the Google Console to the Logs section and there are few error regarding CO2 and PM2.5:

{
insertId: ""
jsonPayload: {
reportStateLog: {
accuracy: "INACCURATE"
agentId: "home-assistant-xxx"
detailedAccuracyResult: "DETAILED_ACCURACY_RESULT_QUERY_STATE_MISSING_FIELD"
deviceType: "action.devices.types.SENSOR"
isMissingField: true
isOffline: false
queriedTime: "2024-02-13T23:24:39.456956Z"
queryReportStateDifferences: {
queryState: "sensor_state {
  current_sensor_state_data {
    name: "CarbonDioxideLevel"
  }
}
"
reportState: "sensor_state {
  current_sensor_state_data {
    name: "CarbonDioxideLevel"
    raw_value: 1277.0
  }
}
"
}
reportedTime: "2024-02-13T23:03:33.436Z"
requestId: "xxx"
result: "INACCURATE"
snapshotTime: "2024-02-13T23:24:39.456956Z"
stateName: "ALL"
traitName: "TRAIT_SENSOR_STATE"
}}
logName: "projects/home-assistant-xxx/logs/assistant_smarthome%2Fassistant_smarthome_logs"
receiveTimestamp: "2024-02-14T02:27:24.225785766Z"
resource: {
labels: {
project_id: "home-assistant-xxx"
}
type: "assistant_action_project"
}
severity: "ERROR"
timestamp: "2024-02-14T02:27:24.225785766Z"
}

When I try to debug requests from my HA to the Google API, everything looks fine, incl. the unit mention by @charlesflc

Example of the CO2 data from the Netatmo Sensor to the Google API:

{'id': 'sensor.living_room_weather_station_carbon_dioxide', 'name': {'name': 'Living Room Weather Station Carbon Dioxide'}, 'attributes': {'sensorStatesSupported': [{'name': 'CarbonDioxideLevel', 'numericCapabilities': {'rawValueUnit': 'PARTS_PER_MILLION'}}]}, 'traits': ['action.devices.traits.SensorState'], 'willReportState': True, 'type': 'action.devices.types.SENSOR', 'otherDeviceIds': [{'deviceId': 'sensor.living_room_weather_station_carbon_dioxide'}], 'customData': {'webhookId': 'xxx', 'httpPort': 8123, 'uuid': 'xxx'}, 'roomHint': 'Living Room', 'deviceInfo': {'manufacturer': 'Netatmo', 'model': 'Additional Indoor Module', 'swVersion': '53.0.0'}}

and PM2.5 - ESPHome

{'id': 'sensor.kitchen_air_quality_2_5ug', 'name': {'name': 'Kitchen Air Quality 2.5µg'}, 'attributes': {'sensorStatesSupported': [{'name': 'PM2.5', 'numericCapabilities': {'rawValueUnit': 'MICROGRAMS_PER_CUBIC_METER'}}]}, 'traits': ['action.devices.traits.SensorState'], 'willReportState': True, 'type': 'action.devices.types.SENSOR', 'otherDeviceIds': [{'deviceId': 'sensor.kitchen_air_quality_2_5ug'}], 'customData': {'webhookId': 'xxx', 'httpPort': 8123, 'uuid': 'xxx'}, 'roomHint': 'Kitchen', 'deviceInfo': {'manufacturer': 'Espressif', 'model': 'd1_mini', 'swVersion': '2023.12.7 (Feb  5 2024, 09:47:15)'}}

Both of those sensors looks like to be Unknown. In case of the Netatmo Weather Station, I have also connected it to the Google Home via their API and it works well.

EDIT: During the debugging, I find out, that there was a number in my CO2 sensor in the Google Home App, but when I click to this sensor, the state has been changed to Unknown. So after pressing the Synchronize devices button in HA, it is OK, but when Google Home ask Home Assistant, it will fail. So I debug this more and this is the request and response when I click to the sensor in the Google Home App:

ESP Home PM2.5:

2024-02-14 18:01:15.019 DEBUG (MainThread) [homeassistant.components.google_assistant.report_state] Scheduling report state for sensor.kitchen_air_quality_2_5ug: {'online': True, 'currentSensorStateData': [{'name': 'PM2.5', 'rawValue': '11'}]}
2024-02-14 18:01:16.258 DEBUG (MainThread) [homeassistant.components.google_assistant.http] Response on https://homegraph.googleapis.com/v1/devices:reportStateAndNotification with data {'requestId': 'xxx', 'agentUserId': 'xxx', 'payload': {'devices': {'states': {'sensor.kitchen_air_quality_2_5ug': {'online': True, 'currentSensorStateData': [{'name': 'PM2.5', 'rawValue': '11'}]}}}}} was {
  "requestId": "xxx"
}

and same for another Netatmo CO2:

2024-02-14 18:03:37.211 DEBUG (MainThread) [homeassistant.components.google_assistant.http] Response on https://homegraph.googleapis.com/v1/devices:reportStateAndNotification with data {'requestId': 'xxx', 'agentUserId': 'xxx', 'payload': {'devices': {'states': {'sensor.bedroom_weather_station_carbon_dioxide': {'online': True, 'currentSensorStateData': [{'name': 'CarbonDioxideLevel', 'rawValue': '864.0'}]}, 'sensor.bedroom_weather_station_temperature': {'online': True, 'temperatureSetpointCelsius': 20.2, 'temperatureAmbientCelsius': 20.2}, 'sensor.office_weather_station_carbon_dioxide': {'online': True, 'currentSensorStateData': [{'name': 'CarbonDioxideLevel', 'rawValue': '904.0'}]}}}}} was {
  "requestId": "xxx"
}
cermakjn commented 7 months ago

Fixed in PR https://github.com/home-assistant/core/pull/112838 In the release 2024.3.1 works great.

joostlek commented 7 months ago

I'll close this issue then :)