Skip to content
ogavb edited this page Sep 17, 2019 · 6 revisions

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 📈

Table of Contents

Servers

URL Protocol Description
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.
Security Requirements
Type In Name Scheme Format Description
apiKey user

Provide your API key as the user and leave the password empty.

oauth2

Flows to support OAuth 2.0

openIdConnect

Channels

The topic on which measured values may be produced and consumed.

Channel Parameters

streetlightId

The ID of the streetlight.

Name Type Description Accepted values
streetlightId
string</td>
Any

publish smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured

Message

Inform about environmental lighting conditions of a particular streetlight.

Headers
Name Type Description Accepted values
my-app-header
integer</td>
Any
Example of headers (generated)
{
  "my-app-header": 0
}
Payload
Name Type Description Accepted values
lumens
integer</td>

Light intensity measured in lumens.

Any
sentAt
string</td>

Date and time when the message was sent.

Any
Example of payload (generated)
{
  "lumens": 0,
  "sentAt": "2019-09-17T20:45:51Z"
}

Channel Parameters

streetlightId

The ID of the streetlight.

Name Type Description Accepted values
streetlightId
string</td>
Any

subscribe smartylighting/streetlights/1/0/action/{streetlightId}/turn/on

Message

Command a particular streetlight to turn the lights on or off.

Headers
Name Type Description Accepted values
my-app-header
integer</td>
Any
Example of headers (generated)
{
  "my-app-header": 0
}
Payload
Name Type Description Accepted values
command
string</td>

Whether to turn on or off the light.

on, off
sentAt
string</td>

Date and time when the message was sent.

Any
Example of payload (generated)
{
  "command": "on",
  "sentAt": "2019-09-17T20:45:51Z"
}

Channel Parameters

streetlightId

The ID of the streetlight.

Name Type Description Accepted values
streetlightId
string</td>
Any

subscribe smartylighting/streetlights/1/0/action/{streetlightId}/turn/off

Message

Command a particular streetlight to turn the lights on or off.

Headers
Name Type Description Accepted values
my-app-header
integer</td>
Any
Example of headers (generated)
{
  "my-app-header": 0
}
Payload
Name Type Description Accepted values
command
string</td>

Whether to turn on or off the light.

on, off
sentAt
string</td>

Date and time when the message was sent.

Any
Example of payload (generated)
{
  "command": "on",
  "sentAt": "2019-09-17T20:45:51Z"
}

Channel Parameters

streetlightId

The ID of the streetlight.

Name Type Description Accepted values
streetlightId
string</td>
Any

subscribe smartylighting/streetlights/1/0/action/{streetlightId}/dim

Message

Command a particular streetlight to dim the lights.

Headers
Name Type Description Accepted values
my-app-header
integer</td>
Any
Example of headers (generated)
{
  "my-app-header": 0
}
Payload
Name Type Description Accepted values
percentage
integer</td>

Percentage to which the light should be dimmed to.

Any
sentAt
string</td>

Date and time when the message was sent.

Any
Example of payload (generated)
{
  "percentage": 0,
  "sentAt": "2019-09-17T20:45:51Z"
}