Skip to main content

Walkingpad A1 controller via Bluetooth LE

Project description

Simple python script that can control KingSmith WalkingPad A1. Communicates via Bluetooth LE GATT.

Features

  • Switch mode: Standby / Manual / Automatic
  • Start belt, stop belt
  • Change belt speed (0.5 - 6.0), all options work, e.g. 1.2
  • Change preferences of the belt
    • Max speed
    • Start speed
    • start type (intelli)
    • Sensitivity in automatic mode
    • Display
    • Child lock
    • Units (miles/km)
    • Target (time, distance, calories, steps)
  • Ask for current state (speed, time, distance, steps)
  • Ask for last stored state

Demo

For the best understanding start jupyter-notebook and take a look at belt_control.ipynb

# Install jupyter-notebook
pip3 install jupyter

# Start jupyter-notebook in this repository
jupyter-notebook .

# open belt_control.ipynb

Controlling script is not yet implemented. Play with the notebook.

The main controller class is Controller in pad.py

Controller

Controller enables to control the belt via CLI shell.

Start controller:

python -m ph4_walkingpad.main --stats 750 --json-file ~/walking.json

The command asks for periodic statistics fetching at 750 ms, storing records to ~/walking.json.

Output

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    WalkingPad controller

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$> help

Documented commands (use 'help -v' for verbose/'help <topic>' for details):
===========================================================================
alias      help     py  quit          set        speed   stop
ask_stats  history  Q   run_pyscript  shell      start   switch_mode
edit       macro    q   run_script    shortcuts  status  tasks

$> status
WalkingPadCurStatus(dist=0.0, time=0, steps=0, speed=0.0, state=5, mode=2, app_speed=0.06666666666666667, button=2, rest=0000)
$> start
$> speed 30
$> speed 15
$> status
WalkingPadCurStatus(dist=0.01, time=16, steps=18, speed=1.8, state=1, mode=1, app_speed=1.5, button=1, rest=0000)
$> status
WalkingPadCurStatus(dist=0.01, time=17, steps=20, speed=1.5, state=1, mode=1, app_speed=1.5, button=1, rest=0000)
$> speed 30
$> speed 30
$> stop
$> start
$> speed 30
$> status

Due to nature of the BluetoothLE callbacks being executed on the main thread we cannot use readline to read from the console. (At least I have currently no idea how to do it).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ph4-walkingpad, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size ph4-walkingpad-0.0.3.tar.gz (11.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page