-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Device token is hidden, cannot add accessory #36
Comments
I am experiencing the same issue. Did you ever end up fixing the issue Robert? |
I have the same issue with the WiFi Power Plugs. |
I have no idea what's going on here. if anyone knows how to fix it, i'll happily accept a pull request as long as it seems stable on my home setup. I've not needed to factory reset my plugs at all but now i'm a bit scared to since i don't have any spares currently. maybe worth pestering the |
@Bluebie do you know if there’s a way to manually assign the token rather than using the discovery? |
from memory i think there is a way in the miio library, but i haven't really worked on this plugin in years. i'm pretty out of touch with it. I wonder if the issue maybe that the underlying miio library has a way to store device tokens. could it be that the token changed when you reset the device, and miio is using an old cached token? unsure. maybe something in https://github.com/aholstenson/miio/blob/master/docs/management.md could help figure that out, or maybe you can use that tool to set the token to something fixed? homebridge-miio is using an older version of miio. i might try it with an up to date version, see if it needs any changes for compatability, perhaps the miio library has some improvements to help with these devices already? |
I did some testing with the command line tools in the link you posted and once you reset the device, it can no longer see the token. |
@chrisp250 Apologies for the late response. I'm getting back to this now that I have some more free time, did you ever end up finding a fix? I found this issue on GitHub, which suggests downloading a Russian app in order to get the token and set it manually using miio. I can't download it though, as I don't have an Android device. Edit: I have managed to get the tokens of my devices now, so now the challenge is updating the token using miio or letting homebridge-miio know what the token is, like you said. I think this could be achieved with Edit 2: After some more looking around, I have found a solution that works for me. Perhaps it'll be useful to anyone who stumbles upon this in the future. The idea is: we need to get the token of the device, but it is hidden in a database file. Once we get this token, we can manually set it using the miio protocol and that way Homebridge will know the token and be able to interact with the device.
|
@Bluebie Device tokens stored in memory (through Does this tell you anything in regards of where we could look to get this issue resolved? I am, in fact, still struggling with this. Did you also ever get around to updating to a newer version of miio? Perhaps that might resolve some things as well. |
Here's my final input into this issue, as I was finally able to completely solve this. I'll describe some steps below for anyone else that might run into this in the future. I think this issue can be closed now. As per my latest two comments: the tokens need to be manually stored in memory to make sure homebridge can use these. After going through everything once again I saw the following on the Miio github:
This explains why the stored tokens were showing up through |
Here are my 2¢. I've spent ~10 hours digging arround homebridge + miio and found that..
So to store your device token (from ios backup for example): cd node_modules/homebridge-miio/ # Digg into subfolder
npx miio --update deviceID --token decryptedTokenAsHex # Store device token
# If homebridge is running within user, find it
`ps uax | grep -i homebridge`
# Execute command with his privileges
sudo -u homebridge-user npx miio --update deviceID --token decryptedTokenAsHex If your geting this message with ERROR Unsupported mode than something wrong with your cli arguments If you've got problems with your device recognition ( ...
'chuangmi.plug.v2': PowerPlug,
+ 'chuangmi.plug.m3': PowerPlug,
+ 'chuangmi.plug.hmi206': PowerPlug,
'rockrobo.vacuum.v1': Vacuum,
... NB: All this combination is very fragile and will be broken after any upgrade or version missmatch.
{
"deviceId1": "decryptedTokenAsHex1",
"deviceId2": "decryptedTokenAsHex2"
} |
There is a good way to extract the tokens of your Xiaomi devices. Check this out: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor I am running it in my Raspberry Pi and I run the command (listed below) in the command line tools. You will need your Xiaomi username and password, and the server of your Xiaomi account, mostly likely is 'cn', then all your Xiaomi devices will be listed for you and the tokens associated with your devices whichever has it. bash <(curl -L https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor/raw/master/run.sh) When you execute this command you will see something like this: Enter then your username/password and server name (one of: cn, de, us, ru, tw, sg, in, i2) then you should have a list of Xiaomi devices like this: |
If anyone wants to take over this project or do some pull requests bringing it up to date, i'd very much welcome it. I'm not currently using any of these devices but I do still have some in a closet so I could test updates and validate them on my end. |
Running into an issue where the device token is hidden and the plug cannot be added.
The text was updated successfully, but these errors were encountered: