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

WalkingPad A1 Pro #797

Closed
Lazybone opened this issue Aug 14, 2020 · 36 comments · Fixed by #975
Closed

WalkingPad A1 Pro #797

Lazybone opened this issue Aug 14, 2020 · 36 comments · Fixed by #975
Assignees

Comments

@Lazybone
Copy link

Device information:

  • Name(s) of the device: Xiaomi WalkingPad A1 Pro
  • Link:

Use miiocli device --ip <ip address> --token <token>.

  • Model: ksmb.walkingpad.v1
  • Hardware version: MTK7697
  • Firmware version: 2.0.5

Additional context

@thomasvs
Copy link

I've been looking for ways to get at data from my WalkingPad. Have you been able to interface with it in any way?

@dmatora
Copy link

dmatora commented Jan 26, 2021

Dreaming about extracting steps data from the device

@syssi syssi self-assigned this Jan 26, 2021
@syssi syssi added the miio label Jan 26, 2021
@syssi
Copy link
Collaborator

syssi commented Jan 26, 2021

Some `get_prop` calls of the mihome app (react plugin):

get_prop ['mode', 'sp']
get_prop ["goal"]
get_prop ['initial']
get_prop ['offline']
get_prop ["lock"]
get_prop ["max"]
get_prop ['mode', 'sp', 'step', 'dist', 'time', 'button_id']
get_prop ["max", "sensitivity", "start_speed", "auto", "disp", "lock"]
get_prop ['mode', 'sp', 'step', 'time', 'dist', 'cal', 'goal']

Methods:

set_mode [mode] # supported modes: 0, 1, 2, 3
set_offline [offline] # offline: 0, 1
set_state ['run']
tutorial [index] # index: integer. supported values unknown
set_max [speed] / set_max [6]
set_lock [0]
set_sensitivity [index] # index: integer. supported values unknown
set_auto [index] # index: integer. supported values unknown
set_lock [index] # index: integer. supported values unknown
set_start_speed [speed]
set_disp [index] # index: integer. supported values unknown
set_speed [speed]
set_cali [1] / set_cali [0]
set_goal [typeIndex, goalValue]
set_insure [1]

Could somebody provide the responses of the get_prop calls and wants to play around with the methods? We need a description per method and possible values. I can try to provide some parameter types.

@dmatora
Copy link

dmatora commented Jan 30, 2021

raw_command set_start_speed '["1.0"]' finally made my WalkingPad autostart on speed 1! Hurray!

raw_command get_prop '["mode"]' returns

  • [0] while mode is auto
  • [1] while mode is manual
  • [2] when in standby

raw_command get_prop '["step"]' returns [2303]
raw_command get_prop '["time"]' returns [1970] (while time is 32:50)
raw_command get_prop '["dist"]' returns [1869]
raw_command get_prop '["cal"]' returns [67340]
raw_command get_prop '["goal"]' returns [0, 60]
raw_command get_prop '["max"]' returns [6.0]
raw_command get_prop '["initial"]' returns [3]
raw_command get_prop '["offline"]' returns [0]
raw_command get_prop '["sensitivity"]' returns [2]
raw_command get_prop '["sp"]' returns [1.0]
raw_command get_prop '["start_speed"]' returns [1.0]
raw_command get_prop '["auto"]' returns [1]
raw_command get_prop '["disp"]' returns [19]
raw_command get_prop '["lock"]' returns [0]

@dmatora
Copy link

dmatora commented Feb 2, 2021

Built myself an iOS app, to put steps from walking pad into apple health and watch my daily step goal
telegram-cloud-photo-size-2-5244712315109093918-y
telegram-cloud-photo-size-2-5246693751026463818-y
unfortunately it only works when web server with php script is providing miiocli bridge on local network
hopefully milo javascript library will get react native support soon enough and I'll be able to make this standalone app

@dmatora
Copy link

dmatora commented Feb 2, 2021

Some get_prop calls of the mihome app (react plugin):

@syssi btw, how did you get those?
I'd really like to get those for my Xiaomi Rice cooking robot (MBIH-R3), it's app is also a nightmare

@rytilahti
Copy link
Owner

rytilahti commented Feb 2, 2021

