Streetlights API 1.0.0 documentation
The Smartylighting Streetlights API allows you to remotely manage the city lights.
Check out its awesome features:
- Turn a specific streetlight on/off 🌃
- Dim a specific streetlight 😎
- Receive real-time information about environmental lighting conditions 📈
Servers
production Server
| URL | Protocol | Description |
|---|---|---|
| mqtt://test.mosquitto.org:{port} | mqtt | Test broker |
URL Variables
| Name | Default value | Possible values | Description |
|---|---|---|---|
| port | 1883 | 1883, 8883 | Secure connection (TLS) is available through port 8883. |
Channels
smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured Channel
The topic on which measured values may be produced and consumed.
Channel Parameters
| Name | Type | Description | Accepted values |
|---|---|---|---|
| streetlightId | string | The ID of the streetlight. | Any |
publish Operation
Inform about environmental lighting conditions of a particular streetlight.
This is the description with bold text.
On multiple lines.
Message
Inform about environmental lighting conditions of a particular streetlight.
Headers
| Name | Type | Description | Accepted values |
|---|---|---|---|
| my-app-header | integer | - | Any |
Examples of headers (generated)
{
"my-app-header": 0
}
Payload
| Name | Type | Description | Accepted values |
|---|---|---|---|
| lumens | integer | Light intensity measured in lumens. | Any |
| sentAt | string | Date and time when the message was sent. | Any |
Examples of payload (generated)
{
"lumens": 0,
"sentAt": "2019-08-24T14:15:22Z"
}
Tags
- message-tag1
- message-tag2
- message-tag3
- message-tag4
- message-tag5
smartylighting/streetlights/1/0/action/{streetlightId}/turn/on Channel
Channel Parameters
| Name | Type | Description | Accepted values |
|---|---|---|---|
| streetlightId | string | The ID of the streetlight. | Any |
subscribe Operation
Message
Command a particular streetlight to turn the lights on or off.
Headers
| Name | Type | Description | Accepted values |
|---|---|---|---|
| my-app-header | integer | - | Any |
Examples of headers (generated)
{
"my-app-header": 0
}
Payload
| Name | Type | Description | Accepted values |
|---|---|---|---|
| command | string | Whether to turn on or off the light. | on, off |
| sentAt | string | Date and time when the message was sent. | Any |
Examples of payload (generated)
{
"command": "on",
"sentAt": "2019-08-24T14:15:22Z"
}
smartylighting/streetlights/1/0/action/{streetlightId}/turn/off Channel
Channel Parameters
| Name | Type | Description | Accepted values |
|---|---|---|---|
| streetlightId | string | The ID of the streetlight. | Any |
subscribe Operation
Message
Command a particular streetlight to turn the lights on or off.
Headers
| Name | Type | Description | Accepted values |
|---|---|---|---|
| my-app-header | integer | - | Any |
Examples of headers (generated)
{
"my-app-header": 0
}
Payload
| Name | Type | Description | Accepted values |
|---|---|---|---|
| command | string | Whether to turn on or off the light. | on, off |
| sentAt | string | Date and time when the message was sent. | Any |
Examples of payload (generated)
{
"command": "on",
"sentAt": "2019-08-24T14:15:22Z"
}
smartylighting/streetlights/1/0/action/{streetlightId}/dim Channel
Channel Parameters
| Name | Type | Description | Accepted values |
|---|---|---|---|
| streetlightId | string | The ID of the streetlight. | Any |
subscribe Operation
Message
Command a particular streetlight to dim the lights.
Headers
| Name | Type | Description | Accepted values |
|---|---|---|---|
| my-app-header | integer | - | Any |
Examples of headers (generated)
{
"my-app-header": 0
}
Payload
| Name | Type | Description | Accepted values |
|---|---|---|---|
| percentage | integer | Percentage to which the light should be dimmed to. | Any |
| sentAt | string | Date and time when the message was sent. | Any |
Examples of payload (generated)
{
"percentage": 0,
"sentAt": "2019-08-24T14:15:22Z"
}
some.channel Channel
subscribe Operation
this description shows in markdown
Accepts one of the following messages:
Message Success
Payload
| Name | Type | Description | Accepted values |
|---|---|---|---|
| result | string | - | Any |
Examples of payload (generated)
{
"result": "success"
}
Message Failure
Payload
| Name | Type | Description | Accepted values |
|---|---|---|---|
| error | object | - | Any |
| error.errorCode | integer | - | Any |
| error.errorMessage | string | - | Any |
Examples of payload
{
"error": {
"errorCode": 404,
"errorMessage": "Something messed up"
}
}