UNPKG

node-hue-api

Version:
43 lines (42 loc) 1.72 kB
import { configurationApi } from './http/endpoints/configuration'; import { ApiDefinition } from './http/ApiDefinition'; export class Configuration extends ApiDefinition { constructor(hueApi) { super(hueApi); } /** * Obtains the complete configuration from the Hue Bridge in a raw Object format that is returned from the API. * This function will return all the config along with all the lights, schedules, groups, scenes, resourcelinks, etc... * * @returns The raw data returned from the Hue Bridge */ getAll() { return this.execute(configurationApi.getFullState); } /** * Gets the unauthenticated configuration data from the bridge. * @returns The unauthenticated configuration data from the bridge. */ getUnauthenticatedConfig() { return this.execute(configurationApi.getUnauthenticatedConfig); } /** * Updates a configuration value for the Hue Bridge. * @param data The data that is to be updated for the bridge configuration. */ updateConfiguration(data) { return this.execute(configurationApi.updateConfiguration, { config: data }); } getConfiguration() { return this.execute(configurationApi.getConfiguration); } /** * A virtual press of the link button to perform pairing of software/services. This no longer works on the local * network connection due to security implications which led to it being disabled by Hue developers. * * This will function if you are using the library over the remote API/portal though. */ pressLinkButton() { return this.execute(configurationApi.updateConfiguration, { linkbutton: true }); } }