jghaanstra / com.xiaomi-miio

Homey app to control Mi Home devices that implement the miIO protocol and Xiaomi gateway child devices
GNU General Public License v3.0
457 stars 85 forks source link

adding Philips light bulb error #37

Closed kopanicak closed 6 years ago

kopanicak commented 6 years ago

i can't add Philips light bulb. i have got an error: device.power is not a function. IP and token are good.

what i do wrong? thanks

screen

jghaanstra commented 6 years ago

I have made some changes in release 2.6.5 concerning the Philips Light Bulbs. This version will be published in the app store soon. Please test it with this new version and report back if this is still an issue.

kopanicak commented 6 years ago

I test it with new version 2.6.5, but still same error. with xiaomi app for iOS bulb works. can I do something else?

jghaanstra commented 6 years ago

Are you sure your token is correct. Another user has reported the Philips Light Bulbs to be working correctly. See https://github.com/jghaanstra/com.xiaomi-miio/issues/33

I dont own the device myself so I cant test it. If you know your way around nodejs and the command line I could create a little test script that might give more info on what is going on. Let me know.

kopanicak commented 6 years ago

I get the token from "miio discover". If I change token, IP or I turn off LED bulb I got this error message "Could not connect to device, handshake timeout". I can run your test script for more info. thanks

jghaanstra commented 6 years ago

Install nodejs and the miio command line (npm install -g miio)

Go to your nodejs directory and create a file called miio.js which contains the following:

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 color = await device.color();

          let result = {
              onoff: power,
              brightness: brightness,
              color: color,
          }

          console.log(result)
      } catch (error) {
          console.log(error);
      }
  }
  getData();
}).catch(err => console.log('Error occurred:', err));

Edit the path to where you installed miio, the IP address of your bulb and your token. Then run the script with node miio.js and let me know the output.

kopanicak commented 6 years ago

screen

same error

kopanicak commented 6 years ago

screen5

if I write bad token i have got an error "Could not connect to device"

jghaanstra commented 6 years ago

@rostov36 see this issue. I know you have Philips bulbs as well. Could you try and run the same code as supplied in this issue and report back if you see similar results. As I recall you did not have issues pairing your Philips bulbs which either suggests there are more types out there that work differently or there is something wrong with the bulb from @kopanicak .

rostov36 commented 6 years ago

My bulb works good. I can help but not earlier than June 13th. I'm not in the city.

rostov36 commented 6 years ago

@kopanicak can you reboot your bulb? May be in this problem)

kopanicak commented 6 years ago

q02 q01

I have these bulbs from Gearbest. Buyed in May 2018. I reset bulbs four times and I still can not pair with Homey.

rostov36 commented 6 years ago

This lamp doesn’t support plugin.

kopanicak commented 6 years ago

ok. there is the problem. i'm sorry for my mistake. thanks for support.

kopanicak commented 6 years ago

it is possible to make support for these very popural cheap bulbs? can I help with something? what is the way for adding support with unknown devices?

jghaanstra commented 6 years ago

@kopanicak you can control it using the Mi Home smartphone app?

If so, you can have a look here on how to add support: https://github.com/aholstenson/miio/blob/master/docs/missing-devices.md

For now I'm closing this issue.