aholstenson / miio

Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more
MIT License
1.86k stars 354 forks source link

Philips Eyecare 2: this.setModes is not a function #145

Open jghaanstra opened 6 years ago

jghaanstra commented 6 years ago

There seems to be a bug in the driver for the Philips Eyecare 2 lamp. This code generates the following error.

const miio = require('./node_modules/miio/lib');

// Create a new device over the given address
miio.device({
    address: '192.168.0.1',
  token: 'xxxxxxxxxxxxxxxxxxxxxxx'
}).then(device => {
  const getData = async () => {
      try {
          const power = await device.power();
          const brightness = await device.brightness()
          const mode = await device.mode();
          const eyecare = await device.eyeCareMode();

          let result = {
              onoff: power,
              brightness: brightness,
              mode: mode,
              eyecare: eyecare
          }

          console.log(result)
      } catch (error) {
          console.log(error);
      }
  }
  getData();
}).catch(err => console.log('Error occurred:', err));
pi@iobroker:~ $ node miio.js
Error occurred: { TypeError: this.setModes is not a function
at new EyecareLamp2 (/usr/lib/node_modules/miio/lib/devices/eyecare-lamp2.js:68:8)
at network.findDeviceViaAddress.then.device (/usr/lib/node_modules/miio/lib/connectToDevice.js:25:12)
at device: null }
notabene00 commented 6 years ago

Same here

Eternity-again commented 5 years ago

Still no solution :-(