Skip to content

Latest commit

 

History

History
125 lines (95 loc) · 3.06 KB

scenes.md

File metadata and controls

125 lines (95 loc) · 3.06 KB

Scenes

A Scene is a snapshot of the current state of a group of devices. It allows you to save your favorites configuration to be accessed easily. A given device could be part of different scenes.

Index:

####netbeast(`sceneid`).addDeviceScene(`id`)

The addDevice method allows us to add a new device to the selected scene. You must pass the id of the device and it will save the current state of it on the db.

netbeast('watchfilm').addDeviceScene(2)
.then(function (data) {})
.catch(function (error) {})
####netbeast(`sceneid`).applyScene()

This method apply the configuration of the given scene.

netbeast('watchfilm').applyScene()
.then(function (data) {})
.catch(function (error) {})
####netbeast(`sceneid`).createScene(`ids`)

This method is used to create a new scene by passing an array of device ids. It takes the current state of the given devices and store the scene in the db with the 'seceneid' name.

var devices = [1, 2, 6, 9]

netbeast('watchfilm').createScene(devices)
.then(function (data) {})
.catch(function (error) {})
####netbeast(`sceneid`).createCustomScene(`state`)

With this method you can create a new scene with a predefined state. state is an object array that contains the object id and the state of each device.

var newscene = [ {
        id: 1,
        status: {
          power: true,
          brightness: 99,
          hue: 200,
          saturation: 80
        }
    },
    {
        id: 8,
        status: {
          volume: 90,
          track: `url-track`,
        }
    }]


netbeast('watchfilm').createCustomScene(newscene)
.then(function (data) {})
.catch(function (error) {})
####netbeast(`sceneid`).deleteDeviceScene(`id`)

Instead of removing the whole scene, you are able to quit one device from the scene.

netbeast('watchfilm').deleteDeviceScene(6)
.then(function (data) {})
.catch(function (error) {})
####netbeast(`sceneid`).deleteScene()

With delete you can remove a given scene from the db

netbeast('watchfilm').deleteScene()
.then(function (data) {})
.catch(function (error) {})
####netbeast().getAllScenes()

The getScenes method return the name of all the scenes registered on the db. Arguments are not needed on this function.

netbeast().getAllScenes()
.then(function (data) {})
.catch(function (error) {})
####netbeast(`sceneid`).getScene()

This methods returns all the information about the scene.

netbeast('watchfilm').getScene()
.then(function (data) {})
.catch(function (error) {})

getScene has no arguments.