In summary I can control my WalkingPad if I specify its address on the command line from a Pi but not by allowing the script to discover the WalkingPad on its own. I have a large mount of BlueTooth devices, which could be the cause of the issue. In case others have this problem I thought I'd share my findings.
I have a KingSmith WalkingPad A1 and a Raspberry Pi 3+ and a 4B. Both Pis are running aarch64 Bullseye Raspbian Pi OS. The WalkingPad Iphone app connects to the WalkingPad ok. I've used pip install -U ph4-walkingpad" to install ph4-walkingpad, which completes ok. Both Pis are next to the WalkingPad and if I run bluetoothctl both Pis can 'see' the WalkingPad ok. With no bluetooth devices connected to the WalkingPad and the WalkingPad powered on and 'awake' I receive the same error message on the Pis when I run ph4-walkingpad-ctl --stats 750 --json-file ~/walking.json:
022-12-30 13:03:28 GymPi asyncio[1944] WARNING Executing <Task pending name='Task-1' coro=<WalkingPadControl.main() running at /usr/local/lib/python3.9/dist-packages/ph4_walkingpad/main.py:375> wait_for=<Future pending cb=[BaseSelectorEventLoop._sock_read_done(9, handle=<Handle BaseS...events.py:259>)(), <TaskWakeupMethWrapper object at 0x7f9d336190>()] created at /usr/lib/python3.9/asyncio/base_events.py:424> cb=[_run_until_complete_cb() at /usr/lib/python3.9/asyncio/base_events.py:184] created at /usr/lib/python3.9/asyncio/base_events.py:621> took 0.212 seconds
2022-12-30 13:03:31 GymPi __main__[1944] ERROR Exception in the main entry point: No address given to connect to
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/ph4_walkingpad/main.py", line 375, in main
await self.work()
File "/usr/local/lib/python3.9/dist-packages/ph4_walkingpad/main.py", line 95, in work
await self.connect(address)
File "/usr/local/lib/python3.9/dist-packages/ph4_walkingpad/main.py", line 75, in connect
await self.ctler.run()
File "/usr/local/lib/python3.9/dist-packages/ph4_walkingpad/pad.py", line 388, in run
await self.connect(address)
File "/usr/local/lib/python3.9/dist-packages/ph4_walkingpad/pad.py", line 303, in connect
raise ValueError('No address given to connect to' )
ValueError: No address given to connect to
2022-12-30 13:27:28 GymPi asyncio[1063] DEBUG Using selector: EpollSelector
2022-12-30 13:27:28 GymPi ph4_walkingpad.cmd_helper[1063] DEBUG Starting looper for loop <_UnixSelectorEventLoop running=False closed=False debug=False>
2022-12-30 13:27:28 GymPi ph4_walkingpad.pad[1063] INFO Scanning for peripherals...
2022-12-30 13:27:28 GymPi ph4_walkingpad.pad[1063] DEBUG Scanning kwargs: {}
2022-12-30 13:27:28 GymPi asyncio[1063] WARNING Executing <Task pending name='Task-1' coro=<WalkingPadControl.main() running at /usr/local/lib/python3.9/dist-packages/ph4_walkingpad/main.py:375> wait_for=<Future pending cb=[BaseSelectorEventLoop._sock_read_done(9, handle=<Handle BaseS...events.py:259>)(), <TaskWakeupMethWrapper object at 0x7f7bbea370>()] created at /usr/lib/python3.9/asyncio/base_events.py:424> cb=[_run_until_complete_cb() at /usr/lib/python3.9/asyncio/base_events.py:184] created at /usr/lib/python3.9/asyncio/base_events.py:621> took 0.521 seconds
2022-12-30 13:27:28 GymPi bleak.backends.bluezdbus.manager[1063] DEBUG initial properties: {'/org/bluez': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.AgentManager1': {}, 'org.bluez.ProfileManager1': {}, 'org.bluez.HealthManager1': {}}, '/org/bluez/hci0': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Adapter1': {'Address': 'B8:27:EB:CA:2B:29', 'AddressType': 'public', 'Name': 'GymPi', 'Alias': 'GymPi', 'Class': 0, 'Powered': True, 'Discoverable': False, 'DiscoverableTimeout': 180, 'Pairable': False, 'PairableTimeout': 0, 'Discovering': False, 'UUIDs': ['00001801-0000-1000-8000-00805f9b34fb', '00001800-0000-1000-8000-00805f9b34fb', '00001200-0000-1000-8000-00805f9b34fb', '0000110c-0000-1000-8000-00805f9b34fb', '0000110e-0000-1000-8000-00805f9b34fb', '0000180a-0000-1000-8000-00805f9b34fb'], 'Modalias': 'usb:v1D6Bp0246d0537', 'Roles': ['central', 'peripheral']}, 'org.freedesktop.DBus.Properties': {}, 'org.bluez.GattManager1': {}, 'org.bluez.LEAdvertisingManager1': {'ActiveInstances': 0, 'SupportedInstances': 5, 'SupportedIncludes': ['tx-power', 'appearance', 'local-name']}, 'org.bluez.Media1': {}, 'org.bluez.NetworkServer1': {}}}
2022-12-30 13:27:29 GymPi bleak.backends.bluezdbus.manager[1063] DEBUG received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0): ['org.bluez.Adapter1', {'Discovering': <dbus_fast.signature.Variant ('b', True)>}, []]
2022-12-30 13:27:29 GymPi bleak.backends.bluezdbus.manager[1063] DEBUG received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesAdded (/): ['/org/bluez/hci0/dev_57_4C_4D_20_04_BD', {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Device1': {'Address': <dbus_fast.signature.Variant ('s', 57:4C:4D:20:04:BD)>, 'AddressType': <dbus_fast.signature.Variant ('s', public)>, 'Name': <dbus_fast.signature.Variant ('s', Dynamax)>, 'Alias': <dbus_fast.signature.Variant ('s', Dynamax)>, 'Paired': <dbus_fast.signature.Variant ('b', False)>, 'Trusted': <dbus_fast.signature.Variant ('b', False)>, 'Blocked': <dbus_fast.signature.Variant ('b', False)>, 'LegacyPairing': <dbus_fast.signature.Variant ('b', False)>, 'RSSI': <dbus_fast.signature.Variant ('n', -51)>, 'Connected': <dbus_fast.signature.Variant ('b', False)>, 'UUIDs': <dbus_fast.signature.Variant ('as', ['0000fe00-0000-1000-8000-00805f9b34fb'])>, 'Adapter': <dbus_fast.signature.Variant ('o', /org/bluez/hci0)>, 'ManufacturerData': <dbus_fast.signature.Variant ('a{qv}', {96: <dbus_fast.signature.Variant ('ay', bytearray(b'WLM \x04\xbd'))>})>, 'ServicesResolved': <dbus_fast.signature.Variant ('b', False)>}, 'org.freedesktop.DBus.Properties': {}}]
(Other bluetooh devices removed)
2022-12-30 13:27:32 GymPi bleak.backends.bluezdbus.manager[1063] DEBUG received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_57_4C_4D_20_04_BD): ['org.bluez.Device1', {}, ['RSSI']]
(Other bluetooh devices removed)
2022-12-30 13:27:32 GymPi bleak.backends.bluezdbus.manager[1063] DEBUG received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0): ['org.bluez.Adapter1', {'Discovering': <dbus_fast.signature.Variant ('b', False)>}, []]
2022-12-30 13:27:32 GymPi ph4_walkingpad.pad[1063] INFO Device: [ 0], 57:4C:4D:20:04:BD, Dynamax, ['0000fe00-0000-1000-8000-00805f9b34fb']
2022-12-30 13:27:32 GymPi __main__[1063] ERROR Exception in the main entry point: No address given to connect to
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/ph4_walkingpad/main.py", line 375, in main
await self.work()
File "/usr/local/lib/python3.9/dist-packages/ph4_walkingpad/main.py", line 95, in work
await self.connect(address)
File "/usr/local/lib/python3.9/dist-packages/ph4_walkingpad/main.py", line 75, in connect
await self.ctler.run()
File "/usr/local/lib/python3.9/dist-packages/ph4_walkingpad/pad.py", line 388, in run
await self.connect(address)
File "/usr/local/lib/python3.9/dist-packages/ph4_walkingpad/pad.py", line 303, in connect
raise ValueError('No address given to connect to' )
ValueError: No address given to connect to
2022-12-30 13:27:32 GymPi __main__[1063] DEBUG Disconnecting coroutine
Hi
Firstly, thanks to the author of this project!
In summary I can control my WalkingPad if I specify its address on the command line from a Pi but not by allowing the script to discover the WalkingPad on its own. I have a large mount of BlueTooth devices, which could be the cause of the issue. In case others have this problem I thought I'd share my findings.
TLDR: To get my WalkingPad to work I had to issue the command:
python -m ph4_walkingpad.main -a 57:4C:4D:20:04:BDI have a KingSmith WalkingPad A1 and a Raspberry Pi 3+ and a 4B. Both Pis are running aarch64 Bullseye Raspbian Pi OS. The WalkingPad Iphone app connects to the WalkingPad ok. I've used
pip install -U ph4-walkingpad" to install ph4-walkingpad, which completes ok. Both Pis are next to the WalkingPad and if I run bluetoothctl both Pis can 'see' the WalkingPad ok. With no bluetooth devices connected to the WalkingPad and the WalkingPad powered on and 'awake' I receive the same error message on the Pis when I runph4-walkingpad-ctl --stats 750 --json-file ~/walking.json:I've run the command in debug mode and the output is shown below:
Thanks
Bert