cloud.smarthq.service.stopwatch¶
Description¶
Service to model a stopwatch that indicates the amount of time elapsed.
Example Device Response (Digital Twin API)¶
Stopwatch service to know the elapsed cook time on a smoker.
{
"adapterId": "0000000000000000000000000000000000000000",
"alertTypes": [],
"createdDateTime": "2022-03-04T12:12:12.123Z",
"deviceId": "0000000000000000000000000000000000000000000000000000000000000000",
"deviceType": "cloud.smarthq.device.smoker",
"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.stopwatch",
"lastSyncTime": "2022-03-04T12:12:12.123Z",
"domainType": "cloud.smarthq.domain.cooking",
"supportedCommands": [],
"state": {
"paused": false,
"secondsElapsed": 3600.0
},
"serviceId": "0000000000000000000000000000000000000000000000000000000000000000",
"serviceDeviceType": "cloud.smarthq.device.smoker",
"config": {
"granularity": "cloud.smarthq.type.timergranularity.minutes"
},
"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 |
---|---|---|
granularity | TIME_GRANULARITY | Yes |
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 | Minimum |
---|---|---|---|
disabled | BOOLEAN | No | |
paused | BOOLEAN | Yes | |
secondsElapsed | INTEGER | Yes | 0 |
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.stopwatch.start¶
Command used to start a stopwatch.
Example Commands¶
Example command to start a stopwatch.
{
"command": {
"commandType": "cloud.smarthq.command.stopwatch.start"
},
"deviceId": "00000000000000000000000000000000000000000000000000000000000000",
"domainType": "cloud.smarthq.domain.cooking",
"kind": "service#command",
"serviceDeviceType": "cloud.smarthq.device.smoker",
"serviceType": "cloud.smarthq.service.stopwatch"
}
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.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 |
cloud.smarthq.command.stopwatch.reset¶
Command used to reset a stopwatch.
Example Commands¶
Example command to reset a stopwatch.
{
"command": {
"commandType": "cloud.smarthq.command.stopwatch.reset"
},
"deviceId": "00000000000000000000000000000000000000000000000000000000000000",
"domainType": "cloud.smarthq.domain.cooking",
"kind": "service#command",
"serviceDeviceType": "cloud.smarthq.device.smoker",
"serviceType": "cloud.smarthq.service.stopwatch"
}
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.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 |
cloud.smarthq.command.stopwatch.pause¶
Command used to pause a stopwatch.
Example Commands¶
Example command to pause a stopwatch.
{
"command": {
"commandType": "cloud.smarthq.command.stopwatch.pause"
},
"deviceId": "00000000000000000000000000000000000000000000000000000000000000",
"domainType": "cloud.smarthq.domain.cooking",
"kind": "service#command",
"serviceDeviceType": "cloud.smarthq.device.smoker",
"serviceType": "cloud.smarthq.service.stopwatch"
}
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.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.
INTEGER¶
Value must be an integer. Field specific restrictions such as a minimum and maximum may apply depending on the field.
TIME_GRANULARITY¶
TIME_GRANULARITY | Documentation |
---|---|
cloud.smarthq.type.timergranularity.days | Granularity of days |
cloud.smarthq.type.timergranularity.hours | Granularity of hours |
cloud.smarthq.type.timergranularity.minutes | Granularity of minutes |
cloud.smarthq.type.timergranularity.seconds | Granularity of seconds |