MlscRestClient

thingsx. MlscRestClient

music_led_strip_control REST client

Class providing state fetching from and command sending to the REST API of music_led_strip_control. It is using a scheduled job to fetch states and a rule to handle commands.

Constructor

new MlscRestClient(config)

Description:
  • Be aware that you need to call scheduleStateFetching and createCommandHandlingRule to fully initialize the REST client.

Source:
Example
var { thingsx } = require('@hotzware/openhab-tools');
var mlsc = new thingsx.MlscRestClient({
  effectItemName: 'FlorianRGB_effect',
  url: 'http://127.0.0.1:8080',
  deviceId: 'device_0',
  colorItemName: 'FlorianRGB_color',
  dimmerItemName: 'FlorianRGB_dimmer'
});
mlsc.scheduleStateFetching();
mlsc.createCommandHandlingRule();
Parameters:
Name Type Description
config MlscRestClientConfig

mlsc REST client config

Methods

createCommandHandlingRule()

Description:
  • Creates the rule used for command handling.

Source:

getAvailableEffects() → {Object}

Description:
  • Get all available music and non-music effects.

Source:
Returns:
Type
Object

scheduleStateFetching() → {NodeJS.Timeout}

Description:
  • Schedules the state fetching using setInterval.

Source:
Returns:

intervalId of the interval used for state fetching

Type
NodeJS.Timeout