Skip to content
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

How does one figure out a product ID? #4

Closed
mgedmin opened this issue Jan 8, 2020 · 8 comments
Closed

How does one figure out a product ID? #4

mgedmin opened this issue Jan 8, 2020 · 8 comments

Comments

@mgedmin
Copy link

mgedmin commented Jan 8, 2020

Hi!

I've a Viomi Smart Kettle SK-152A that integrates with the Xiaomi Mi Home app. It shows up on htmgmt find as "MiKettle" (MAC B8:7C:6F:xx:xx:xx). Attempts to talk to it using the known Xiaomi MiKettle product IDs (275 or 131) fail with Exception: Authentication failed when I run python demo.py connect $MAC $PID.

Now I'm not 100% sure it uses the same protocol (although the "MiKettle" name is very telling), but if it is, how would I go about figuring out the right product ID to use? Random guessing doesn't seem very productive.

@Hypfer
Copy link

Hypfer commented Jan 8, 2020

You iterate over a lot of them until it starts working.

Try 1116

@mgedmin
Copy link
Author

mgedmin commented Jan 8, 2020

1116 makes it beep before I get a

bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral B8:7C:6F:xx:xx:xx, addr type: public

error, which is very interesting. (It doesn't always beep, sometimes I just get the disconnect error.)

@Hypfer
Copy link

Hypfer commented Jan 8, 2020

Beeping means that the handshake was successful so the remaining connectivity issues are most likely not caused by a wrong productId

@mgedmin
Copy link
Author

mgedmin commented Jan 8, 2020

I only just now noticed that not only does it beep, it also manages to report the firmware version:

FW: 7.5.10

before disconnecting.

@mgedmin
Copy link
Author

mgedmin commented Jan 8, 2020

Ooh, if I comment out the firmware_version() call, then the name() call succeeds

Name: yunmi.kettle.v7

And if I comment out both, then kettle.parameter_value(MI_CURRENT_TEMPERATURE) succeeds:

DEBUG:mikettle.mikettle:Init Mikettle with mac B8:7C:6F:xx:xx:xx and pid 1116
Authenticating
Getting data from mi Kettle
DEBUG:mikettle.mikettle:Filling cache with new sensor data.
DEBUG:mikettle.mikettle:Connect
DEBUG:mikettle.mikettle:Auth
DEBUG:mikettle.mikettle:Subscribe
DEBUG:mikettle.mikettle:Wait for data
DEBUG:mikettle.mikettle:Status update:
DEBUG:mikettle.mikettle:Parse data: b'\x00\xff\x00\x00PN\x00\x00\x00\x01\x18\x00'
DEBUG:mikettle.mikettle:data parsed {'action': 'idle', 'mode': 'none', 'set temperature': 80, 'current temperature': 78, 'keep warm type': 'warm up', 'keep warm time': 0}
Current temperature: 78

@Hypfer
Copy link

Hypfer commented Jan 8, 2020

v7 🤔

Any idea if there is more functionality in the app now?

There seems to be a preset function which you can use by just interacting with the kettle and pushing the "WARM" button a few times.
I wonder if we could program those and/or see them in the current state

@mgedmin
Copy link
Author

mgedmin commented Jan 8, 2020

TBH I'm not sure what the app allows since it wants me to create an account or something silly like that. A coworker did that (this is an office kettle) but they already left so I can't ask.

The instruction manual mentions four preset modes (50/70/80/90 deg C) that you can choose by repeatedly pressing the Warm button.

A github search on yunmi.kettle.v7 leads me to https://github.com/liguobingh/com.viomi.kettlepro/blob/d69a5de3978c6902f20c6404d6d62b3696c86706/src/main/java/com/viomi/kettlepro/UMGlobalParam.java, but there don't seem to be any checks that distinguish MODEL_KETTLE_V7 from other versions in that codebase.

mgedmin added a commit to mgedmin/mikettle that referenced this issue Jan 8, 2020
My Viomi Smart Kettle SK-152A (product ID 1116, yunmi.kettle.v7) doesn't
like it when you try to connect too frequently, resulting in
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral
XX:XX:XX:XX:XX:XX, addr type: public.

Reusing the same connection makes demo.py work fine.

See drndos#4.
@mgedmin
Copy link
Author

mgedmin commented Jan 8, 2020

I've fixed the issues with disconnections: it seems that every helper method was re-connecting and re-authenticating, and my kettle doesn't appear to like that. I've created #5 for this.

I'm going to close this issue because my question was answered in #4 (comment).

@mgedmin mgedmin closed this as completed Jan 8, 2020
annadorottya pushed a commit to annadorottya/mikettle that referenced this issue Oct 27, 2020
My Viomi Smart Kettle SK-152A (product ID 1116, yunmi.kettle.v7) doesn't
like it when you try to connect too frequently, resulting in
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral
XX:XX:XX:XX:XX:XX, addr type: public.

Reusing the same connection makes demo.py work fine.

See drndos#4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants