How to use the node-tradfri-client.AccessoryTypes.lightbulb function in node-tradfri-client

To help you get started, we’ve selected a few node-tradfri-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thkl / Homematic-Virtual-Interface / plugins / IkeaTradfri / TradfriPlatform.js View on Github external
function tradfri_deviceUpdated(device) {

        that.trApiDevices[device.instanceId] = device.type

        if (device.type === AccessoryTypes.lightbulb) {

            // Create the Devices or update them
            if (!that.trApiLightbulbs[device.instanceId]) {

                // fill the node-tradfri-client lights api object
                that.trApiLightbulbs[device.instanceId] = device

                that.log.info('new Lamp %s found', device.instanceId)
                var tdevice = new TradfriDevice(that, device.instanceId) // (plugin, id)
                that.mappedDevices[device.instanceId] = tdevice
            } else {

                // update the node-tradfri-client lights api object
                that.trApiLightbulbs[device.instanceId] = device
                that.log.debug('update Lamp %s', device.instanceId)
            }
github fvanwijk / tradfri-app / server / api / devices.js View on Github external
function marshallDevice({ client, ...device }) {
  switch (device.type) {
    case AccessoryTypes.motionSensor:
      device.sensorList = device.sensorList.map(({ client, ...sensor }) => sensor);
      break;
    case AccessoryTypes.lightbulb:
    case 1:
      device.lightList = (device.lightList || []).map(({ client, _accessory, ...light }) => light);
      break;
    case AccessoryTypes.remote:
      device.switchList = device.switchList.map(({ client, ...remote }) => remote);
      break;
    default:
      console.log('Not mapped', device);
  }

  return device;
}
github thkl / Homematic-Virtual-Interface / plugins / IkeaTradfri / TradfriPlatform.js View on Github external
group.deviceIDs.forEach(deviceID => {
                if ((groupType === 0) && (that.trApiDevices[deviceID] === AccessoryTypes.lightbulb)) {
                    groupType = 1;
                }
                if ((groupType === 0) && (that.trApiDevices[deviceID] === AccessoryTypes.blind)) {
                    groupType = 2;
                }
            });