@dmatora if you are talking about getting supported by https://github.com/aholstenson/miio , I wouldn't hold my breath as the last commit is from 2018. If you know of a maintained fork / other project, please let us know! I think it would be a good idea to have a section for "related projects" in the readme file.

Also, feel free to create a PR to add support for the walking pad to this library, if you wish :-)

@dmatora
Copy link

dmatora commented Feb 3, 2021

feel free to create a PR to add support for the walking pad to this library, if you wish :-)

@rytilahti I am thinking about adding it to home assistant so it can act as a proxy for iOS app
does it involve adding it to miio-python? or can I just add it straight to home assistant?

anyway I think both options are above my head, but I can give it a try :)

@rytilahti
Copy link
Owner

@dmatora yes, to get it supported in the official homeassistant, the support needs to be added first to this library and then to homeassistant (separately).

There is xiaomi_raw (linked in the README.md), which allows using devices without proper integration for the time being.

If you are somewhat familiar with python, adding support to new device to this library is not usally very complicated, and there are plenty of examples for other devices available :-)

@dmatora
Copy link

dmatora commented Feb 6, 2021

can't remember writing anything in python
when getting token for walkingpad using token_extractor.py I've noticed it also shows

   NAME:  Thermometer
   ID:    blt.3.10dog0vhs5400
   IP:    185.135.151.12
   TOKEN: 1D1EAD2236B752B5B4B16251
   MODEL: miaomiaoce.thermo.t01

which is a bluetooth device.
Does miio_python work with bluetooth devices?
I would love to get Miaomiaoce Zenmeasure (or any other reliable continious body temperature monitor) integrated with Apple Health

@syssi
Copy link
Collaborator

syssi commented Feb 6, 2021

The short answer is no. python-miio requires a wifi device (talking the miio protocol).

@rytilahti
Copy link
Owner

For BT(LE), https://github.com/zewelor/bt-mqtt-gateway looks nice, but I have never used it so far. There are some bluetooth standardized formats, but I suppose most use some sort of proprietary format and you have to manually reverse-engineer the payload contents to add support. If you want to go that road, see https://reverse-engineering-ble-devices.readthedocs.io/en/latest/ :)

@syssi
Copy link
Collaborator

syssi commented Feb 6, 2021

You could grab a esp32 and use esphome as btle gateway: https://esphome.io/components/sensor/xiaomi_ble.html#lywsd02

@dmatora
Copy link

dmatora commented Feb 7, 2021

I spoke to @Ernst79 and he added support for ZenMeasure to HomeAssistant, except that values sensor reports do not mach value shown on ZenMeasure app.
More details on issue here - custom-components/ble_monitor#264

I'll think who can I speak to about including HomeAssistant support for Walkingpad :)

@dewgenenny
Copy link
Contributor

Hey! I just added a pull request here: #975 to support the walkingpad a1 :)

@dmatora
Copy link

dmatora commented Mar 17, 2021

Hey! I just added a pull request here: #975 to support the walkingpad a1 :)

That's a great news! Thanks!
Hopefully it will be merged and we can start adding this to home assistant. This clearly needs more features in order to serve as server for GUI I wrote. I might be able to collaborate on that.

@dewgenenny
Copy link
Contributor

set_sensitivity

hey @syssi are you able to share where you got those get_prop commands from for the walkingpad? I am trying to hunt down if there is a 'total distance' value stored somewhere in the device and so far I've had no luck....

@syssi
Copy link
Collaborator

syssi commented Apr 13, 2021

@dewgenenny If you use the Mi Home App and setup your miIO device a react.js based plugin is downloaded and used. I've extracted the used properties and methods of the Mi Home App plugin.

rytilahti added a commit that referenced this issue May 5, 2021
[Full Changelog](0.5.5.2...0.5.6)

**Implemented enhancements:**

