-1

When calling the get devices API, the customName field in the Device Info trait (sdm.devices.traits.Info) is always coming back as an empty string. All permissions have been accepted and I have even tried to change the name in the Google Home app, but the custom name is always blank.

Any help would be appreciated.

API call:

curl --request GET \
  --url https://smartdevicemanagement.googleapis.com/v1/enterprises/{project id}/devices/{device id} \
  --header 'Authorization: Bearer {token}'

response:

{
  "name": "enterprises/{project id}/devices/{device id}",
  "type": "sdm.devices.types.THERMOSTAT",
  "assignee": "enterprises/{project id}/structures/{structure id}/rooms/{room id}",
  "traits": {
    "sdm.devices.traits.Info": {
      "customName": ""
    },
    "sdm.devices.traits.Humidity": {
      "ambientHumidityPercent": 60
    },
    "sdm.devices.traits.Connectivity": {
      "status": "ONLINE"
    },
    "sdm.devices.traits.Fan": {
      "timerMode": "OFF"
    },
    "sdm.devices.traits.ThermostatMode": {
      "mode": "HEAT",
      "availableModes": [
        "HEAT",
        "COOL",
        "HEATCOOL",
        "OFF"
      ]
    },
    "sdm.devices.traits.ThermostatEco": {
      "availableModes": [
        "OFF",
        "MANUAL_ECO"
      ],
      "mode": "OFF",
      "heatCelsius": 13.5,
      "coolCelsius": 28
    },
    "sdm.devices.traits.ThermostatHvac": {
      "status": "OFF"
    },
    "sdm.devices.traits.Settings": {
      "temperatureScale": "FAHRENHEIT"
    },
    "sdm.devices.traits.ThermostatTemperatureSetpoint": {
      "heatCelsius": 19.444443
    },
    "sdm.devices.traits.Temperature": {
      "ambientTemperatureCelsius": 24.787186
    }
  },
  "parentRelations": [
    {
      "parent": "enterprises/{project id}/structures/{structure id}/rooms/{room id}",
      "displayName": "Hallway"
    }
  ]
}
Gordie
  • 1
  • 1

1 Answers1

0

After doing some testing, the customName field is not a field of the device, It's only a field of the Structure.

Make your call to the structures endpoint:

https://smartdevicemanagement.googleapis.com/v1/enterprises/{project id}/structures 

Then you will see the home name from the Google home app.

Update - For custom names for devices, I was only able to get this not to be blank after setting the device's label in the Nest App on iOS. Tap on the device, then tap settings, then under about tap Where, then set the device's "Label". This value will show up as the sdm.devices.traits.Info trait - customName.

Andrew Roach
  • 66
  • 1
  • 4
  • I am trying to get the device custom name, not the home name. Based on the API documentation, devices should have a sdm.devices.traits.Info trait with a customName field, but that is always returning blank in my case. – Gordie Jan 26 '21 at 19:23