cloud.smarthq.service.temperature¶
Description¶
Service to model a temperature that can be read only or remotely controlled. Both Celsius and Fahrenheit are supported and automatically converted using calculated properties.
Example Device Response (Digital Twin API)¶
Temperature Service for Refrigerator.
{
"adapterId": "0000000000000000000000000000000000000000",
"alertTypes": [],
"createdDateTime": "2022-03-04T12:12:12.123Z",
"deviceId": "0000000000000000000000000000000000000000000000000000000000000000",
"deviceType": "cloud.smarthq.device.refrigerator.freshfood",
"gatewayId": "0000000000000000000000000000000000000000000000000000000000000000",
"kind": "device#item",
"lastPresenceTime": "2022-03-04T12:12:12.123Z",
"lastSyncTime": "2022-03-04T12:12:12.123Z",
"presence": "OFFLINE",
"removable": true,
"services": [
{
"serviceType": "cloud.smarthq.service.temperature",
"lastSyncTime": "2022-03-04T12:12:12.123Z",
"domainType": "cloud.smarthq.domain.setpoint",
"supportedCommands": [
"cloud.smarthq.command.temperature.set"
],
"state": {
"celsiusConverted": 2.2222222222222223,
"fahrenheit": 36.0
},
"serviceId": "0000000000000000000000000000000000000000000000000000000000000000",
"serviceDeviceType": "cloud.smarthq.device.refrigerator",
"config": {
"fahrenheitMinimum": 34.0,
"fahrenheitDefault": 37.0,
"fahrenheitMaximum": 45.0,
"celsiusDefaultConverted": 2.7777777777777777,
"celsiusMaximumConverted": 7.222222222222222,
"label": "Convertible drawer",
"celsiusMinimumConverted": 1.1111111111111112
},
"lastStateTime": "2022-03-04T12:12:12.123Z"
}
],
"userId": "000000000000000"
}
Configuration¶
The following are properties for the gateway/device sync as part of the "config" object for each individual service.
| Field Name | Property Type | Required | Calculated |
|---|---|---|---|
| celsiusDefault | DOUBLE | No | |
| celsiusDefaultConverted | DOUBLE | No | Yes |
| celsiusMaximum | DOUBLE | No | |
| celsiusMaximumConverted | DOUBLE | No | Yes |
| celsiusMinimum | DOUBLE | No | |
| celsiusMinimumConverted | DOUBLE | No | Yes |
| fahrenheitDefault | DOUBLE | No | |
| fahrenheitDefaultConverted | DOUBLE | No | Yes |
| fahrenheitMaximum | DOUBLE | No | |
| fahrenheitMaximumConverted | DOUBLE | No | Yes |
| fahrenheitMinimum | DOUBLE | No | |
| fahrenheitMinimumConverted | DOUBLE | No | Yes |
| label | STRING | No | |
| relativeTemperature | BOOLEAN | No |
State¶
The following are properties for the device state report as part of the "state" object for each individual service.
| Field Name | Property Type | Required | Calculated |
|---|---|---|---|
| celsius | DOUBLE | No | |
| celsiusConverted | DOUBLE | No | Yes |
| disabled | BOOLEAN | No | |
| fahrenheit | DOUBLE | No | |
| fahrenheitConverted | DOUBLE | No | Yes |
Commands¶
The following are properties for both the Digital Twin API to send a command to the device as well as the properties passed as part of a command to the gateway to be processed by the device itself.
cloud.smarthq.command.temperature.set¶
Command to set the temperature on a temperature service. Allows for either Fahrenheit, Celsius, or both to be provided leaving it up to the device to decide which value is appropriate to use.
| Field Name | Property Type | Required | Calculated |
|---|---|---|---|
| celsius | DOUBLE | No | |
| celsiusConverted | DOUBLE | No | Yes |
| fahrenheit | DOUBLE | No | |
| fahrenheitConverted | DOUBLE | No | Yes |
Example Commands¶
Command to set temperature setpoint for the fresh food cavity of a refrigerator.
{
"command": {
"commandType": "cloud.smarthq.command.temperature.set",
"fahrenheit": 33.0
},
"deviceId": "00000000000000000000000000000000000000000000000000000000000000",
"domainType": "cloud.smarthq.domain.setpoint",
"kind": "service#command",
"serviceDeviceType": "cloud.smarthq.device.refrigerator.freshfood",
"serviceType": "cloud.smarthq.service.temperature"
}
Supported Outcomes¶
Each service has an allow listed set of outcomes that the device may return when asked to execute a command.
| Outcome | Documentation |
|---|---|
| cloud.smarthq.outcome.badrequest | The request was invalid. |
| cloud.smarthq.outcome.developererror | Only used when there is a server side bug |
| cloud.smarthq.outcome.deviceoffline | The device is offline. |
| cloud.smarthq.outcome.forbidden | The request is forbidden due to permissions. |
| cloud.smarthq.outcome.internalerror | The server had an issue processing the request |
| cloud.smarthq.outcome.missingconfig | The service config is missing |
| cloud.smarthq.outcome.missingstate | The service state is missing |
| cloud.smarthq.outcome.notallowed | The command is not allowed. |
| cloud.smarthq.outcome.notfound | The request is forbidden due to permissions. |
| cloud.smarthq.outcome.notsupported | The command is not supported. |
| cloud.smarthq.outcome.outofbounds | General out of bounds error |
| cloud.smarthq.outcome.servicedisabled | Feature is currently disabled |
| cloud.smarthq.outcome.success | Successful request |
| cloud.smarthq.outcome.timeout | The server experienced timeout waiting for a response from the gateway |
Data Types¶
BOOLEAN¶
Value must be either true or false.
DOUBLE¶
Value must be an double. Field specific restrictions such as a minimum and maximum may apply depending on the field.
STRING¶
Value must be a sequence of characters, inserted between " and " (double quotes). Field specific restrictions such as a regular expression may apply depending on the field.