Les codes d'erreur suivants peuvent être renvoyés en lien avec ce trait :
Message d'erreur
RPC
Dépannage
La commande n'est pas autorisée dans le mode thermostat actuel.
FAILED_PRECONDITION
Certains modèles de thermostats ne permettent pas de modifier le mode Éco lorsque le mode du thermostat est DÉSACTIVÉ, conformément au trait ThermostatMode . Le mode du thermostat doit être défini sur CHAUFFAGE, CLIMATISATION ou CHAUFFCLIM avant de pouvoir modifier le mode Éco.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/29 (UTC).
[null,null,["Dernière mise à jour le 2025/07/29 (UTC)."],[[["\u003cp\u003eThe \u003ccode\u003esdm.devices.traits.ThermostatMode\u003c/code\u003e trait allows you to interact with the thermostat mode (HEAT, COOL, HEATCOOL, OFF) of compatible Nest Thermostat devices.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve the available and current thermostat modes using a GET request to the device's endpoint.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSetMode\u003c/code\u003e command allows you to change the thermostat mode to a desired value by sending a POST request.\u003c/p\u003e\n"],["\u003cp\u003eEco modes are managed separately through the \u003ccode\u003eThermostatEco\u003c/code\u003e trait and not through this trait.\u003c/p\u003e\n"],["\u003cp\u003eCertain thermostat models may have limitations on changing the Eco mode while the thermostat mode is OFF, requiring a switch to HEAT, COOL, or HEATCOOL first.\u003c/p\u003e\n"]]],[],null,["\u003cbr /\u003e\n\nThermostatMode Schema\n=====================\n\n[Nest Thermostat](/nest/device-access/api/thermostat)\n\n`sdm.devices.traits.ThermostatMode`\n\nThis trait belongs to device types of THERMOSTAT that support different thermostat modes.\n\n\u003cbr /\u003e\n\nFields\n------\n\n\n| Field | Description | Data Type |\n|------------------|-------------------------------------|--------------------------------------------------------------|\n| `availableModes` | List of supported thermostat modes. | `array(string)` Value: \\[\"HEAT\", \"COOL\", \"HEATCOOL\", \"OFF\"\\] |\n| `mode` | The current thermostat mode. | `string` Values: \"HEAT\", \"COOL\", \"HEATCOOL\", \"OFF\" |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n#### Sample GET request and response\n\n### Request\n\n```\nGET /enterprises/project-id/devices/device-id\n```\n\n### Response\n\n {\n \"name\" : \"enterprises/project-id/devices/device-id\",\n \"traits\" : {\n \"sdm.devices.traits.ThermostatMode\" : {\n \"availableModes\" : [\"HEAT\", \"COOL\", \"HEATCOOL\", \"OFF\"],\n \"mode\" : \"COOL\"\n }\n }\n }\n\n\u003cbr /\u003e\n\nCommands\n--------\n\n\u003cbr /\u003e\n\n### SetMode\n\nChange the thermostat mode.\n\n\u003cbr /\u003e\n\n| This trait does not work with Eco modes. See the [ThermostatEco](/nest/device-access/traits/device/thermostat-eco) trait for more information.\n\n\u003cbr /\u003e\n\n#### SetMode request and response\n\n### Request\n\n POST /enterprises/project-id/devices/device-id:executeCommand\n {\n \"command\" : \"sdm.devices.commands.ThermostatMode.SetMode\",\n \"params\" : {\n \"mode\" : \"HEAT\"\n }\n }\n\n### Response\n\n```\n{}\n```\n\n#### SetMode request fields\n\n| Field | Description | Data Type |\n|--------|---------------------------------------|----------------------------------------------------|\n| `mode` | The mode to change the thermostat to. | `string` Values: \"HEAT\", \"COOL\", \"HEATCOOL\", \"OFF\" |\n\n\u003cbr /\u003e\n\n\nErrors\n------\n\nThe following error code(s) may be returned in relation to this trait:\n\n| Error Message | RPC | Troubleshooting |\n|-------------------------------------------------|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Command not allowed in current thermostat mode. | `FAILED_PRECONDITION` | Some thermostat models do not support changing the Eco mode when the thermostat mode is OFF, according to the ThermostatMode trait. The thermostat mode must be changed to HEAT, COOL, or HEATCOOL prior to changing the Eco mode. |\n\nSee the [API Error Code Reference](/nest/device-access/reference/errors/api) for\nthe full list of API error codes.\n\n\u003cbr /\u003e"]]