google-home / smart-home-nodejs

A sample of the Smart Home device control APIs in Actions on Google
Apache License 2.0
894 stars 292 forks source link

What type should be used for air conditioners? #517

Closed JavaDev99 closed 4 years ago

JavaDev99 commented 4 years ago

I need to control air conditioner by Google smart home. My device has mode,fan and temperature settings I investigated documentation and found that I should use one of these types

action.devices.types.AC_UNIT

action.devices.types.Thermostat

But I have some problems with both types I used action.devices.types.Thermostat type and I tried to set temperature range but it didn't work I set sync response so SYNC json response

{
  "payload": {
    "agentUserId": "1836.15267389",
    "devices": [
      {
        "traits": [
          "action.devices.traits.TemperatureSetting"
        ],
        "willReportState": true,
        "name": {
          "defaultNames": [
            "Smart Thermostat"
          ],
          "name": "Thermostat",
          "nicknames": [
            "Living Room Thermostat"
          ]
        },
        "attributes": {
          "thermostatTemperatureRange": {
            "maxThresholdCelsius": 32,
            "minThresholdCelsius": 16
          },
          "availableThermostatModes": "off,heat,cool,on",
          "thermostatTemperatureUnit": "C"
        },
        "customData": {
          "fooValue": 74,
          "bazValue": "lambtwirl",
          "barValue": true
        },
        "id": "123",
        "type": "action.devices.types.THERMOSTAT",
        "deviceInfo": {
          "swVersion": "11.4",
          "model": "t-1000",
          "manufacturer": "Sirius Cybernetics Corporation",
          "hwVersion": "3.2"
        }
      }
    ]
  },
  "requestId": "496450786377560015"
}

But When I tested range by Google home my device temperature range was between 10-32 And modes also don't work correctly too. I set available modes so SYNC json response

{
  "payload": {
    "agentUserId": "1836.15267389",
    "devices": [
      {
        "traits": [
          "action.devices.traits.TemperatureSetting"
        ],
        "willReportState": true,
        "name": {
          "defaultNames": [
            "Smart Thermostat"
          ],
          "name": "Thermostat",
          "nicknames": [
            "Living Room Thermostat"
          ]
        },
        "attributes": {
          "thermostatTemperatureRange": {
            "maxThresholdCelsius": 32,
            "minThresholdCelsius": 16
          },
          "availableThermostatModes": "off,heat,cool,on,auto,dry",
          "thermostatTemperatureUnit": "C"
        },
        "customData": {
          "fooValue": 74,
          "bazValue": "lambtwirl",
          "barValue": true
        },
        "id": "123",
        "type": "action.devices.types.THERMOSTAT",
        "deviceInfo": {
          "swVersion": "11.4",
          "model": "t-1000",
          "manufacturer": "Sirius Cybernetics Corporation",
          "hwVersion": "3.2"
        }
      }
    ]
  },
  "requestId": "496450786377560015"
}

and the return such query response QUERY json response

{
  "payload": {
    "devices": {
      "123": {
        "online": true,
        "on": true,
        "thermostatMode": "auto",
        "thermostatTemperatureSetpoint": 16,
        "thermostatTemperatureAmbient": 16,
        "status": "SUCCESS"
      }
    }
  }

But it shows mode other in Google Home app And about action.devices.types.AC_UNIT this type It shows only on and off functionality How can I fix these problems? please help me

devunwired commented 4 years ago

I would suggest using action.devices.types.AC_UNIT as a thermostat device typically controls a complete HVAC system that supports both heating and cooling. Generally speaking, device type doesn't have much bearing on functionality. Most of the questions you have here are related to the behavior of the TemperatureSetting trait.

And about action.devices.types.AC_UNIT this type It shows only on and off functionality

This is only true on the current version of the Google Home app. Smart display devices will report the device with temperature controls as long as it contains the TemperatureSetting trait. You may file a feature request in the public tracker with specific requests for the Google Home app.

and I tried to set temperature range but it didn't work But When I tested range by Google home my device temperature range was between 10-32

There is an open issue for the display of custom ranges in the Google Home app in the public tracker. Feel free to star the issue to subscribe for updates.

Note that your custom range should be taken into account through voice queries (Assistant responds with "[device] cannot be set to that temperature").

And modes also don't work correctly too. But it shows mode other in Google Home app

There is an open issue for the display of "auto" mode in the public tracker. Feel free to star the issue to subscribe for updates.

Closing this issue here as this is not an issue with the smart home sample code. Feel free to follow up on the linked issues.

JavaDev99 commented 4 years ago

thank you for answer