- RFC: Add a script to simplify finding supported properties for miio [\#919](#919)
- Improve test\_properties output [\#1024](#1024) ([rytilahti](https://github.com/rytilahti))
- Relax zeroconf version requirement [\#1023](#1023) ([rytilahti](https://github.com/rytilahti))
- Add test\_properties command to device class [\#1014](#1014) ([rytilahti](https://github.com/rytilahti))
- Add discover command to miiocli [\#1013](#1013) ([rytilahti](https://github.com/rytilahti))
- Fix supported oscillation angles of the dmaker.fan.p9 [\#1011](#1011) ([syssi](https://github.com/syssi))
- Add additional operation mode of the deerma.humidifier.jsq1 [\#1010](#1010) ([syssi](https://github.com/syssi))
- Roborock S7: Parse history details returned as dict [\#1006](#1006) ([fettlaus](https://github.com/fettlaus))

**Fixed bugs:**

- zeroconf 0.29.0 which is incompatible [\#1022](#1022)
- Remove superfluous decryption failure for handshake responses [\#1008](#1008)
- Skip pausing on Roborock S50 [\#1005](#1005)
- Roborock S7 after Firmware Update 4.1.2-0928 - KeyError [\#1004](#1004)
- No air quality value when aqi is 1 [\#958](#958)
- Fix exception on devices with removed lan\_ctrl [\#1028](#1028) ([Kirmas](https://github.com/Kirmas))
- Fix start bug and improve error handling in walkingpad integration [\#1017](#1017) ([dewgenenny](https://github.com/dewgenenny))
- gateway: fix zigbee lights [\#1016](#1016) ([starkillerOG](https://github.com/starkillerOG))
- Silence unable to decrypt warning for handshake responses [\#1015](#1015) ([rytilahti](https://github.com/rytilahti))
- Fix set\_mode\_and\_speed mode for airdog airpurifier [\#993](#993) ([alexeypetrenko](https://github.com/alexeypetrenko))

**Closed issues:**

- Add Dafang camera \(isa.camera.df3\) support [\#996](#996)
- Roborock S7 [\#989](#989)
- WalkingPad A1 Pro [\#797](#797)

**Merged pull requests:**

- Add basic dmaker.fan.1c support [\#1012](#1012) ([syssi](https://github.com/syssi))
- Always return aqi value \[Revert PR\#930\] [\#1007](#1007) ([bieniu](https://github.com/bieniu))
- Added S6 to skip pause on docking [\#1002](#1002) ([Sian-Lee-SA](https://github.com/Sian-Lee-SA))
- Added number of dust collections to CleaningSummary if available [\#992](#992) ([fettlaus](https://github.com/fettlaus))
- Reformat history data if returned as a dict/Roborock S7 Support \(\#989\) [\#990](#990) ([fettlaus](https://github.com/fettlaus))
- Add support for Walkingpad A1 \(ksmb.walkingpad.v3\) [\#975](#975) ([dewgenenny](https://github.com/dewgenenny))
rytilahti added a commit that referenced this issue May 5, 2021
[Full Changelog](0.5.5.2...0.5.6)

**Implemented enhancements:**

- RFC: Add a script to simplify finding supported properties for miio [\#919](#919)
- Improve test\_properties output [\#1024](#1024) ([rytilahti](https://github.com/rytilahti))
- Relax zeroconf version requirement [\#1023](#1023) ([rytilahti](https://github.com/rytilahti))
- Add test\_properties command to device class [\#1014](#1014) ([rytilahti](https://github.com/rytilahti))
- Add discover command to miiocli [\#1013](#1013) ([rytilahti](https://github.com/rytilahti))
- Fix supported oscillation angles of the dmaker.fan.p9 [\#1011](#1011) ([syssi](https://github.com/syssi))
- Add additional operation mode of the deerma.humidifier.jsq1 [\#1010](#1010) ([syssi](https://github.com/syssi))
- Roborock S7: Parse history details returned as dict [\#1006](#1006) ([fettlaus](https://github.com/fettlaus))

**Fixed bugs:**

- zeroconf 0.29.0 which is incompatible [\#1022](#1022)
- Remove superfluous decryption failure for handshake responses [\#1008](#1008)
- Skip pausing on Roborock S50 [\#1005](#1005)
- Roborock S7 after Firmware Update 4.1.2-0928 - KeyError [\#1004](#1004)
- No air quality value when aqi is 1 [\#958](#958)
- Fix exception on devices with removed lan\_ctrl [\#1028](#1028) ([Kirmas](https://github.com/Kirmas))
- Fix start bug and improve error handling in walkingpad integration [\#1017](#1017) ([dewgenenny](https://github.com/dewgenenny))
- gateway: fix zigbee lights [\#1016](#1016) ([starkillerOG](https://github.com/starkillerOG))
- Silence unable to decrypt warning for handshake responses [\#1015](#1015) ([rytilahti](https://github.com/rytilahti))
- Fix set\_mode\_and\_speed mode for airdog airpurifier [\#993](#993) ([alexeypetrenko](https://github.com/alexeypetrenko))

**Closed issues:**

- Add Dafang camera \(isa.camera.df3\) support [\#996](#996)
- Roborock S7 [\#989](#989)
- WalkingPad A1 Pro [\#797](#797)

**Merged pull requests:**

- Add basic dmaker.fan.1c support [\#1012](#1012) ([syssi](https://github.com/syssi))
- Always return aqi value \[Revert PR\#930\] [\#1007](#1007) ([bieniu](https://github.com/bieniu))
- Added S6 to skip pause on docking [\#1002](#1002) ([Sian-Lee-SA](https://github.com/Sian-Lee-SA))
- Added number of dust collections to CleaningSummary if available [\#992](#992) ([fettlaus](https://github.com/fettlaus))
- Reformat history data if returned as a dict/Roborock S7 Support \(\#989\) [\#990](#990) ([fettlaus](https://github.com/fettlaus))
- Add support for Walkingpad A1 \(ksmb.walkingpad.v3\) [\#975](#975) ([dewgenenny](https://github.com/dewgenenny))
@dmatora
Copy link

dmatora commented May 16, 2021

@syssi how did you access react plugin?

@syssi
Copy link
Collaborator

syssi commented May 16, 2021

@dmatora The archive is downloaded if you install/pair the device at your smartphone / mihome app. I've sent you the archive by mail (gmail.com).

@dmatora
Copy link

dmatora commented May 16, 2021

@syssi well we got walkingpad already figured out
I'm asking so that I can build better GUI for my Xiaomi Rice Cooking Robot MBIH-R3
It's plugin is horrible - it doesn't even update stat, unless you restart the plugin.
Do I need rooted device?
Which path of smartphone did you extract this from?

@syssi
Copy link
Collaborator

syssi commented May 16, 2021

Could you create a new issue for the device? Do you know the model identifier (f.e. ksmb.walkingpad.v1) of the device?

@thomasvs
Copy link

Coming back to this - I'm confused. AFAIK My WalkingPad A1 (not Pro) is BTLE, not WiFi. Is the merged code only useful for the Pro then? Can someone confirm whether WiFi vs Bluetooth is an (unadvertised) difference between the two modeels?

@rytilahti
Copy link
Owner

This library is only useful for devices that use the miio/miot protocol over wifi. The communication with btle devices is usually done by manufacturer specific commands and are out of the scope for this library.

@Ernst79
Copy link

Ernst79 commented May 20, 2021

@thomasvs If you are sure that the non-pro version communicates over BLE (and you are using Home Assistant), we might be able to add it to BLE monitor It's not supported yet, but if you create a HCIDUMP or use the report_unknown option of this integration, I can have a look if it is using the MiBeacon BLE protocol.

@dewgenenny
Copy link
Contributor

dewgenenny commented May 20, 2021 via email

@DorianRudolph
Copy link

I think there might be different versions? I have the "EU Vesion" of the A1 Pro and it does not seem to have WLAN support. The WalkingPad app uses bluetooth.

@DorianRudolph
Copy link

@thomasvs I can control my A1 Pro via BLE using the following code. It does not connect to the Xiaomi App, only to the WalkingPad app.

import BLE_GATT
import time

pad_address = '57:4C:4E:29:07:F1'
att_uuid = '0000FE02-0000-1000-8000-00805F9B34FB'
start_cmd = bytes.fromhex("f7a20401a7fd")

sleep_cmd = bytes.fromhex("f7a20202a6fd")
manual_cmd = bytes.fromhex("f7a20201a5fd")
automatic_cmd = bytes.fromhex("f7a20200a4fd")


def set_speed(s):
    pad.char_write(att_uuid, (0xf7, 0xa2, 0x01, s, s + 0xa3, 0xfd))


def set_init_speed(s):
    pad.char_write(att_uuid, (0xf7, 0xa6, 0x04, 0x00, 0x00, 0x00, s, s + 0xaa, 0xfd))


pad = BLE_GATT.Central(pad_address)
pad.connect()

set_init_speed(20)
time.sleep(0.1)
pad.char_write(att_uuid, start_cmd)

pad.disconnect()

One can also read the status of the WalkingPad, which I didn't implement. At least mode and speed are obvious, when looking at the wireshark trace, but not sure how to receive the other statistics (maybe not even possible, because the app does not seem to display them correctly). Reverse engineering the WalkingPad app seems hard because it is written in flutter.

@pedropombeiro
Copy link

pedropombeiro commented Aug 26, 2021

One can also read the status of the WalkingPad, which I didn't implement. At least mode and speed are obvious, when looking at the wireshark trace, but not sure how to receive the other statistics (maybe not even possible, because the app does not seem to display them correctly). Reverse engineering the WalkingPad app seems hard because it is written in flutter.

Thanks for the code @DorianRudolph, it was a life saver! I ended up creating a simple Python command line tool to control my WalkingPad A1 Pro from the terminal (and later from an Elgato Stream Deck) based on your indications. Can you tell me what software you used to capture the Bluetooth communications for Wireshark, so I can try to read the status/statistics?

UPDATE: Oh, I found your https://github.com/DorianRudolph/QWalkingPad project, that's awesome!

@dmatora
Copy link

dmatora commented Dec 26, 2021

I can not see any mention of get_prop ["all"] in the thread, which is a bummer
it provides response like this

['mode:2', 'time:0', 'sp:0.0', 'dist:0', 'cal:0', 'step:0']

and should be used to get these props, since each get_prop takes about second to complete, and commands can not be processed in parallel

@dewgenenny
Copy link
Contributor

dewgenenny commented Dec 27, 2021

@dmatora you can check the code - there is a quick_status option -

def quick_status(self) -> WalkingpadStatus: """Retrieve quick status. The walkingpad provides the option to retrieve a subset of properties in one call: steps, mode, speed, distance, calories and time.status()will do four more separate I/O requests for power, mode, start_speed, and sensitivity. If you don't need any of that, prefer this method for status updates. """

edit - if you can suggest further speed ups to the main status, would be great!

@rytilahti
Copy link
Owner

Maybe it would have been a good idea to have quick_status() -> status() and the slower variant as full_status() or something like that? 🤔

@dmatora
Copy link

dmatora commented Oct 23, 2022

Could you create a new issue for the device? Do you know the model identifier (f.e. ksmb.walkingpad.v1) of the device?

@syssi There is an existing discussion for Xiaomi Induction Cooker #832

I left a comment there about chunmi.ihcooker.v2, can you help me with that one?

@Turkules
Copy link

Turkules commented Feb 5, 2023

Built myself an iOS app, to put steps from walking pad into apple health and watch my daily step goal
telegram-cloud-photo-size-2-5244712315109093918-y
telegram-cloud-photo-size-2-5246693751026463818-y
unfortunately it only works when web server with php script is providing miiocli bridge on local network
hopefully milo javascript library will get react native support soon enough and I'll be able to make this standalone app

Can you elaborate on your solution in more detail for "Non-experts" ?

@demirkolmustafa
Copy link

Built myself an iOS app, to put steps from walking pad into apple health and watch my daily step goal
telegram-cloud-photo-size-2-5244712315109093918-y
telegram-cloud-photo-size-2-5246693751026463818-y
unfortunately it only works when web server with php script is providing miiocli bridge on local network
hopefully milo javascript library will get react native support soon enough and I'll be able to make this standalone app

@dmatora I would happily pay for this app as this is a major painpoint for me with this product. I’ve reached out multiple times to Xiaomi on this but they won’t help, would be great if you can finish this app and launch it in the market

@dmatora
Copy link

dmatora commented Oct 22, 2024

@demirkolmustafa I just saw your message.
I've made a standalone app, that doesn't require php server about a year ago.
https://github.com/dmatora/WalkingPadRN
You can build it with Xcode and install on your iPhone.
Putting it on AppStore would cost me $100 per year and I don't think It would break even, not to mention make profit

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

Successfully merging a pull request may close this issue.