Hi,
I’m trying to connect my new Yeelight RGB v2 bulb using the Xiaomi Mi IO Binding but I’m having trouble (I think becuase of the token thing) controlling it.
I have it configured properly and I see the lamp as Online, but every time I send it a command an error similar to this is logged:
[WARN ] [rnal.transport.MiIoAsyncCommunication] - Send command '{"id":7631,"method":"get_prop","params":["power","bright","delayoff","ct","color_mode"]}' -> 192.168.XXX.YYY(Device: 0538C102) gave error Given final block not properly padded
I followed this guide to extract the token (method 2 - Packet sender):
# Obtain Mi Home device token
Use these methods to obtain the device token for the supported miio devices.
## Method 1 - Nodejs Command Line Tool from the miIO Device library
The author of the miIO Device Library which is used by this Homey app has also created a nodejs command line tool for retrieving device tokens. Please follow the steps in [these instructions](https://github.com/aholstenson/miio/blob/master/docs/management.md) to retrieve the token for the supported miio devices. Be aware that some devices hide their token after the device has been setup in the Mi Home app. Retrieving tokens for these devices will not work with this method but require method 3.
## Method 2 - Packet Sender Tool
During setup of Mi Home devices the device tokens an be retrieved by sending a ping command to the device. This method uses a tool called Packet Sender which you will need to download. Choose the portable version which does not require installation.
* Download the portable version of [Packet Sender](https://packetsender.com/download).
* Reset the device following the instructions from the device manual, this usually means holding one or two buttons for 10 seconds. This will reset all device settings including the Wi-Fi settings.
* After reset the device will create a it's own Wi-Fi network. This network will have a name related to the device and is used for configuring the device but will also allow us to retrieve the token. Connect to this Wi-Fi network with your computer which has Packet Sender running.
* Open Packet Sender and enter the following details.
* HEX: 21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
* IP: 192.168.8.1
* Port: 54321
* Protocol dropdown: UDP
* Click send and the device will respond with an answer which contains the unique device token. In the last 16 bytes (32 characters) of the devices response is the device token. Copy and save it somewhere.
* Disconnect your computer from the devices network, you can now use the Mi Home app to setup the device and connect it to your Wi-Fi network.
## Method 2b - netcat and Wireshark / tcpdump
This file has been truncated. show original
The response I receive is:
21 31 00 20 00 00 00 00 05 38 C1 02 00 00 00 1F C1 C9 95 80 1D 9F 1E D4 AE D0 1B C7 62 C6 47 7F
So the token is C1C995801D9F1ED4AED01BC762C6477F, right?
Thank you!