Topic/Thing
The topic handles all the activities regarding the Thing description (properties, actions and events). However, it is important to differ between two different types of topics: status and set topics. Each one of these will behave differently within the Thing description.
Status Topics
- Properties:
status/<account-id>/collections/<collection-id>/things/<thing-UID>/properties/<property-id>
- Actions:
status/<account-id>/collections/<collection-id>/things/<thing-UID>/actions/<action-id>
- Events:
status/<account-id>/collections/<collection-id>/things/<thing-UID>/events/<event-id>
SUBSCRIBE status/myspace/collections/my-collection/things/01FDSA7KS76MNR32J8W0RAWEFX/actions/Volumechange
{
"Volumechange": {
"input": {
"level": 70,
"duration": 2500
},
"href": "/things/001/actions/Volumechange/123e4567-e89b-12d3-a456-426655",
"timeRequested": "2017-01-25T15:01:35+00:00",
"status": "pending"
}
}
To receive all actions of one particular Thing, subscribe to the following MQTT topic:
SUBSCRIBE status/myspace/collections/my-collection/things/01FDSA7KS76MNR32J8W0RAWEFX/actions/+
Message 1:
{
"Volumechange": {
"input": {
"level": 70,
"duration": 2500
},
"href": "/things/001/actions/Volumechange/18",
"timeRequested": "2017-01-25T15:01:35+00:00",
"status": "pending"
}
}
Message 2:
{
"reboot": {
"href": "/things/Sound/actions/reboot/12",
"timeRequested": "2017-01-24T13:13:33+00:00",
"timeCompleted": "2017-01-24T13:15:01+00:00",
"status": "completed"
}
}
Set Topics
- Properties
set/<account-id>/collections/<collection-id>/things/<thing-UID>/properties/<property-id>
- Actions
set/<account-id>/collections/<collection-id>/things/<thing-UID>/actions/<action-id>
- Events
set/<account-id>/collections/<collection-id>/things/<thing-UID>/events/<event-id>
PUBLISH set/myspace/collections/my-collection/things/01FDSA7KS76MNR32J8W0RAWEFX/actions/Volumechange
{
"Volumechange": {
"input": {
"level": 70,
"duration": 2500
}
}
}
{
"Volumechange": {
"href": "/things/001/actions/Volumechange/12",
"input": {
"duration": 2500,
"level": 70
},
"status": "pending",
"timeRequested": "2020-05-29T11:09:06+0000"
}
}
set/myspace/collections/my-collection/things/01FDSA7KS76MNR32J8W0RAWEFX/actions/Volumechange/12
{
"Volumechange":{
"status":"Completed"
}
}
{
"Volumechange": {
"href": "/things/001/actions/Volumechange/12",
"input": {
"duration": 2500,
"level": 70
},
"status": "Completed",
"timeCompleted": "2020-05-29T11:14:41+0000",
"timeRequested": "2020-05-29T11:09:06+0000"
}
}