YinHangCode / homebridge-mi-philips-light

XiaoMi Philips light plugins for HomeBridge.
99 stars 18 forks source link

Philips Smart LED Bulb not possible to control #10

Closed semaf closed 6 years ago

semaf commented 6 years ago

I have problem with the Bulb and can not control it.

[2017-11-26 03:45:13] [MiPhilipsLightPlatform] [MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light - getPower Error: Error: Call to device timed out
[2017-11-26 03:45:13] [MiPhilipsLightPlatform] [MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light - getBrightness Error: Error: Call to device timed out
[2017-11-26 03:45:13] [MiPhilipsLightPlatform] [MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light - getColorTemperature Error: Error: Call to device timed out

I read my token from my iPhone and it is 96byte long. Set all of it but got still the error. Shorted down to 32byte and still the same Error.

ZEXTFWVERSION: 1.3.0_0033 ZMODEL: philips.light.bulb ZTOKENENCRYPT: 1 ZPERMITLEVEL: 16

{
    "platform": "MiPhilipsLightPlatform",
    "deviceCfgs": [
        {
            "type": "MiPhilipsSmartBulb",
            "ip": "192.168.0.31",
            "token": "96 byte token",
            "lightName": "living room bulb",
            "lightDisable": false
        }
    ]
}

I resetted the Bulb and connected again and read out the Token and it was the same.

Kuglikrug commented 6 years ago

Hey @semaf

I have the exact same problem. Converted the 96 character token to a 32 character one with this website (http://aes.online-domain-tools.com) and used the 32 character one in my config.

The lamp shows up in HomeKit for a couple seconds but then disappears and i get the same error.

semaf commented 6 years ago

How did you convert it? I am missing more info to convert it https://aesencryption.net/

Kuglikrug commented 6 years ago

here are my settings:

bildschirmfoto 2017-11-26 um 12 08 03

the bottom right numbers are your result

Kuglikrug commented 6 years ago

can everybody now control my bulb because i uploaded my token btw? 🤔

semaf commented 6 years ago

I dont think so because your MAC is important but remove the line.

semaf commented 6 years ago

Ok my 32byte was wrong and your way has also same result :( Maybe the firmware of the bulb is the reason. What is the firmware version of your bulb?

semaf commented 6 years ago

its working nowww... yippiiiiiiii

Next step to hack the Amazon Dash button to switch on off ;)

Kuglikrug commented 6 years ago

hooooooooooooooow? hahahaha

semaf commented 6 years ago

Token was 96byte and converted to 32byte. Thanks to @Kuglikrug

config.js

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },

    "platforms": [

        {
            "platform": "MiPhilipsLightPlatform",
            "deviceCfgs": [
                {
                    "type": "MiPhilipsSmartBulb",
                    "ip": "192.168.0.31",
                    "token": "32byte token",
                    "lightName": "living room bulb",
                    "lightDisable": false
                }
            ]
        }
    ]
}

Start Homebridge and was control able over HomeKit.

Kuglikrug commented 6 years ago

i'm hyped 😅 !!!!

semaf commented 6 years ago

Check post above. If you have question let me know, I am here.

Kuglikrug commented 6 years ago

which version of node are you running now? I'm on a Raspberry Pi Zero W and have to update nodejs manually. I am currently on 8.9.0

semaf commented 6 years ago

8.9.1

semaf commented 6 years ago

If you can remove Node than install it with below and you get latest:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

Kuglikrug commented 6 years ago

the script does not work with the Zero W because its on arm6 and not arm7. I will manually update to 8.9.1 and let you know if it works

Kuglikrug commented 6 years ago

Ok first things first, it works!!

After switching Node Versions back and fourth (apparently there ist no 8.9.1. for Arm6l Chips only 8.9.0 or 9.0.0 and above) i messed up homebridge and nodejs and npm and nothing worked.

Now i have node v 8.7.0 (randomly selected one) and somehow miio --discover now worked. So I used it to find my token just to make sure i had the right one aaaaaaaaaaaand my original token (the one via iOS Backup) was wrong. So I used the correct token and sticked to 8.7.0 and voila, no crash.

Thank you @semaf and thank you @YinHangCode you both did a fantastic job and i am now really really enjoying my Philips LED 😄

I am so happy now I cant stop smiling when I change the brightness with Siri 🎉 😃

Greetings from Berlin, Germany

semaf commented 6 years ago

Nice to hear that! Between I use OpenHAB2 too and added the Amazon Dash Button to switch on or off the lights.

The main problem i see all the time is that npm is not downside compatible.