The Mount Kelvin API uses API keys to authenticate requests. You can view and manage your API keys in the Mount Kelvin Fleet Manager.
Provide your API key as header Authorization: Bearer 7b1mX9SrgQy...MPEPZrf6IY
.
Tools
The examples are illustrated using the following command-line tools:
Sites and site groups
Site is a logical unit representing single independant areas like hotel rooms. Site group consists of one or more sites.
Sites are identified by an siteId
. siteId
for target site can by found from the site group members list.
Getting the site configuration
To get the single site configuration:
curl -s -H 'authorization: Bearer 7b1mX9SrgQy' https://api.mountkelvin.com/v2/sites/<siteId>
The response is the site configuration (a.k.a. site.json
).
Controlling individual devices
To list the devices in site.json
, do
curl -s -H 'authorization: Bearer 7b1mX9SrgQy' https://api.mountkelvin.com/v2/sites/<siteId> \
| jq '.devices[] | {id, type, name}
Pick the light device you want to control. Then, write a state for the device, such as
{
"id": "<deviceId>",
"state": {
"on": true,
"bri": 255
}
}
and pass it as a request body
curl -s -X POST \
-H 'authorization: Bearer 7b1mX9SrgQy' \
-H 'content-type: application/json' \
-d '{ "id": "<deviceId>", "state": { "on": true, "bri": 255 } }' \
https://api.mountkelvin.com/v2/sites/<siteId>/applyDevice
Controlling all devices in a room
Find the room id of the room from site.json
, then write a state for the devices in the room, such as
{
"id": "<roomId>",
"state": {
"on": true,
"bri": 255
}
}
and pass it as a request body
curl -s -X POST \
-H 'authorization: Bearer 7b1mX9SrgQy' \
-H 'content-type: application/json' \
-d '{ "id": "<roomId>", "state": { "on": true, "bri": 255 } }' \
https://api.mountkelvin.com/v2/sites/<siteId>/applyRoom
Activating scenes
To list the scenes in site.json
, do
curl -s -H 'authorization: Bearer 7b1mX9SrgQy' https://api.mountkelvin.com/v2/sites/<siteId> \
| jq '.scenes[] | {id, name}'
Pick the scene you want to activate, then
curl -s -X POST \
-H 'authorization: Bearer 7b1mX9SrgQy' \
-H 'content-type: application/json' \
-d '{ "id": "<sceneId>" }' \
https://api.mountkelvin.com/v2/sites/<siteId>/applyScene
There is also two special scenes available allOn
and allOff
, they can be activated like normal scenes:
curl -s -X POST \
-H 'authorization: Bearer 7b1mX9SrgQy' \
-H 'content-type: application/json' \
-d '{ "id": "allOff" }' \
https://api.mountkelvin.com/v2/sites/<siteId>/applyScene